Jump to content
Sign in to follow this  
KhoaNguyen

One Cancel Other order

Recommended Posts

Hello,

I see that there is only one service "newstoplimitorder" which has the property "OcoOrder" for One Cancel Other order.

Is there any other service for placing a One Cancel Other order?

Does the GC API support to place Contingent order? If so, would you please show me that service?

 

Share this post


Link to post

Hi,

One Cancels the Other (OCO) orders are only placed using the "OcoOrder" property in the "newstoplimitorder" service. There is not a specific service for OCO orders only.

When you ask about Contingent orders - I am assuming you are referring to If/Done orders. This is where you attach orders to your entry limit order and if the entry order is filled, the attached orders then become active and are attached to the open position. 

To create Contingent If/Done orders, you use the "IfDone" property in the "newstoplimitorder" service.

Kind Regards, PM! 

 

Share this post


Link to post

Hi. I have placed a trade and can see the open position. Now I am using updateStopLossLimit API to update order to set stop loss and limit.  I want to to do it in similar manner the way we can do it via website like oco (if any of stop loss or limit executes, it cancels others). Can you share sample request of ocoOrder as I do not find any.

Thanks in advance.  

Share this post


Link to post

Hi,

Since there is no "updateStopLossLimit" service on the API, I'd like to clarify your request.

Are you asking how to attach closing stop and limit orders to an open position? If you are, there is an example in the "How Do I...? Place Trades and Orders topic in the documentation. The specific part you are looking for in that topic is under the heading: How do I attach a closing order to an open position?

Closing stop and limit orders attached to an open position already work in the same way as opening OCO orders. When either the stop or the limit is triggered and closes the position, the other order is automatically cancelled. 

Kind Regards, PM!

 

 

Share this post


Link to post

I've tried to use If/Done orders in the /newstoplimitorder api call.

I can see the result in the active orders list  (CityIndex), an entry stop with the "oco" limit and stop values I used.

However, when the entry order fills, the existing stop and limit orders that hold those values are cancelled and new ones are created. The new stop and limit ids are different. There is no reference to the new position in these entry orders. Nor does the new position have any reference to the stop and limit.

This is not quite the behavior Physicsman described in his response above:

"I am assuming you are referring to If/Done orders. This is where you attach orders to your entry limit order and if the entry order is filled, the attached orders then become active and are attached to the open position."

What I was trying to achieve:
- an entry stop with two attached stop and limit closing orders.
- when the entry stop fills and becomes an open position, the closing stop and limit orders are attached to it and don't change their id.
- if these closing orders have to change their id, then I would need to be able to reassociate these closing orders to their position somehow, perhaps in the ParentOrderId or using the associated field in the position.

You can test this yourself using CityIndex:
- place an entry stop order with a oco stop and limit attached
- when the entry stop fills, the stop and limits are cancelled and new ones take their place.
- these new stop and limits are not associated with the open position in any way.
- the new stop has the new limit order listed as an oco, but the new limit order does not have the new stop order in its oco field.
-- when i close or cancel one, the other does not close

I'll send you more info as you like.

Thanks,
Chris

Share this post


Link to post

Hi,

Quick check, did you use the "IfDone" property in the NewStopLimitOrderRequestDTO, or the "OcoOrder" property? The results you are receiving sound like you are using "OcoOrder", instead of what should be used - "IfDone". 

There is a difference between an OCO and If/Done orders in the way they are used and behave.    

Kind Regards, PM!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×