I want put 2 OSO order in one time,for example,8:00 am ,now mnq is 14500,
place first OSO:
buy stop 14510 , bracket1 Sell 14520 limit ,bracket2 Sell stop 14490,
place second OSO:
sell stop 14490 , bracket1 buy 14480 limit ,bracket2 buy stop 14500
I need cancel one order when other order is filled,
does it can use OCO with 2 OSO ? or I need sub the order filled event ,cancel orther order?
how can I sub the order filled event?
You could watch for a few things. You’ll need to use a realtime data websocket. Once you’ve established a real-time data synchronization, these events will come through the socket like this:
[
{
e: 'props',
d: {
eventType: 'Created' | 'Updated',
entityType: string, //there are a lot of options. I'll include a link for more info
entity: Object //one of our Tradovate Entities. entityType determines its shape.
}
},
//maybe more than one prop per response, make sure to process each item
]
You start the subscription to these events by calling the user/syncrequest
endpoint on the WebSocket you want to listen to these events through.
One entity that you could look for is your Position (entityType === 'position')
. When you have an open position, the position related to the contract that you’re trading will have a netPos !== 0
(could be positive or negative). When that position becomes 0 again, it’s been flattened. You can watch to see if your netPos has flattened and then send the next order.
ExecutionReports (entityType === 'executionReport'
) are useful for finding out what actions (Commands
) you took that made it to execution. If an ExecutionReport has to do with an order, it will have execType === 'OrderStatus'
. Then it will also have another field, ordStatus
. This will tell you what happened to the order, including if it was filled (ordStatus === 'Filled'
)
You can look at a good list of the possible entity types in the docs for SyncRequest. Expand the Sync Response object below the definition for a good reference on what types of entities there can be.
Thank alex,OK ,now I can send 2 OSO order in up and down piont,and sub the fill prop event of one OSO order, to cancel other OSO order,but there has 3 order Id in one OSO request: orderId ,oso1Id, oso2Id
,my question is Does I only need cancel the orderId is OK,TR server will cancel the oso1Id and oso2Id,
or I need cancel all the 3 Id?
OK,I tested,just need cancel the pending order,
Did you ever figure this out? This is my current issue, is having pending orders cleared properly, without having to liqudate