tompal18
tompal18

Reputation: 1216

exponential moving average(ema) differs from binance

I am calculating ema with python on binance (BTC Futures) monthly open price data(20/12~21/01).

ema2 gives 25872.82333 on the second month like below.

df = pd.Series([19722.09, 28948.19])
ema2 = df.ewm(span=2,adjust=False).mean()
ema2


0    19722.090000
1    25872.823333

But in binance, ema(2) gives difference value(25108.05) like in the picture.

https://www.binance.com/en/futures/BTCUSDT_perpetual

enter image description here

Any help would be appreciated.

Upvotes: 0

Views: 2251

Answers (1)

Chefsichter
Chefsichter

Reputation: 21

I had a the same problem, that the calculated EMA (df.ewm...) from pandas wasn't the same as the one from binance. You have to use a longer series. First i used 25 candlestick data, then changed to 500. When you query binance, query a lot of date, because the mathematical calculation of the EMA is from the beginning of the series.

best regards

Upvotes: 2

Related Questions