API returning NULL but order is placed and executed successfully


  • Hi @admin ,

    Today I placed an order in nifty and got a None response back. But order is placed and executed successfully.

    My Script Logs:
    2021-08-02 15:21:00 : INFO : [Angel:384] : Taking position for {'instrument_name': 'NIFTY05AUG2116150CE', 'transactiontype': 'SELL', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD'}
    2021-08-02 15:21:05 : CRITICAL : [Angel:425] : Failed to take position for {'instrument_name': 'NIFTY05AUG2116150CE', 'transactiontype': 'SELL', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD'}
    2021-08-02 15:21:05 : ERROR : [Angel:427] : Traceback (most recent call last):
    File "/root/AlgoTrading/BTST/Angel.py", line 420, in take_position
    orderId = self.angel_obj.placeOrder(orderparams)
    File "/usr/local/lib/python3.6/site-packages/smartapi/smartConnect.py", line 290, in placeOrder
    orderResponse= self._postRequest("api.order.place", params)['data']['orderid']
    TypeError: 'NoneType' object is not subscriptable

    .
    OrderBook:
    6552915a-de65-4041-984f-6de115e13934-image.png

    Since, its a NULL response.. my script thought it is some failed order and kept on placing orders(3 orders placed instead of 1).
    This is far more dangerous than order placing fail.

    @admin , Kindly look into this issue. Provide some insights!


  • @admin OK Thanks. But this is another kind of error. Kindly check this also.


  • HI @lakshmi_73 Our team is already working on this.


  • @admin , Again same kind of error but this is time out.

    My script Logs:
    2021-08-04 09:16:00 : INFO : [Angel:232] : Fetched ltp vaue for NIFTY05AUG2116400CE = 15.05
    2021-08-04 09:16:00 : INFO : [Straddle:254] : CE SL hit
    2021-08-04 09:16:00 : INFO : [Straddle:308] : Exiting all open positions
    2021-08-04 09:16:00 : INFO : [Angel:384] : Taking position for {'instrument_name': 'NIFTY05AUG2116400CE', 'transactiontype': 'BUY', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD'}
    2021-08-04 09:16:07 : CRITICAL : [Angel:425] : Failed to take position for {'instrument_name': 'NIFTY05AUG2116400CE', 'transactiontype': 'BUY', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD'}
    2021-08-04 09:16:07 : ERROR : [Angel:427] : Traceback (most recent call last):
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
    File "<string>", line 3, in raise_from
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
    File "/usr/lib64/python3.6/http/client.py", line 1361, in getresponse
    response.begin()
    File "/usr/lib64/python3.6/http/client.py", line 311, in begin
    version, status, reason = self._read_status()
    File "/usr/lib64/python3.6/http/client.py", line 272, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    File "/usr/lib64/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
    File "/usr/lib64/python3.6/ssl.py", line 971, in recv_into
    return self.read(nbytes, buffer)
    File "/usr/lib64/python3.6/ssl.py", line 833, in read
    return self._sslobj.read(len, buffer)
    File "/usr/lib64/python3.6/ssl.py", line 590, in read
    v = self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out

    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 756, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
    File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
    chunked=chunked,
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
    File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 337, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
    urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)

    OrderBook:
    c28f58a7-97c2-4551-861a-6d9f2f5e365b-image.png
    018aaef1-dc81-47de-896b-20a8200a66ab-image.png

    Kindly check and update.


  • @admin Thank you. Please update soon.


  • HI @lakshmi_73 we are working on this update you soon.


  • @admin P342922


  • HI @lakshmi_73 Please post your client id here. we will review it and update you.