1

I am trying to match the binance's daily price change. I know it does provide 24h price change in percentage but the value I calculate is off no matter what.

So I am asking binance API to give me candle data for 1 day/week/month respectively.

I have these values I am using: current price (P), open price (OP), close price (CP).

I tried these but the values do not match what binance is showing for the daily change so I know all other calculations are also wrong:

priceChangeInPercentage = 100*(P - OP)/P

How does binance calculate this value?

1 Answer 1

3

You need to change the denominator to Open Price (OP) because the 24hpercentage will be calculated on basis of OP not on the last traded price (P).

priceChangeInPercentage = 100*(P - OP)/OP
2
  • Dropping from $6,000 to $3,000 is not a 100% drop. :) Aug 16, 2021 at 5:27
  • Yes, it's not a 100% drop. OP=6000$ P=3000$ change%= 100*(3000-6000)/6000 = -50% Aug 16, 2021 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.