Sungod3k
Sungod3k

Reputation: 73

talib computed rsi and exchange rsi look very different

I found some mentions of similar issues but nothing concrete, since im new to data science with python its probably a mistake on my side.

I also tried reversing the the input data but both plots seem way to different to look similar to what the exchange is showing.

All ideas apreciated Cheers

Pic:tradingview.com vs talib RSI

import json
import coinbase
import numpy as np
import requests as req

price_hist = req.get("https://api.pro.coinbase.com/products/BTC-EUR/candles?granularity=3600")# [ time, low, high, open, close, volume ],
data = json.loads(price_hist.content.decode('utf-8')) 
candles = np.array(data)

close_data = candles[:,4]
close_data_rev = np.flip(candles[:,4], 0)

rsi_graph = ta.RSI(close_data, timeperiod=14)
rsi_graph_rev = ta.RSI(close_data_rev, timeperiod=14)

plt.plot(x_data, rsi_graph)
plt.plot(x_data, rsi_graph_rev)
plt.xticks(rotation=45)
fig_size[0] = 12
fig_size[1] = 9
plt.show()

Upvotes: 2

Views: 2572

Answers (1)

Sungod3k
Sungod3k

Reputation: 73

Figured it out. The flip command didnt work as intented. Flipped the array now with close_data_rev = close_data_rev [::-1] and that makes the rsi look like on the exchanges.

Upvotes: 1

Related Questions