Getting Error during Place the order

I replaced the new token. ID. still facing issue. All the values of the indicator are placed on the chart; when the conditions match for buy and sell, then the issue comes during placing the order. also facing issue in the Vwap indicator, which have not been a applied yet

from Zerodha_Tradehull import Tradehull
from rich import print
import talib
import pdb
import pandas_ta as ta
import pandas as pd
import pandas_ta as pta
import datetime

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

receiver_chat_id    = "5296353864"
bot_token           = "8066227339:AAFNiQXBTlZE1B378LDDzWoXpVv292XG-OQ"

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

Traded_watchlist = []

print("\nname\t\tRSI\tEMA\tSupertrend\t   Buy Conditions\t    Sell Conditions\t    Traded Watchlist")


for name in watchlist:

    print(name)

    chart = tsl.get_short_length_hist_data(name=name, exchange="NSE", interval="minute", oi=False)
    
    # pdb.set_trace()

    # Technical Indicators
    chart['RSI']    = talib.RSI(chart['close'], timeperiod=14)
    chart['EMA']    = talib.EMA(chart['close'], timeperiod=30)
    chart['ATR']    = talib.ATR(chart['high'], chart['low'], chart['close'], timeperiod=14)
   
    # Supertrend   
    indi            = ta.supertrend(chart['high'], chart['low'], chart['close'], 7, 3)
    chart           = pd.concat([chart, indi], axis=1, join='inner')

    # VWAP
    chart.set_index(pd.DatetimeIndex(chart['date']), inplace=True)
    chart['vwap'] = pta.vwap(chart['high'], chart['low'], chart['close'], chart['volume'])

    # Signal candles  
    # complete_candle = pd.Series(datetime.datetime.now()).dt.floor('1min')[0] - datetime.timedelta(minutes=1)
    # complete_candle = complete_candle.strftime("%Y-%m-%d %H:%M:%S+05:30")
    complete_candle = chart.iloc[-2]
    previous_candle = chart.iloc[-3]

    RSI             = complete_candle['RSI']
    EMA             = complete_candle['EMA']
    ATR             = complete_candle['ATR']
    supertrend      = complete_candle['SUPERTd_7_3.0']
    quantity        = int(10000/ complete_candle['close'])

# Stoploss using ATR
    stoploss_price = chart['close'].iloc[-1] - 1.5 * chart['ATR'].iloc[-1]


    # stoploss_level  = round(complete_candle['SUPERT_7_3.0'],1)

    # Buy and Sell Conditions
    bc1 = RSI > 60
    bc2 = supertrend > 0
    bc3 = complete_candle['close'] > previous_candle['close']
    bc4 = complete_candle['close'] > EMA
    bc5 = name not in Traded_watchlist

    sc1 = RSI < 40
    sc2 = supertrend < 0
    sc3 = complete_candle['close'] < previous_candle['close']
    sc4 = complete_candle['close'] < EMA
    sc5 = name not in Traded_watchlist

    print(f"{name:<12} {RSI:>6.1f} {EMA:>8.1f} {supertrend:>8}       {bc1} {bc2} {bc3} {bc4}       {sc1} {sc2} {sc3} {sc4}          {Traded_watchlist}")
    
# Place Orders
    if bc1 and bc2 and bc3 and bc4 and bc5:

        entry_order_id = tsl.place_order(variety='AMO', exchange='NSE', tradingsymbol=name, transaction_type='BUY', quantity=quantity, product="MIS", order_type="LIMIT", price=round(complete_candle['close'],1))
        stoploss_order_id = tsl.place_order(variety='AMO', exchange='NSE', tradingsymbol=name, transaction_type='SELL', quantity=quantity, product="MIS", order_type="SL-M", trigger_price=stoploss_price)
        Traded_watchlist.append(name)


    if sc1 and sc2 and sc3 and sc4 and sc5:
        entry_order_id = tsl.place_order(variety='AMO', exchange='NSE', tradingsymbol=name, transaction_type='SELL', quantity=quantity, product="MIS", order_type="LIMIT", price=round(complete_candle['close'],1))
        stoploss_order_id = tsl.place_order(variety='AMO', exchange='NSE', tradingsymbol=name, transaction_type='BUY', quantity=quantity, product="MIS", order_type="SL-M", trigger_price=stoploss_price)
        Traded_watchlist.append(name)

# Telegram Alert
        
        message = f"Trade executed for {name} with RSI: {RSI:.2f}, EMA: {EMA:.2f}, Supertrend: {supertrend:.2f}"
        tsl.send_telegram_alert(message=message, receiver_chat_id=receiver_chat_id, bot_token=bot_token)
    


Error—Here the condition match in Britannia stock; the order should be placed, also the Error in Vwap Indicator

Logging into zerodha
You have already loggged in for today
reading existing file all_instrument 2025-08-23.csv
you are connected to zerodha Tarun Sharma 

name            RSI     EMA     Supertrend         Buy Conditions           Sell Conditions         Traded Watchlist
ACC
[!] VWAP volume series is not datetime ordered. Results may not be as expected.
[!] VWAP price series is not datetime ordered. Results may not be as expected.
<string>:1: UserWarning: Converting to PeriodArray/Index representation will drop timezone information.
('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Traceback (most recent call last):
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 789, in urlopen
    response = self._make_request(
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 507, in getresponse
    httplib_response = super().getresponse()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse
    response.begin()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 667, in send
    resp = conn.urlopen(
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 843, in urlopen
    retries = retries.increment(
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 789, in urlopen
    response = self._make_request(
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 507, in getresponse
    httplib_response = super().getresponse()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse
    response.begin()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\Zerodha_Tradehull\Zerodha_Tradehull.py", line 206, in get_short_length_hist_data      
    instrument_token = self.kite.ltp(exchange+":"+name)[exchange+":"+name]['instrument_token']
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 611, in ltp
    return self._get("market.quote.ltp", params={"i": ins})
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 861, in _get
    return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 916, in _request
    raise e
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 904, in _request
    r = self.reqsession.request(method,
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Traceback (most recent call last):
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\__main__.py", line 71, in <module>        
    cli.main()
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 501, in main
    run()
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 351, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 310, in run_path
    return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 127, in _run_module_code
    _run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
  File "c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "d:\Trudehull_Algo Traning\Practice File\Test_file_23-08-2025-new.py", line 34, in <module>
    chart['RSI']    = talib.RSI(chart['close'], timeperiod=14)
TypeError: 'NoneType' object is not subscriptable
PS D:\Trudehull_Algo Traning\Practice File> ^C
PS D:\Trudehull_Algo Traning\Practice File>
PS D:\Trudehull_Algo Traning\Practice File>  d:; cd 'd:\Trudehull_Algo Traning\Practice File'; & 'c:\Users\HP\AppData\Local\Programs\Python\Python38\python.exe' 'c:\Users\HP\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher' '58163' '--' 'd:\Trudehull_Algo Traning\Practice File\Test_file_23-08-2025-new.py'
Logging into zerodha
You have already loggged in for today
reading existing file all_instrument 2025-08-23.csv
you are connected to zerodha Tarun Sharma
reading existing file all_instrument 2025-08-23.csv
reading existing file all_instrument 2025-08-23.csv
reading existing file all_instrument 2025-08-23.csv
you are connected to zerodha Tarun Sharma

name            RSI     EMA     Supertrend         Buy Conditions           Sell Conditions         Traded Watchlist
ACC
ACC            47.1   1821.4        1       False True False False       False False True True          []
ASIANPAINT
ASIANPAINT     40.3   2505.0       -1       False False True False       False True False True          []
BAJAJ-AUTO
BAJAJ-AUTO     59.8   8680.7       -1       False False True True       False True False False          []
BRITANNIA
BRITANNIA      67.4   5551.3        1       True True True True       False False False False          []
Traceback (most recent call last):
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\Zerodha_Tradehull\Zerodha_Tradehull.py", line 1260, in place_order
    order_id = self.kite.place_order(variety=variety, exchange=exchange, tradingsymbol=tradingsymbol, transaction_type=transaction_type, quantity=quantity, product=product, order_type=order_type, price=price, validity=validity, disclosed_quantity=disclosed_quantity, trigger_price=trigger_price, validity_ttl= validity_ttl,iceberg_legs = iceberg_legs, iceberg_quantity=iceberg_quantity, auction_number= auction_number, tag=tag)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 361, in place_order
    return self._post("order.place",
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 865, in _post
    return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
  File "c:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 937, in _request
    raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: Invalid `api_key` or `access_token`.

Hi @tarsharm20 ,

In the Zerodha file pdb is been present. Please comment by finding the location of the file in site packages. We will update our codebase soon and release new version.

Replace orderplacement code with the following:

entry_order_id = tsl.place_order(variety='amo', exchange='NSE', tradingsymbol=name, transaction_type='BUY', quantity=quantity, product="MIS", order_type="LIMIT", price=round(complete_candle['close'],1))

Order Types Supported are: "regular" , "amo" , "co" , "iceberg" , "auction"
Do refer the below link:
https://pypi.org/project/Zerodha-Tradehull/