Issue while placing order and unauthorized order in my account.


  • Hey @admin
    My code fired market orders to two clients "R" and "H" @ 14:20:00. But looks like it didn't receive an order id as response to order call.
    So it retried ordering for both clients again @ 14:21:00. This time order went through for client "R", but not for client "H".
    Below is my output screen while it happened.

    FUT-NSE-NIFTY-29APR21, 2021-04-15 14:20:00, 14543.35, 14558.45, 14543.35, 14558.4, 30525.0, 0, 14496.47, 14560.25, 14562.45, 14561.35, 2.2, 2021-04-15 14:20:07.295
    OPT-NSE-NIFTY-15APR21-14600-CE, 2021-04-15 14:20:00, 4.8, 5.8, 4.8, 5.65, 468600.0, 0, 9.19, 6.15, 6.2, 6.2, 0.05, 2021-04-15 14:20:07.295
    OPT-NSE-NIFTY-15APR21-14600-PE, 2021-04-15 14:20:00, 92.7, 92.7, 79.4, 79.4, 91725.0, 75, 134.95, 78.6, 79.15, 78.9, 0.55, 2021-04-15 14:20:07.295
    ***** STORE NOTIF: H While getting order id
    ***** STORE NOTIF: H 'NoneType' object is not subscriptable
    ***** STORE NOTIF: R While getting order id
    ***** STORE NOTIF: R 'NoneType' object is not subscriptable
    2021-04-15T14:20:00, Order Canceled/Margin/Rejected
    2021-04-15T14:21:00, FUT close the sell: BUY CREATE, 14557.05
    2021-04-15T14:21:00, CE close the sell: BUY CREATE, 5.15
    2021-04-15T14:21:00, PE close the buy: SELL CREATE, 83.40
    CURRENT PNL : -5865.0
    FUT-NSE-NIFTY-29APR21, 2021-04-15 14:21:00, 14557.95, 14563.45, 14554.5, 14557.05, 34275.0, 0, 14496.63, 14555.2, 14555.95, 14555.6, 0.75, 2021-04-15 14:21:06.868
    OPT-NSE-NIFTY-15APR21-14600-CE, 2021-04-15 14:21:00, 5.95, 6.5, 5.0, 5.15, 640800.0, 0, 9.17, 5.05, 5.1, 5.05, 0.05, 2021-04-15 14:21:06.868
    OPT-NSE-NIFTY-15APR21-14600-PE, 2021-04-15 14:21:00, 79.5, 83.6, 77.85, 83.4, 144450.0, 75, 134.65, 83.75, 84.3, 84.0, 0.55, 2021-04-15 14:21:06.868
    ***** STORE NOTIF: R Time Before order :  2021-04-15 14:21:00.462
    ***** STORE NOTIF: R Time After order :  2021-04-15 14:21:00.602
    ***** STORE NOTIF: R It took  140  milliseconds
    ***** STORE NOTIF: R Order Submitted
    ***** STORE NOTIF: R SELL EXECUTED QTY 150
    ***** STORE NOTIF: H While getting order id
    ***** STORE NOTIF: H 'NoneType' object is not subscriptable
    2021-04-15T14:21:00, Order Canceled/Margin/Rejected
    CURRENT PNL : -5400.0
    FUT-NSE-NIFTY-29APR21, 2021-04-15 14:22:00, 14556.95, 14556.95, 14545.3, 14553.4, 30900.0, 0, 14496.75, 14548.65, 14550.75, 14549.7, 2.1, 2021-04-15 14:22:01.582
    OPT-NSE-NIFTY-15APR21-14600-CE, 2021-04-15 14:22:00, 5.15, 5.3, 4.0, 4.2, 732300.0, 0, 9.14, 4.15, 4.25, 4.2, 0.1, 2021-04-15 14:22:01.582
    OPT-NSE-NIFTY-15APR21-14600-PE, 2021-04-15 14:22:00, 82.05, 91.05, 82.05, 89.6, 119325.0, 75, 134.39, 89.45, 89.9, 89.7, 0.45, 2021-04-15 14:22:01.582
    
    Process finished with exit code -1
    

    So I killed the script and manually squared off the position for client "H" @ 14:21:51 from Angel Web. Below is the screenshot of it.

    7cfc293a-af91-443d-b4e2-a3fff3c010f9-image.png

    I closed the web terminal and then at market close, when I checked the orderbook, I found a strange sell order of same type as the one I manually squared off timestamped @ 14:28:23. Below is the screenshot of it.

    c0e9a444-caf0-4e8a-b7db-6a81aec53acb-image.png

    luckily as I had margin just enough to buy options, it got rejected. What is the origin of the above order timestamped @ 14:28:23? At 14:28, neither was I using web terminal, nor was my script running.

    Please clarify. @admin


  • HI @ Kindly update us on your issue we tested it and we are able to execute orders.


  • Hi @Bharath-Raj-M ok we will test it and update you on this.


  • @admin

    So I use python to place orders:

    def place_order(client_name,client_smartApi,tradingsymbol,symbol_token,symbolexchange,transactiontype,quantity):
        #place order
        try:
            orderparams = {
                "variety": "NORMAL",
                "tradingsymbol": str(tradingsymbol),
                "symboltoken": str(symbol_token),
                "transactiontype": str(transactiontype),
                "exchange": str(symbolexchange),
                "ordertype": "MARKET",
                "producttype": "INTRADAY",
                "duration": "DAY",
                "quantity": str(quantity)
                }
            orderId=client_smartApi.placeOrder(orderparams)
            print("The order id is: "+orderId+"\t client_name:"+client_name+" \t time:"+str(datetime.today()))
        except Exception as e:
            print(e)
    
    client_name = 'Username'
    client_smartApi=SmartConnect(api_key='api_key')
    login = client_smartApi.generateSession('Client_id','Client_password')
    refreshToken = login['data']['refreshToken']
    quantity = 'quantity'
    place_order(client_name,client_smartApi,tradingsymbol,symbol_token,symbolexchange,transactiontype,quantity)
    

    Once I executed the above, I got a response as follows:

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

    That's pretty much it.


  • HI @Bharath-Raj-M Please post your req and response here.


  • @admin
    Dear @admin,

    I faced this issue while placing orders for clients too. I faced it today, could you guide us through the correct steps?

    And also give out a reason why this is happening?

    Regards,
    Bharath


  • Hi @c_harish please mail us your piece if code and error @ api@angelbroking.com .


  • @admin, i am facing this issue again today.

    HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)
    
    Couldn't parse the JSON response received from the server: b'<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:
    

  • Hi @c_harish I am sharing this with our team. Allow me to update you in few time.


  • @admin after this message of yours, i had three instances of below error while checking positions respectively @ 12:52, 12:54, 13:06.

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

    what is the permanent fix for this?


  • Hi @c_harish we are facing some network issues .Our team has fixed it. Please retry and update us if you are facing similar issue.


  • @admin looks like another similar day.
    Facing same Internal Server Error while reading positions, orderbook, margin.
    Ticks are coming almost 20 secs delayed.

    @admin, It's been 14 days since I wrote this post and faced this issue atleast a dozen times now. haven't gotten a single proper reply except for "we will revert to you back soon".


  • Hi @c_harish we have shared this with our team we will revert you back soon.


  • any updates on this, @admin.

    even today facing issues with reading positions, orderbook and frequent HB failures when big move happens, despite running from AWS Mumbai server.

    Couldn't parse the JSON response received from the server: b'<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:
    
    HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)
    

  • hello @rajanprabu @kiran1808 @c_harish our team is working on this.we will update you in this.


  • @c_harish @admin , even i faced this issue today while placing order via API, thank god, i was just testing and lost a little of only 500rs, not more, Admin please investigate this issue


  • @c_harish

    @c_harish said in Issue while placing order and unauthorized order in my account.:

    luckily as I had margin just enough to buy options, it got rejected. What is the origin of the above order timestamped @ 14:28:23? At 14:28, neither was I using web terminal, nor was my script running.

    This is very serious. Imagine order is executed and market went opposite. @bhaveshjain Please have a look at this issue. Its very tricky to handle such situations for algo traders. No one would like to have such situations.


  • Hi @c_harish we will update you after checking the logs from our end.