Tsl.get_atm obj not callable

from Zerodha_Tradehull import Tradehull 
from rich import print
import talib
import pandas as pd
import datetime

api_key = " "
api_secret = " "
tsl = Tradehull(api_key, api_secret, "yes")
kite = tsl.kite

watchlist = ['ACC', 'ASIANPAINT', 'BAJAJ-AUTO',  'BRITANNIA', 'CIPLA', 'COALINDIA', 'COLPAL', 'DABUR', 'DRREDDY', 'HCLTECH', 'HDFCBANK', 'HEROMOTOCO']
traded_watchlist = []



status    = {'options_name':None, 'date':None, 'entry_time':None, 'entry_price':None, 'buy_sell':None, 'qty' : None , 'sl': None, 'tg': None, 'exit_time': None, 'exit_price': None, 'pnl': None, 'remark': None, 'traded': None, 'entry_orderid': None, 'sl_orderid':None, 'entry_time':None, 'selling_price': None, 'hedge_name':None}
orderbook = {}



for name in watchlist:
    orderbook[name] = status.copy()











while True:
    for name in watchlist:
          
        current_dt = datetime.datetime.now()


        print(name)  
        chart = tsl.get_short_term_hist_data(name=name, exchange="NSE", interval="minute", oi = True)
        chart['rsi'] = talib.RSI(chart['close'], timeperiod=14)


        comp_candle  = chart.iloc[-2]






        bc1 = comp_candle['rsi'] > 70
        bc2 = name not in traded_watchlist
        bc3 = len(traded_watchlist) <= 2
        
        
        sc1 = comp_candle['rsi'] < 30
        sc2 = name not in traded_watchlist
        sc3 = len(traded_watchlist) <= 2


        if bc1 and bc2 and bc3:
            print(name, "is oversold")
            entry_price = comp_candle['close']
            sl_price    = round(comp_candle['close']*0.99, 1)
            quantity    = int(100000/entry_price)

            entry_id    = tsl.place_order(variety="amo", exchange='NSE', tradingsymbol=name, transaction_type='BUY', quantity=1, product="MIS", order_type="MARKET")
            stoploss_id = tsl.place_order(variety="amo", exchange='NSE', tradingsymbol=name, transaction_type='SELL', quantity=1, product="MIS", order_type="SL-M", trigger_price = sl_price)
            traded_watchlist.append(name)

        if sc1 and sc2 and sc3:
            print(name, "is overbought")
            entry_price = comp_candle['close']
            sl_price    = round(comp_candle['close']*1.01, 1)
            quantity    = int(100000/entry_price)

            atm_name = tsl.get_atm(underlying=name, exchange='NSE', expiry=0, script_type="CE")
            lot_size = tsl.get_lot_size(atm_name)

            entry_id    = tsl.place_order(variety="amo", exchange='NSE', tradingsymbol=name, transaction_type='SELL', quantity=1, product="MIS", order_type="MARKET")
            stoploss_id = tsl.place_order(variety="amo", exchange='NSE', tradingsymbol=name, transaction_type='BUY', quantity=1, product="MIS", order_type="SL-M", trigger_price = sl_price)
            traded_watchlist.append(name)

            entry_price == execute price





orderbook[name]['options_name'] = atm_name
orderbook[name]['date'] = current_dt.date()
orderbook[name]['entry_time'] = current_dt.time()
orderbook[name]['entry_price'] =
orderbook[name]['buy_sell'] = 'sell'
orderbook[name]['qty'] = quantity
orderbook[name]['sl'] =
orderbook[name]['tg'] =
orderbook[name]['exit_time'] =
orderbook[name]['exit_price'] =
orderbook[name]['pnl'] =
orderbook[name]['remark'] =
orderbook[name]['traded'] =
orderbook[name]['entry_orderid'] =
orderbook[name]['sl_orderid'] =
orderbook[name]['selling_price'] =
orderbook[name]['hedge_name'] =








orderbook = {

    'ACC'     : {'script_name' :'ACC', 'transection_type'    : 'BUY', 'price' : None, 'status' : None, 'entry_time' : None, 'exit_time' : None, 'exit_price' : None, 'remark' : None, 'traded' : None, 'orderid' :None },
  
    'CIPLA'   : {'script_name' :'CIPLA' , 'transection_type' : 'BUY', 'price' : None, 'status' : None, 'entry_time' : None, 'exit_time' : None, 'exit_price' : None, 'remark' : None, 'traded' : None, 'orderid' :None},
    'GAIL'    : {'script_name' :'GAIL' , 'transection_type'  : 'BUY', 'price' : None, 'status' : None, 'entry_time' : None, 'exit_time' : None, 'exit_price' : None, 'remark' : None, 'traded' : None, 'orderid' :None },
    'TCS'     : {'script_name' :'TCS'  , 'transection_type'  : 'BUY', 'price' : None, 'status' : None, 'entry_time' : None, 'exit_time' : None, 'exit_price' : None, 'remark' : None, 'traded' : None, 'orderid' :None},
    'WIPRO'   : {'script_name' :'WIPRO', 'transection_type'  : 'BUY', 'price' : None, 'status' : None, 'entry_time' : None, 'exit_time' : None, 'exit_price' : None, 'remark' : None, 'traded' : None, 'orderid' :None},
  
}

print(orderbook)



orderbook = {
    'ACC': {
        'leg1': {'script_name': 'ACC1600CE', 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg2': {'script_name': 'ACC1600PE', 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg3': {'script_name': 'ACC1800CE', 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg4': {'script_name': 'ACC1400PE', 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None}
    },

    'CIPLA': {
               'leg1': {'script_name': None, 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg2': {'script_name': None, 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg3': {'script_name': None, 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None},
        'leg4': {'script_name': None, 'transaction_type': None, 'quantity': None, 'price': None,'status': None, 'entry_time': None, 'exit_time': None, 'exit_price': None,'remark': None, 'traded': None, 'orderid': None}
    },
}
























    'entry_orderid': None,
    'sl_orderid': None,
    'selling_price': None,
    'hedge_name': None
}
 current_dt = datetime.datetime.now()
comp_candle['close']
1892.1
   atm_name = tsl.get_atm(underlying=name, exchange='NSE', expiry=0, script_type="CE")
Unknown underlying name
Traceback (most recent call last):
  File "c:\Users\shubh\AppData\Local\Programs\Python\Python38\lib\site-packages\Zerodha_Tradehull\Zerodha_Tradehull.py", line 485, in get_atm
    raise TypeError('Unknown underlying name')
TypeError: Unknown underlying name
   tsl.get_atm = tsl.get_atm(underlying=name, exchange='NSE', expiry=0, script_type="CE")
Unknown underlying name
Traceback (most recent call last):
  File "c:\Users\shubh\AppData\Local\Programs\Python\Python38\lib\site-packages\Zerodha_Tradehull\Zerodha_Tradehull.py", line 485, in get_atm
    raise TypeError('Unknown underlying name')
TypeError: Unknown underlying name
tsl.get_atm(underlying=name, exchange='NSE', expiry=0, script_type="CE")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not callable
   atm_name = tsl.get_atm(underlying=name, exchange='NSE', expiry=0, script_type="CE")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not callable
print(tsl.get_atm)
None
print(type(tsl.get_atm))
<class 'NoneType'>
tsl.get_atm(underlying=name, exchange = 'NSE', expiry=0, script_type='CE')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not callable

Hi @7350982949 ,

ACC stock does not have its options. get_atm() function will return only for the strikes it has options.