td-ameritrade-python-api icon indicating copy to clipboard operation
td-ameritrade-python-api copied to clipboard

Market_on_close orders with multiple order legs

Open dudeman3 opened this issue 3 years ago • 1 comments

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" } }] }

dudeman3 avatar Apr 04 '21 16:04 dudeman3

I'm going to add this to the documentation, I think it's useful for people to know.

areed1192 avatar Jul 21 '21 18:07 areed1192