I am newbie on financial analysis and I am trying to apply my programming skills on this field so I am using Ta-Lib python library to get cryptocoins rading indicators. I started by the RSI indicator but I didn’t understand why I am getting different data than binance.
This is my code:
from binance import Client
import talib
import numpy
import matplotlib.pyplot as plt
api_key = "my_api_key"
api_secret = "my_api_secret"
client = Client(api_key=api_key, api_secret=api_secret,tld="us")
symbol = "BTCUSDT"
# Fetch historical klines (candlestick data)
klines = client.get_historical_klines(symbol, Client.KLINE_INTERVAL_1HOUR, "1 day ago UTC")
# Extract closing prices from klines
closing_prices = [float(entry[4]) for entry in klines]
# Calculate 14-period RSI
rsi_14 = talib.RSI(numpy.array(closing_prices), timeperiod=14)
print(rsi_14)
rsi_14_noNAN = rsi_14[numpy.where(rsi_14>0)]
print(rsi_14_noNAN)
When I execute this code and I check the RSIs given to me I found all the values are different then the showed on 1h binance RSI(14). Can anyone explain to me why and what’s the difference.