API Support Forum
OEC API > API Support > Open PnL
Author Topic: Open PnL
(7 messages, Page 1 of 1)
Moderators: VPfau
THarnett81
Posts: 78
Joined: Jan 13, 2011


Posted: May 12, 2011 @ 02:52 PM             Msg. 1 of 7
Hello.

Can I assume that OTE is equivalent to unrealized or open PnL in the API?

Also, does the simulation environment reflect that information back?

Thanks.
THarnett81
Posts: 78
Joined: Jan 13, 2011


Posted: May 17, 2011 @ 05:08 PM             Msg. 2 of 7
Couple more questions....

We've decided to use OTE for Open P/L and NetGain for Realized P/L.

One thing I noticed during testing though, say I've bought and sold and established a Realized P/L of 10. If I buy again and am long 2, NetGain goes to 0 while OTE will fluctuate. Should NetGain reset to 0? Is that just an artifact of the simulation environment? If I've bought and sold and established a realized P/L, I wouldn't expect that to go to zero because I've bought more.
VictorV
Posts: 746
Joined: May 08, 2007


Posted: May 23, 2011 @ 11:45 AM             Msg. 3 of 7
Hello,

please check what position did you use. It looks like you check values of the last detailed position instead of the current average position.

Victor Vins
Software Developer
THarnett81
Posts: 78
Joined: Jan 13, 2011


Posted: May 23, 2011 @ 12:54 PM             Msg. 4 of 7
As I mentioned, we're using NetGain which according to the API documentation is:

Realized profit/loss converted to USD minus commissions

Gain, which is defined as:

Total profit/loss (sum of realized and open p/l) in USD

So even though there's no comment about "last detailed position", these are not the right members to use? Which member gives the current average position?
VictorV
Posts: 746
Joined: May 08, 2007


Posted: May 23, 2011 @ 01:42 PM             Msg. 5 of 7
Could you please show the code that you use to get a position?

Victor Vins
Software Developer
THarnett81
Posts: 78
Joined: Jan 13, 2011


Posted: May 24, 2011 @ 12:10 PM             Msg. 6 of 7
We had a code error such that the OnAvgPositionCallback wasn't being handled correctly.

We're a bit confused about DetailedPosition, however. What is that good for?
VictorV
Posts: 746
Joined: May 08, 2007


Posted: May 25, 2011 @ 09:59 AM             Msg. 7 of 7
Hello,

Detailed positions (http://www.openecry.com/api/api/OEC.API.Account.DetailedPositions.html) can be used to research "paired" trades (FIFO pairing). Unpaired (or open) ones will the last item in collection.

Victor Vins
Software Developer