API Support Forum
OEC API > Advanced Order Management > OCO and OSO order
Author Topic: OCO and OSO order
(4 messages, Page 1 of 1)
Moderators: VPfau
CBabula4045
Posts: 11
Joined: Oct 19, 2015


Posted: Mar 24, 2016 @ 07:10 AM             Msg. 1 of 4
Hello there,

I would like to send from C# API 2 entry orders, one long and one short that would cancel each other when either is filled. Additionally I want to send the take profit and stop loss orders for position closing when one of the above orders are executed. Is there any way I could create this kind of order linking?

How would I achieve this?

Thanks!

Cristian nicanor Babula
NShine
Posts: 36
Joined:


Posted: Mar 24, 2016 @ 10:58 AM             Msg. 2 of 4
CBabula4045
Posts: 11
Joined: Oct 19, 2015


Posted: Mar 24, 2016 @ 11:47 AM             Msg. 3 of 4
Thank you very much for the reply.

I already used those APIs. The problem is that I cannot combine them to obtain a slightly more complex result.

Here's what I need:
In the typical scenario I want to send the following orders as OCO:

EntryLong1 @ 14.5
EntryShort1 @ 13.0


But if we zoom in a little bit, they are also OSO orders with the takeProfit/stopLoss orders linked to them as follows:


EntryLong1 @ 14.5 -----------------------------------------------
=> EntryLong1TakeProfit(*) @ 15.0 |
=> EntryLong1StopLoss(*) @ 14.0 OCO
|
EntryShort1 @ 13.0 ----------------------------------------------
=> EntryShort1TakeProfit(**) @ 13.5
=> EntryShort1StopLoss(**) @ 12.5


* - EntryLong1TakeProfit and EntryLong1Stoploss must be Held until EntryLong1 gets filled
** - EntryShort1TakeProfit and EntryShort1StopLoss must be held until EntryShort1 gets filled

In other words I would need to call twice SendLinkedOrders, where the main orders are linked with OCO between each other.

Hope this clarifies my needs a bit.

Thanks!

Cristian nicanor Babula
NShine
Posts: 36
Joined:


Posted: Mar 24, 2016 @ 03:05 PM             Msg. 4 of 4
Sorry, I now understand what you are trying to accomplish. Unfortunately, we do not support linking two OSO orders together in this way. Depending on how important this is to you, your best bet would be to build this all client side. You already seem to understand how to use our SendLinkedOrders method, so your code would simply cancel whichever order doesn't execute first. The biggest downsides would be...
    1. both orders could execute if your client is disconnected
    2. the exchange could complete both faster than your code can send the cancel request