How to get the positionId in Python? OpenApi

Created at 28 Sep 2022, 11:05
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!
JY

jyri.gromyko2002

Joined 18.09.2022

How to get the positionId in Python? OpenApi
28 Sep 2022, 11:05


I need to close positions, but it requires ids. I can't understand, how to get it while opening the position. The support also doesn't know.


@jyri.gromyko2002
Replies

PanagiotisCharalampous
28 Sep 2022, 11:12

Hi there,

The support also doesn't know.

This is a bit inaccurate :) I have explained to you in our email conversation that you can get the position Id by reading the ProtoOAExecutionEventProtoOAExecutionEvent contains a ProtoOAPosition which has positionId as a property. If you need an Open API Python example on how to send and read Open API protobuf messages, you can find one here. Unfortunately, I am not a Python developer therefore I cannot write the exact code for you.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous