'NoneType' object is not subscriptable


  • {'message': 'Failed to get symbol details', 'errorcode': 'AB1018', 'status': False, 'data': None}

    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 = 0

    if 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
    

    Please Note That I am Able to Fetch My Profile using Smartapi Object That also Means That smartApi Object is Properly Defined.