'NoneType' object is not subscriptable
-
When I Try to Find ATM of BANKNIFTY Using Below Code I am getting above Error.(I am trying and getting This Error Since Last 2 Weeks.)
def GetATM(smartApi,name):
TokenOfName = 0if name == "BANKNIFTY": TokenOfName = 26009 if name == "NIFTY": TokenOfName = 26000 print(smartApi.ltpData("NSE", name, TokenOfName)) indexLTP = smartApi.ltpData('NSE', name, TokenOfName)['data']['ltp'] if name == "BANKNIFTY": Rem = indexLTP - (int(indexLTP / 100) * 100) if Rem > 50: ATMStrike = (math.ceil(indexLTP / 100)) * 100 else: ATMStrike = (math.floor(indexLTP / 100)) * 100 elif name == "NIFTY": Rem = indexLTP - (int(indexLTP / 50) * 50) if Rem > 25: ATMStrike = (math.ceil(indexLTP / 50)) * 50 else: ATMStrike = (math.floor(indexLTP / 50)) * 50 print(indexLTP, " ", ATMStrike) return ATMStrike
@admin @Moderator_1 @Moderator_2
Please Note That I am Able to Fetch My Profile using Smartapi Object That also Means That smartApi Object is Properly Defined. -
Apologies for delayed response.
We have fixed the NoneType issue on recent SDK. Kindly reverify with the recent SDK and let us know if the issue still exists.Thanks & Regards,
SmartAPI team