Author |
Topic: Open PnL (7 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
THarnett81 Posts: 78 Joined: Jan 13, 2011 |
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 |
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 |
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 |
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 |
Could you please show the code that you use to get a position?
Victor Vins Software Developer |
||||
THarnett81 Posts: 78 Joined: Jan 13, 2011 |
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 |
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 |
||||