td-ameritrade-python-api
td-ameritrade-python-api copied to clipboard
Market_on_close orders with multiple order legs
It appears that market_on_close orders cannot be done with multiple orders in the orderLegCollection? If I only include a single order it works. But multiple orders throws this error:
NotNulError: { "error" : "OrderType must be one of those values: NET_CREDIT, NET_DEBIT, NET_ZERO or MARKET." }
EXAMPLE CODE: MOC_order = { "orderType": "MARKET_ON_CLOSE", "session": "NORMAL", "duration": "DAY", "orderStrategyType": "SINGLE", "orderLegCollection": [ { "instruction": "BUY", "quantityType": "SHARES", "quantity": 10, "instrument": { "symbol": SPY, "assetType": "EQUITY" } }, { "instruction": "BUY", "quantityType": "SHARES", "quantity": 10, "instrument": { "symbol": QQQ, "assetType": "EQUITY" } }] }
I'm going to add this to the documentation, I think it's useful for people to know.