How to get position details? (for realized pnl)

Created at 08 Dec 2024, 11:32
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AL

alshdavid

Joined 27.10.2024

How to get position details? (for realized pnl)
08 Dec 2024, 11:32


I'm trying to get the realized pnl for a closed position, basically this:

Looking to determine realized net, gross and commission.

I can get the order details from ProtoOAOrderListReq but determining realized P&L from this is tricky. It also does not contain commission.

I have looked over the proto messages in the docs a few times over but I didn't spot anything that would provide this information - did I miss it?

Thanks


@alshdavid
Replies

PanagiotisCharalampous
09 Dec 2024, 07:14

Hi there,

In order to get a closed position's p&l, you need to get the deals using ProtoOADealListReq. The ProtoOADeal.ProtoOAClosePositionDetail will provide you with the information of the closed position and from there you can calculate the P&L of each position.

Best regards,

Panagiotis


@PanagiotisCharalampous

eric876barlett
09 Dec 2024, 10:19 ( Updated at: 10 Dec 2024, 04:28 )

Hello,
can u pls provide detail more.
Best Regards
merry678
spotify stats com
 


@eric876barlett