API Support Forum
OEC API > Advanced Order Management > Order Management
Author Topic: Order Management
(10 messages, Page 1 of 1)
Moderators: VPfau
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 03, 2007 @ 12:11 PM             Msg. 1 of 10
I would like to start by asking for an explination on the management of orders and positions in the API. I would like a simple discription on a life cycle of a trade in the api. for example when an trade is placed it is first an "OrderDraft" then becomes a "Order" with possible multiple fills in side it. The trade if filled then is also a "Position". This is were I am not sure and am having a tough time following. How do I follow open positions and when the trade becomes offset with another trade it becomes closed, where is the two trades in the API?

I would also like to know what happens to an open trade over the period of a day session in the API managment, is it a "Position" or a "Fill" or a "PositionFill"?

Now that I am confused please help.
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Oct 03, 2007 @ 02:50 PM             Msg. 2 of 10
Please see Account.DetailedPositions for trades opened and closed during the day session.

each Position instance has Fills connection, where PositionFill contains references to original order fills.
Edited by SergeK on Oct 3, 2007 at 02:50 PM
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 03, 2007 @ 06:15 PM             Msg. 3 of 10
ok, I will ask a simpler question:

-In the 'Position' there is a 'Fills' which is a 'PositionFillList' inside that list is 'PositionFill's. Can I assume that the number of 'PositionFills' is going to be one for open trades and two for a closed trade?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Oct 04, 2007 @ 08:21 AM             Msg. 4 of 10
No, that is incorrect. open position could consist of more than one fill, for example, if you place two buy orders or your order filled with two fills. Also, for closed positions number of opening fills could be different than number of closing fills, but sums of their quantities are equal.

to tell open position from closed ones, see Position.Net.Volume property - if it is zero, position is closed.
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 04, 2007 @ 05:12 PM             Msg. 5 of 10
Thanks for clearing that up.
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 11, 2007 @ 11:37 AM             Msg. 6 of 10
One more question here. I have a postion that hase been open for two days now, and I can't find the timestamp of when I opened that position. I have looked in Position->Date, Position->Long->Timestamp, and both of these are zero. I need a date of when I placed this trade.

Also It looks like the commission for this trade has now gone to zero. where is that as well?
Edited by PArnoldson on Oct 11, 2007 at 11:38 AM
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 11, 2007 @ 11:45 AM             Msg. 7 of 10
I have found my own anwser to the date of my position it was in the position->SourcePreviousPosition->Timestamp.

My question now is the commission?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Oct 11, 2007 @ 12:20 PM             Msg. 8 of 10
commissions for previous days are not available.
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Oct 11, 2007 @ 12:35 PM             Msg. 9 of 10
Btw, the time of current position is located in property Position.Net.Timestamp.
The time of previous day position - in Position.Prev.Timestamp.
These times could be equal if there are no trades in the current day session.
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Oct 19, 2007 @ 06:45 PM             Msg. 10 of 10
One more question here: I was looking at closed positions were the Net Volume is 0. I was wondering about the closed side of this, Is the number of "Fills" for the closed side 1 or could there be multiple closed "Fills"? I know that there could be multiple "Fills" for the opening side, but I don't know about the closing side. I am just concerned at how to match up an open Fill to a closed Fill if there is more than 1. Thank you.