0

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.

tompal18
  • 1,164
  • 2
  • 21
  • 39
  • What is your period (1m, 15m...)? How many do you use? Are those parameters the same than on the binance interface? Do you take opening or closing price of the time period? Also what is you equation to compute EMA? There are several "modes" to make it. – Synthase Jan 04 '21 at 03:00
  • https://github.com/sammchardy/python-binance/issues/240 – BENY Jan 04 '21 at 03:11

1 Answers1

1

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