ib_async
ib_async copied to clipboard
"Error 10293, reqId 23956: Cryptocurrency Cash Quantity order cannot specify size"
Working from the Notebooks in the documentation for ib_async, I am trying to place a cryptocurrency trade in my paper account as follows:
c = Contract(secType='CRYPTO', conId=541686651, symbol='BTC', exchange='ZEROHASH', currency='USD', localSymbol='BTC.USD', tradingClass='BTC')
ib.qualifyContracts(c)
o = MarketOrder('BUY', totalQuantity=92, cashQty=17)
o.orderId = 0
o.tif = 'GTC'
trade = ib.placeOrder(c, o)
This executes, but is immediately cancelled with the message='Error 10293, reqId 23957: Cryptocurrency Cash Quantity order cannot specify size' in a TradeLogEntry of the log of the Trade (found with pprint(ib.trades())). I grant that specifying values for both totalQuantity and cashQty seems potentially problematic, but omitting either specification leads to order failure:
- Omitting
totalQuantity=92above produces the TypeError"TypeError: MarketOrder.__init__() missing 1 required positional argument: 'totalQuantity'". - If
cashQty=17is omitted, the order is immediately cancelled with themessage='Error 10289, reqId 23964: You must set Cash Quantity for this order'in aTradeLogEntryof thelogof theTrade.
What is the appropriate way to specify a cryptocurrency order like the above in ib_async?
UPDATE: When I set totalQuantity=0 and re-place the order, it neither throws an error nor is cancelled, but indefinitely has status='PendingSubmit' in the orderStatus of the Trade object (again per pprint(ib.trades())). I'm still not sure what is going on here. Is totalQuantity=0 just ignored? If so, why isn't the order submitted and filled?
I'm seeing the same behavior as the UPDATE. Any resolution?