Hi,
Can someone please look into this and help identify the issue?
I am using Codebase Version 2.1
The get_historical_data()
function is not fetching the correct OHLC and EMA values.
When I cross-check the data, it appears to be picking data from the previous day instead of the current one.
This issue occurred when I fetched the data on Thursday, 08-May-2025 at 19:37 PM.
@RahulDeshpande @Tradehull_Imran
Any help would be appreciated!
@Tradehull_Imran Can you please help with this concern?
I am using Codebase Version 2.1
While cross-checking in the live market on Friday, 09-May-2025 at 10:40 AM, I noticed that the OHLC and EMA values being fetched are from Wednesday, 07-May-2025, i.e., two days prior.
Please note that I am fetching data specifically for NFO (NSE Futures & Options) instruments.
Could you kindly look into this and help identify the reason for this outdated data?
Thank you. @Tradehull_Imran
Good Afternoon Sir, I have tried to convert the ‘Tick by Tick Data’ file to get Bank Nifty data. But error is encountered sir. Can you please correct the code for any errors sir.
`import pdb
import time
import datetime
import traceback
from Dhan_Tradehull import Tradehull
import pandas as pd
from pprint import pprint
import talib
import pandas_ta as ta
import xlwings as xw
import winsound
client_code = “---------------”
token_id = “---------------”
tsl = Tradehull(client_code,token_id)
watchlist = [‘BANKNIFTY’]
wb = xw.Book(‘Bank Nifty Live Trade Data.xlsx’)
data_storage = wb.sheets[‘Data Storage’]
bot_token = “-----------”
receiver_chat_id = “----------------”
ce_strike, pe_strike, strike = tsl.ATM_Strike_Selection(Underlying=‘BANKNIFTY’, Expiry=0)
all_strike = [strike + number*50 for number in range(-20, 20)]
all_ce_names = [“BANKNIFTY 27 MAY " + str(strike) + " CALL” for strike in all_strike]
all_pe_names = [“BANKNIFTY 27 MAY " + str(strike) + " PUT” for strike in all_strike]
equity_names = [“ACC”, “CIPLA”, “GAIL”, “NIFTY”]
all_names = all_ce_names + all_pe_names + equity_names
data_storage.range(‘B1’).value = all_names
for row_no in range(2, 1000000):
try:
current_time = datetime.datetime.now()
print(current_time)
if current_time.second % 5 == 0:
tsl.send_telegram_alert(message=f"{current_time} data storage is working fine ",receiver_chat_id=receiver_chat_id,bot_token=bot_token)
all_ltp = tsl.get_ltp_data(names = all_names)
temp_dict = {}
temp_dict[current_time] = all_ltp
temp_dict = pd.DataFrame(temp_dict)
ltp_sequence = temp_dict.T[all_names].iloc[0].to_list()
data_storage.range('B' + str(row_no)).value = ltp_sequence
data_storage.range('A' + str(row_no)).value = str(current_time)
except Exception as e:
print(e)
tsl.send_telegram_alert(message="error in storing data",receiver_chat_id=receiver_chat_id,bot_token=bot_token)
continue`
Hi Imran sir and Dhan team, As per my strategy i have to lookback 100 candles to take trade as its a data API i subscribed but the system said that i will only fetch 50 candles instead of 100 candles at 15 min time frame but its running gud at 5 min time frame . why? even yfinace is also giving the same data free of cost by only 15 min delay i think why is the capping to fetch historical data when i am buying data api only for Historical data. if im wrong pls correct me. Thanks
Vikas Chaudhary
I am facing a problem with the websocket.xlsx file although I have that file downloaded with the codebase folder but when I am running the code it is showing file not found, and also when I am pasting or typing available_balance = tsl.get_balance(), then I am getting just (pdb++) not my available balance.
no need to use websocket anymore imran sir has given file for updated codebase. download that folder containing tradehulll v2
@Siddhesh_Amrute Update the settings given in the algo, folder and excel
index_name = 'NIFTY'
no_strikes_to_replay = 20
expiry_date = "22 MAY"
start_time ='2025-05-21 09:15:00+05:30'
and remove pdb.set_trace() from code
Very good morning sir, May I know the reason for your silence sir.
VBR Prasad
Hello @Tradehull_Imran Sir, Thank you for sharing such a wonderful training course. I never thought that I will be able to do Algo trading, but by following your tutorials step by step, I am moving forward bit by bit.
I am now working on trailing the order. Able to modify the target order but with SL order, getting the following errors:
Got exception in modify_order as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-906’, ‘error_type’: ‘Order_Error’, ‘error_message’: ‘Missing required fields, bad values for parameters etc.’}, ‘data’: {‘errorType’: ‘Order_Error’, ‘errorCode’: ‘DH-906’, ‘errorMessage’: ‘Missing required fields, bad values for parameters etc.’}}
I did a lot of hit and try but still getting the same error. Following is the detail of my order. Please let me know if more details are needed. Thanks
DCBBANK
Order Type: Market, SLMarket, Limit
Purchase price: 141.73
SL: 141.32
Target: 142.32
Need to modify SL: 141.52
modified_order = tsl.modify_order(order_id=3125061724291,order_type=“STOPLIMIT”,quantity=1,price=141.45, trigger_price=141.55)
u can use chat gpt ask something which ai is not giving as it will save imran sir time
ce_name, pe_name, ce_strike, pe_strike = tsl.ITM_Strike_Selection(tradingsymbol, expiry, ITM_count=1)
ce_name, pe_name, strike = tsl.ATM_Strike_Selection(tradingsymbol, expiry)
ce_name, pe_name, ce_strike, pe_strike = tsl.OTM_Strike_Selection(tradingsymbol, expiry, OTM_count=1)
ce_name, pe_name, ce_strike, pe_strike = tsl.OTM_Strike_Selection(tradingsymbol, expiry, OTM_count=2)
I am getting finnifty CE and PE for Nifty index. Sometimes it is giving correct results but sometimes wrong. Friday also this error persisted and today also I am getting the error.
Please solve the issue. Previously on 25th Feb, 2025 the same wrong result was coming, and later it was solved. But now it is again coming.
Please note: This error is coming intermittently, like it will come for sometimes, and then every think is ok, then after some time it will start again.
Thank you