Placing Orders with a Spread Based on Historical Data
Learn how to create Origami grid strategies that adjust spreads dynamically based on historical volatility and price performance.
{
"gap_ask": "0.005",
"gap_bid": "0.005",
"price_ask": "max(orderbook().ask[0].price-symbol().price_precision,(two_weeks_mean_high+two_weeks_mean_close)/2,mean_high_15m,min_ask_price)",
"price_bid": "min(orderbook().bid[0].price+symbol().price_precision,(two_weeks_mean_low+two_weeks_mean_close)/2,mean_low_15m,max_bid_price)",
"candles_1d": "candles('d1', 'base-counter',count=14)",
"spread_min": "10*symbol().price_precision",
"candles_15m": "candles('m15','base-counter')",
"mean_low_15m": "mean([price.low for price in candles_15m])",
"execute_price": "(((price_bid+price_ask)/2-spread_min/2)*(1+gap_bid*(order_pos+1)) if side=='buy' else ((price_bid+price_ask)/2+spread_min/2)*(1+gap_ask*(order_pos-1))) if (price_ask-price_bid)<spread_min else (price_bid*(1+gap_bid*(order_pos+1)) if side=='buy' else price_ask*(1+gap_ask*(order_pos-1)))",
"max_bid_price": "mean_low_15m",
"mean_high_15m": "mean([price.high for price in candles_15m])",
"min_ask_price": "mean_high_15m",
"execute_volume": "(6/execute_price if execute_price>two_weeks_mean_low else 10 / execute_price * abs(order_pos)) if side=='buy' else (6/execute_price if execute_price<two_weeks_mean_high else 10 / execute_price * abs(order_pos))",
"buy_orders_count": "5",
"sell_orders_count": "5",
"two_weeks_mean_low": "mean([price.low for price in candles_1d])",
"two_weeks_mean_high": "mean([price.high for price in candles_1d])",
"two_weeks_mean_close": "mean([price.close for price in candles_1d])"
}Ask Price Calculation
Bid Price Calculation
Spread and Price Adjustment
Order Volume Calculation
PreviousPlacing Orders at the Best Price or with a Minimum SpreadNextPlacing Buy and Sell Orders Based on RSI of 15-Minute Candlesticks
Last updated