tdameritrade
tdameritrade copied to clipboard
Can't create OCO
I am having difficulties in creating an OCO leg order where one is a limit and the other is a stop limit.
The create_equity_order_leg
does not accept order type and price, so I can not see where to add these arguments. Am I missing something or it is not implemented?
What I have right now:
from tdameritrade.orders import constants as td_const
from tdameritrade import orders
order_leg = orders.leg_builder.create_equity_order_leg(
instruction=td_const.Instruction.SELL,
quantity=1,
symbol='AA',
# orderType=td_const.OrderType.LIMIT,
# price="26"
)
order_leg1 = orders.leg_builder.create_equity_order_leg(
instruction=td_const.Instruction.SELL,
quantity=1,
symbol='AA',
# orderType=td_const.OrderType.STOP,
# price="26"
)
order_leg_collection = [order_leg,order_leg1]
order_mine = orders.order_builder.Order(
session=td_const.Session.NORMAL,
duration=td_const.Duration.DAY,
orderStrategyType=td_const.OrderStrategyType.OCO,
orderLegCollection=order_leg_collection,
)