@Tradehull_Imran Hi Imran Sir, if you could jot down a few algo steps for selling basis of your expertise in the market and knowledge of the algo setup you taught us, it will be really helpful. e.g. something similar to the steps you had jotted during creation of the Mini RoboCop script, it was really helpful. I can then try to convert these into .py code at my end. Thanks!
The error message ModuleNotFoundError: No module named ‘sqn_lib’ indicates that Python cannot find a module named sqn_lib.
Here are some steps you can take to resolve this issue:
Install the Module: If sqn_lib is a third-party library.
I am not able to fetch any data from Dhan API.
example code
import pdb
import time
import datetime
import traceback
from Dhan_Tradehull_V2 import Tradehull
import pandas as pd
from pprint import pprint
import talib
sqn_lib is not a Python library; it’s a file provided by Imran Ali. Copy these codes and save a.py file at the same location as your main code, then import sqn.
# -------------------------------------------------------------------------------------------
# sqn_lib Function
# -------------------------------------------------------------------------------------------
def market_type(num):
if num > 1.47:
return "very_bullish"
if 0.75 < num < 1.46:
return "bullish"
if 0 < num < 0.74:
return "neutral"
if -0.7 < num < 0:
return "bearish"
if num <= -0.7:
return "very_bearish"
def sqn(df, period):
df['pnl_sqn'] = ((df['close'] - df['open']) / df['open'])*100
df['average_pnl'] = df['pnl_sqn'].rolling(period).mean()
df['average_std'] = df['pnl_sqn'].rolling(period).std()
name = 'sqn'
df[name] = (math.sqrt(period)*df['average_pnl'])/df['average_std']
df = df.drop(columns=['pnl_sqn', 'average_pnl', 'average_std'], inplace=True)
return df
I GUESS THE INTRADAY DATA FETCHING FUNCTION DOES NOT WORK, IF IT DOES NOT THEN WHY IS IT EVEN THERE IN THE FIRST PLACE??? I KNOW GET HISTORICAL DATA WORKS BUT WHY NOT THIS??
try:
intraday_response = client.intraday_minute_data(
security_id="13",
exchange_segment="I",
instrument_type="INDEX",
from_date="2025-03-13",
to_date="2025-03-13",
interval=1
)
if intraday_response.get("status") == "success":
data = intraday_response.get("data", [])
print("\nIntraday Minute Data:")
for entry in data:
print(entry)
else:
print("\nIntraday Minute Data Error:")
print(intraday_response)
except Exception as e:
print("Error fetching intraday minute data:", e)
REPONSE
Intraday Minute Data Error:
{'status': 'failure', 'remarks': {'error_code': 'DH-905', 'error_type': 'Input_Exception', 'error_message': 'Missing required fields, bad values for parameters etc.'}, 'data': {'errorType': 'Input_Exception', 'errorCode': 'DH-905', 'errorMessage': 'Missing required fields, bad values for parameters etc.'}}