Binance.Net icon indicating copy to clipboard operation
Binance.Net copied to clipboard

Is there a way to get the average price of a token bought from the API

Open orionflame opened this issue 1 year ago • 2 comments

Hi,

With all the new changes since the last time I used this API, did Binance add any new functions to get the average price of a token bought by the user?

So if you bought 1 BTC at $100 and another one at $200, then the average price of your token, i.e. the unit price would be $150. From this you can calculate the PNL.

Or do they have a way to get the PNL for each token?

Thanks a lot in advance.

orionflame avatar Dec 30 '23 15:12 orionflame

Get the last 100 orders and calculate it

XHighIntell avatar Dec 31 '23 04:12 XHighIntell

Formula is: total token2 / total token1 = avg price eg: for ethbtc, total BTC traded / total ETH traded , and you get average price. You can confirm it in Binance position history, it should be exactly the same average price than the result of the formula

deivid1 avatar Dec 31 '23 21:12 deivid1