Hi there,
I want to use Python to place a bracket order with a stop loss and take profit.
I used the following code:
symbol = ‘AAPL’
symbol_price = 155
tradeapi.REST(…).submit_order(
symbol=symbol,
qty=1,
side=‘buy’,
type=‘market’,
time_in_force=‘gtc’,
order_class=‘bracket’,
stop_loss={‘stop_price’: symbol_price * 0.95,
‘limit_price’: symbol_price * 0.94},
take_profit={‘limit_price’: symbol_price * 1.05})
However, when I go to my dashboard, I see that I have a ’ Day Trade Count’.
How is that possible and how can I properly place a bracket order using python?
Thanks!
@Niels_Haenen You seem to be correctly placing a bracket order. By definition a bracket order includes orders to both open and close a position. A day trade by definition is opening and closing a position in the same day. Therefore, a bracket order has the potential to create a day trade since the parent order and the leg order(s) could all fill in the same day. The ‘day trade count’, perhaps not obviously, includes both actual and ‘potential’ day trades. That is why one sees the count increase when placing a bracket order. It creates a ‘potential day trade’.
There isn’t any way to enter more bracket orders above one’s day trade limit. One would need to enter the initial open order, then the following day, enter a OCO order with the take profit and stop loss orders. This effectively creates a bracket order but splits it in two. The OCO order can be placed before markets open the following if desired.
1 Like