Position average price


I have a position in 10000 usdt and the price went down to 8000, I make another buy and obviously the exchange makes an average, for example, the price of the position that before was 10000 is now 8650.

The thing gets complicated when you have leverage and margin type: Isolated or cross.

How can the average price be calculated with the new buy?. , Exist some formula?-

In addition, the scenario can also occur with sales. I am in Binance Futures.


Could you specify which average you are mentioning? Is this average obtained from the API? If so, could you provide the url and a sample response (omitting any sensitive information)?

I get everything I need from API (fapiPrivateGetPositionRisk), price ticker…

My idea is that if I have a buy position at 10000 usdt, then the price drops to 8000, ie the market went in the opposite direction . What I am I want to bring my current position closer to the price, for this I make a new buy and for example, depending on the amount, the purchase could average the price of the position at 9500 …

This average is always going to vary, depending on the amount of the trade, the type of margin and the leverage.

That is why I would like to know if there is a way to make this calculation using some formula…