Author |
Topic: How to track orders placed (main order vs. stop-loss) (4 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
I am trying to figure out which of the properties in OrderDraft to set to distinguish my main order from my stop-loss and profit order (which are placed as an OCO). For now I have set the comment property to "1" for main order and "0" for either stop-loss or profit order.
Should I be using extData? I tried to manually set that but was unfamiliar with the ExtendedData data type, any code samples you could provide would be useful. If this is handled in the Advanced OEC API example please reference to me a file/line or method name. John Gagnon |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
To find out relations between OCO and OSO orders you need to use the next properties: http://www.openecry.com/api/api/OEC.API.Order.Linked.html and http://www.openecry.com/api/api/OEC.API.Order.OCO.html
ExtData is intialized/modified by OrderDraft methods: SetEquityTSData, SetIcebergData, SetTSData and SetVBSData. You don't need to set it manually. Victor Vins Lead Software Developer |
||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
Thanks Victor -
I guess what I am asking is when an order is filled, how do I know if it was my main order, my profit order, or my stop-loss order? I might have different trades I want to execute based on the type of order that was filled. For example, say my main order is sell short 2 contracts my profit order is buy-limit 1 contract my stop loss order is buy-stop 2 contracts When the buy-limit 1 contract fills I want to know by looking at the Order object that it is a profit order and then place a new OCO order for buy-limit 1 and buy-stop 1. Currently I am setting the comments field in the order object to differentiate between main order, profit and stop-loss. Is this normally how it is done or is there another property I can use to distinguish what kind of order was just filled? John Gagnon |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Got it. In this case, you're right - Comments field is the best choice.
Victor Vins Lead Software Developer Edited by VictorV on Mar 15, 2012 at 11:13:47 |
||||