alpacahq / alpaca-trade-api-csharp

C# SDK for Alpaca Trade API https://docs.alpaca.markets/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does Alpaca support One Triggers Another trade?

rudeGit opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

What is your question?

Brokers like fidelity support the functionality of entering 2 trades simultaneously, but the second trade only executes if the first trades executes?

For example, say I already own 10 AAPL shares.
I wanted to sell all 10 of them at stop loss order of $160 (while the current price of AAPL is around $172) and if this executes I want the second order of limit buy 4 shares of MSFT at $390 (while the current MSFT is around $404) to be entered automatically. If AAPL sell trade never executes, the MSFT trade is never entered.

Is this possible with Alpaca C# API? If so, how do I go about it?

Anything else?

No response

Unfortunately, @rudeGit, the underlying Alpaca API doesn't support inter-commodity OTO/OCO orders. All advanced orders are always placed for the same asset. You can open an issue for the underlying API but in the meantime, you have only one option - implementing this logic on the client side using trade streaming events for instance.