C# API questions for cancelled orders and trailing stops

Hi guys! Long time reader, first time post :slight_smile:

I have been working on some integration with NinjaTrader that have been going pretty well thanks to the C# API Wrapper. I have a few questions though and thought I would post for some feedback.

First, I should mention I have programmed a lot of algos with a lot of platforms and the number one issue I have always found that pops up is orders that are for whatever reason, left hanging as open orders… Even strategies with fail safes that run for years seem at one point or another to run into this. So related to this and Alpaca and as I work with the API and this algo, I have a few questions.

  1. Are there any parameters we can pass to the PostOrderASync (like a boolean?) that would force all pending orders to be cancelled before a new order is submitted? I realize you can cancel orders before calling but since requests are async there is always a chance one hits before the other… and in my specific case my code isn’t really setup to “wait” for the first request to finish.

  2. Is it possible to submit a request to cancel all pending orders for a symbol? I see that I can delete all orders and pass a symbol, but not cancel. I also see that I can submit the call to cancel all open orders but not by symbol.

  3. When the system accepts a trailing stop, is it always assuming that the order was properly filled and before the trailing stop would be in the system? For example, if I submitted a limit order that was never filled and then I submitted a trailing stop order… would I possibly ever been in a short position because it could trigger an order in the other direction? It would really be nice if we could submit a trailing stop order at the same time placing the order… similar to how you can already do with bracket orders. Is this possible already?

Thanks,

-Chad
www.nashtech.xyz