I've been trying to set a stop limit order for a vertical spread, but haven't been successful.
Whenever I set the orderType to OrderType.STOP_LIMIT, I got the following error from the broker:
_b'{\n "error" : "OrderType must be one of those values: NET_CREDIT, NET_DEBIT, NETZERO or MARKET."\n}'
If I set the orderType to OrderType.NET_CREDIT or OrderType.NET_DEBIT, it became a Limit Order, which is not a Stop Limit Order.
Here is my code to build a stop limit order to buy back a vertical spread:
Can you please point out what wrong with the code? Has anyone successfully gotten the stop limit order working? Any sample code of it is very appreciated. Thanks!
I've been trying to set a stop limit order for a vertical spread, but haven't been successful.
Whenever I set the orderType to OrderType.STOP_LIMIT, I got the following error from the broker: _b'{\n "error" : "OrderType must be one of those values: NET_CREDIT, NET_DEBIT, NETZERO or MARKET."\n}'
If I set the orderType to OrderType.NET_CREDIT or OrderType.NET_DEBIT, it became a Limit Order, which is not a Stop Limit Order.
Here is my code to build a stop limit order to buy back a vertical spread:
I read TD API from https://developer.tdameritrade.com/account-access/apis/post/accounts/%7BaccountId%7D/orders-0. It seems that they support stop limit order through API.
Can you please point out what wrong with the code? Has anyone successfully gotten the stop limit order working? Any sample code of it is very appreciated. Thanks!