Unable to deal with " Invalid return character or leading space in header: X-ClientPublicIP "


  • I'm getting the error " Invalid return character or leading space in header: X-ClientPublicIP " while trying to login, place order or cancel order through Python script using SmartAPI.
    It is running fine at some times else the error is continued.
    What causing this error occurrence? Please guide


  • @admin
    WS = WebSocket(FEED_TOKEN, CLIENT_CODE)
    TypeError: init() missing 1 required positional argument: 'task'

    new Error after reinstalling SDK.


  • @leena-1234 ,@rajanprabu , @rajanprabu
    we fixed this issue in the sdk you need to reinstall sdk .Also if you observe any other issue you can post here.


  • @admin

    mine is bbkg1036 and bbkg1037

    Today it happed 8 times. I was fetching the order_book every 3 seconds.

    ***** STORE NOTIF: While feteching order_book
    ***** STORE NOTIF: Invalid return character or leading space in header: X-ClientPublicIP
    ***** STORE NOTIF: While feteching order_book
    ***** STORE NOTIF: Invalid return character or leading space in header: X-ClientPublicIP
    

    If you are looking in to this.. I have few more things to register.

    ORDER DELAY

    time to time there is a execution delay. I have logged the timestamp just before and after the order submission.

    First order on same day

     print ('Before order', datetime.datetime.now(timezone('Asia/Kolkata')))
     oid = self.angel_api.placeOrder(orderparams)
     print ('After order', datetime.datetime.now(timezone('Asia/Kolkata')))
    

    and this is what I get

    Before order 2021-03-02 09:56:00.559882+05:30
    After order 2021-03-02 09:56:12.755383+05:30
    

    There is a 14 sec delay in submitting the order. Web screenshot here

    Screenshot 2021-03-02 at 09.55.22.png

    Second order on same day

    Before order 2021-03-02 11:07:01.003910+05:30
    After order 2021-03-02 11:07:02.050287+05:30
    ``
    
    This went well
    
    **Third order on same day**
    
    

    Before order 2021-03-02 13:48:00.286036+05:30
    After order 2021-03-02 13:48:16.498416+05:30
    ``
    Thats a whopping 16 sec delay

    Screenshot 2021-03-02 at 09.55.42.png

    Fourth order on same day

    Before order 2021-03-02 15:16:11.160462+05:30
    After order 2021-03-02 15:16:12.340260+05:30
    

    Im sitting on a Gigabit network and some orders to go well in time. Please have a look at this delays. This is very crucial for trading.

    Also im using your official python SDK and not my own headers etc.

    Thanks


  • @admin

    Thank you for your response.
    I'm using 3 client IDs in my application.
    Client IDs are: L38845, I20415, M282515


  • @leena-1234 @James-Bond @rajanprabu
    Please send us your client id to solve the issues.


  • This post is deleted!

  • @leena-1234

    yes this happens when one fetched trade book or order book. As I wrote in the other post, I am also waiting for the @admin and team to looking in to it.