Hi Alpaca Team,
I’m using the Trade API in paper trading mode, and here’s the workflow I’ve implemented:
- I successfully submit a buy order using the Trade API.
- After the buy is filled, I submit an OCO sell order (limit + stop) using the same API.
- I’m able to update/replace the OCO order dynamically based on certain price conditions.
- When the condition is false, the program does not update the OCO order (as intended).
However, I’m facing an issue in the final step:
- Every time the condition changes, I cancel the previous OCO order and submit a new one — this is working most of the time.
- But occasionally, when I cancel the OCO order, only the limit order gets canceled, while the stop order remains active.
Could you please help me understand:
- Why the stop order might not be canceled?
- Is this a known issue in paper trading?
- Is there a recommended way to ensure both legs of the OCO get canceled?
Thanks in advance!