Open
Description
Expected Behavior
Binance Futures do not support limit maker orders (limit order with post-only property)
https://developers.binance.com/docs/derivatives/
Actual Behavior
When we place a limit order with post-only property, we get {"code":-1116,"msg":"Invalid orderType."}
Code
# region imports
from AlgorithmImports import *
# endregion
class CrawlingOrangeCat(QCAlgorithm):
def initialize(self):
self.set_start_date(2023, 7, 30)
self.set_end_date(2023, 8, 30)
self.timezone = TimeZones.UTC
self.set_time_zone(self.timezone)
self.set_start_date(2025, 1, 1)
self.set_end_date(2025, 2, 1)
self.set_account_currency("USDT")
self.set_cash("USDT", 100000)
interest_rate_model = BinanceFutureMarginInterestRateModel()
self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
self.default_order_properties = BinanceOrderProperties()
self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED
self.default_order_properties.post_only = True
sec = self.add_crypto_future(
ticker='BTCUSDT',
resolution=Resolution.MINUTE,
fill_forward=False)
sec.SetMarginInterestRateModel(interest_rate_model)
self.symbol = sec.symbol
self.traded_time = None
def on_data(self, data: Slice):
if not self.traded_time:
if self.symbol in data.bars:
p = data.bars[self.symbol].close
self.limit_order(self.symbol, 0.03, 0.99*p, tag='test', order_properties=self.default_order_properties)
self.traded_time = self.time
else:
if (self.time - self.traded_time).total_seconds() > 60 * 1:
self.transactions.cancel_open_orders()
Potential Solution
BinanceBaseRestApiClient.cs#L272
if (Equals(body["type"], "LIMIT_MAKER") && order.SecurityType == SecurityType.CryptoFuture)
{
throw new NotSupportedException($"{nameof(BinanceBaseRestApiClient)}.{nameof(CreateOrderBody)}: Unsupported order type: {order.Type} for {SecurityType.CryptoFuture}");
}
We need to update the brokerage model too.
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
master
branch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue