Selling at the Best Price with Minimum Price and Balance Constraints
Grid 1: Selling at the Best Price with Minimum Price and Balance Constraints
{
"gap": "0.005",
"execute_price": "max(orderbook().ask[0].price-symbol().price_precision,min_ask_price)*(1+gap*(order_pos-1))",
"min_ask_price": "orderbook().bid[0].price+symbol().price_precision",
"execute_volume": "10/execute_price+abs(order_pos)*10/execute_price",
"buy_orders_count": "0",
"sell_orders_count": "5 if balance('counter').total < 5000 else 0"
}
The grid places sell orders at the best price.
An additional parameter, gap, is used to calculate the order prices. In this example, it is set to 0.5%, and the price increment is calculated as: 1+gap*(
order_pos
-1)
min_ask_price
in this case :
orderbook().bid[0].price+symbol().price_precision
Sets the minimum sell price to 1 price_precision above the best bid. A specific number can also be used as a constraint.
execute_volume: Sets the order volume in Base tokens.
For the first order, the volume corresponds to 20 Counter tokens.
For each subsequent order, the volume increments by 10 Counter tokens.

10/
execute_price
+
abs
(
order_pos
)*10/
execute_price
Orders will be placed until the balance of the Counter token exceeds 5000.

group_balance('counter').current.total
5 if group_balance('counter').current.total < 5000 else 0
or based on the token balance. base balance('base').total
5 if balance('base').total > 5000 else 0
Last updated