Hello Everyone
@Tradehull_Imran
Sir, I am trying to get RSI of Index on 5 min time frame using the code but getting error
import pdb
from Dhan_Tradehull_V2 import Tradehull
import pandas as pd
import talib
import time
import datetime
Client details
client_code = “”
token_id = “”
Initialize Tradehull
tsl = Tradehull(client_code, token_id)
available_balance = tsl.get_balance()
leveraged_margin = available_balance5
max_trades = 2
per_trade_margin = (leveraged_margin/max_trades)
max_loss = (available_balance1)/100*-1
watchlist = [“NIFTY”,‘BANKNIFTY’,‘NIFTYIT’,‘NIFTYAUTO’,‘NIFTYFMCG’]
traded_wathclist =
for index_exchange in watchlist:
time.sleep(1)
chart_1 = tsl.get_historical_data(tradingsymbol = index_exchange,exchange = 'NSE',timeframe="1")
chart_5 = tsl.get_historical_data(tradingsymbol = index_exchange,exchange = 'NSE',timeframe="5") # this call has been updated to get_historical_data call,
chart_15 = tsl.get_historical_data(tradingsymbol = index_exchange,exchange = 'NSE',timeframe="15") # this call has been updated to get_historical_data call,
if (chart_1 is None) or (chart_5 is None) :
continue
if (chart_1.empty) or (chart_5.empty):
continue
if (chart_15.empty) or (chart_15.empty):
continue
if (chart_15 is None) or (chart_15 is None) :
continue
# Conditions that are on 1 minute timeframe
chart_5['rsi'] = talib.RSI(chart_5['close'], timeperiod=14) #pandas
cc_5 = chart_5.iloc[-1] #pandas completed candle of 5 min timeframe
print(stock_name, "RSI on 5 Min Time Frame is", cc_5['rsi'] )
The error is
Exception in Getting OHLC data as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-907’, ‘error_type’: ‘Data_Error’, ‘error_message’: ‘System is unable to fetch data due to incorrect parameters or no data present’}, ‘data’: {‘errorType’: ‘Data_Error’, ‘errorCode’: ‘DH-907’, ‘errorMessage’: ‘System is unable to fetch data due to incorrect parameters or no data present’}}
Where I am doing wrong , please help