I saw in the documentation that trailing stop orders are to come.
Any help with code (python) that could monitor 1 minute price moves and create a market sell order when the ‘trailing stop’ has been reached?
Buy SPY @ $300
Currently, I could open a limit sell at $270 (down 10%).
If SPY runs to $350, I’d like to have code that is checking every minute if SPY falls below $315 (down 10% from $350). Once the current price hits $315, I’d automatically enter a market sell order.
I’m learning python, so my rough logic would be:
executed_order_price = [get from orders]
current_price = [get from market]
if(current_price > executed_order_price):
if current_price < (high_price * 0.9)