How to know the Position Ticket/Id in Hedge Mode

Hi,

I make robots for forex and I’m creating my first Binance robot in Hedge Mode and I have a question that seems simple but I couldn’t really find any answers in the documentation. I need to know the identifier of an open position, an id or ticket that gives me the exact position I want information from. Is this possible in the Binance Future API?

Thanks in advance for your help.

Hi.
You can query this endpoint to know your current open positions. https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
It does not have a specific id field as identifier since it may result from multiple orders you created before. You may want to use a composite of several attributes (e.g. symbol and positionSide) as an identifier to differentiate them.

Thanks ishuen, the problem is that the response from this endpoint doesn’t have a timestamp or something that really identifies a specific position, and I use gradient techniques where I use the same volume, amount etc. So it would be quite difficult to use this endpoint. The only solution I see is to manage the position ids locally using a cache.

The concept used in positions is not the same as the one I use in Forex and that left me a little confused. If I open 2 orders for the same symbol with different entry prices and different volumes it will create a position with the average price and the sum of the volumes. My question is, if you want to reduce a position, in the case of the smaller volume and which has a lower price, it would just send an opposite positionSide, but what value would it use to reach the profit?

Hi. Please take a look at this guide, this can be helpful for you, especially the following topics:

Thank you, I will do that.