backtesting error


  • runcell(0, 'C:/Users/kswat/Downloads/orb_bktst (2).py')
    [I 240602 12:05:02 smartConnect:121] in pool
    [E 240602 12:05:10 smartConnect:218] Error occurred while making a POST request to https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword. Headers: {'Content-type': 'application/json', 'X-ClientLocalIP': '127.0.0.1', 'X-ClientPublicIP': '106.193.147.98', 'X-MACAddress': 'a9:31:1f:9d:a7:f3', 'Accept': 'application/json', 'X-PrivateKey': 'te2Wr9fI', 'X-UserType': 'USER', 'X-SourceID': 'WEB'}, Request: {'clientcode': 'S59335806', 'password': '1904', 'totp': '698173'}, Response: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)
    Traceback (most recent call last):

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:467 in _make_request
    self._validate_conn(conn)

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:1092 in _validate_conn
    conn.connect()

    File ~\anaconda3\Lib\site-packages\urllib3\connection.py:635 in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(

    File ~\anaconda3\Lib\site-packages\urllib3\connection.py:776 in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(

    File ~\anaconda3\Lib\site-packages\urllib3\util\ssl_.py:466 in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)

    File ~\anaconda3\Lib\site-packages\urllib3\util\ssl_.py:510 in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)

    File ~\anaconda3\Lib\ssl.py:517 in wrap_socket
    return self.sslsocket_class._create(

    File ~\anaconda3\Lib\ssl.py:1108 in _create
    self.do_handshake()

    File ~\anaconda3\Lib\ssl.py:1383 in do_handshake
    self._sslobj.do_handshake()

    TimeoutError: _ssl.c:989: The handshake operation timed out

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):

    File ~\anaconda3\Lib\site-packages\requests\adapters.py:486 in send
    resp = conn.urlopen(

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:844 in urlopen
    retries = retries.increment(

    File ~\anaconda3\Lib\site-packages\urllib3\util\retry.py:470 in increment
    raise reraise(type(error), error, _stacktrace)

    File ~\anaconda3\Lib\site-packages\urllib3\util\util.py:39 in reraise
    raise value

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:790 in urlopen
    response = self._make_request(

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:491 in _make_request
    raise new_e

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:469 in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)

    File ~\anaconda3\Lib\site-packages\urllib3\connectionpool.py:370 in _raise_timeout
    raise ReadTimeoutError(

    ReadTimeoutError: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

    File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

    File c:\users\kswat\downloads\orb_bktst (2).py:16
    data = obj.generateSession(key_secret[2],key_secret[3],TOTP(key_secret[4]).now())

    File ~\anaconda3\Lib\site-packages\SmartApi\smartConnect.py:268 in generateSession
    loginResultObject=self._postRequest("api.login",params)

    File ~\anaconda3\Lib\site-packages\SmartApi\smartConnect.py:260 in _postRequest
    return self._request(route, "POST", params)

    File ~\anaconda3\Lib\site-packages\SmartApi\smartConnect.py:219 in _request
    raise e

    File ~\anaconda3\Lib\site-packages\SmartApi\smartConnect.py:207 in _request
    r = requests.request(method,

    File ~\anaconda3\Lib\site-packages\requests\api.py:59 in request
    return session.request(method=method, url=url, **kwargs)

    File ~\anaconda3\Lib\site-packages\requests\sessions.py:589 in request
    resp = self.send(prep, **send_kwargs)

    File ~\anaconda3\Lib\site-packages\requests\sessions.py:703 in send
    r = adapter.send(request, **kwargs)

    File ~\anaconda3\Lib\site-packages\requests\adapters.py:532 in send
    raise ReadTimeout(e, request=request)

    ReadTimeout: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)


  • Hello @swathi-priya

    Kindly update your TLS version once then please check the same

    Regards,
    SmartAPI Team