开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: How to get position info in "points"


 

As Jürgen mentioned, you need to keep track of PnL yourself based on the executions.
Reconciliating against reqPnl should be a governance / secondary check function and not be based on for trading.
?
As such it's not directly a TWS related question. For example, more advanced PnL engines will keep track of the following also:
- arrival time
- arrival price (what is current market price when you decide to go long)
- fill times
- fill prices
- average of fill prices
- slippage (fill price - arrival price)
- commisions
- market cost (fill price - mid price on each fill)
- price impact (mid price 3 minutes later vs fill price)
- MAE (in-trade)
- MFE (in-trade)
- draw-down across trades
- profit
- %win
- avg. win
etc...
?
You would need to pay alot of attention to the number handling (especially where you might have zeroes and a division - for example with 0 trades you would return something for %win even if the division by zero number of trades is undefined).
Depending on what you're doing you might want to optimize secondarily also for different parameters (like minimize price impact) or just use one of the existing TWS algos.

Join [email protected] to automatically receive all group messages.