Invalid `order_id`

abhivin123
abhivin123 edited January 2019 in Python client
APIs are broken ... Unable to place any orders. Error sounds ambiguous. Order id is generated and returned and certainly not passed. So order id passing mechanism changed or something basic changed around naming convention of order id.

Can you please check?
  • abhivin123
    This was working perfectly till Friday ... and nothing changed from my side. Not a one time exception and is happening for every order placed via python client.
  • abhivin123
    @sujith - The issue is real ... can you please check ...
  • nikhil154
    yes, i am encountering the same problem as well ... kindly check
  • abhivin123
    Hmm ... @vinodhec - you discovered it really early ... I checked with CANCEL order by first placing a order via KiteWeb and then CANCEL via Python Client. This also returns existing order_id on successful CANCEL but it seems to be working fine. So only placing new order seems to be the issue.
  • nikhil154
    yes , cancelling orders works fine .... issue only with punching orders .... can anyone at zerodha please confirm that atleast they are looking at the issue .
  • sujith
    Is this consistent issue? We tried this multiple times but we don't see this.

    Can you please share the order payload?
  • abhivin123
    abhivin123 edited January 2019
    It is a consistent issue ... v3 ...

    try:

    order_id = kite.place_order(exchange=exchange,
    variety=variety,
    tradingsymbol=tradingsymbol,
    transaction_type=transaction_type,
    quantity=quantity,
    price=price,
    product=product,
    order_type=order_type)

    print(bcolors.OKGR + "ORDER PLACED. ORDER: %s" % (order_id) + bcolors.ENDC)

    except Exception as e:
    print(bcolors.FAIL + "ORDER FAILED. ERROR: %s" % (e.message) + bcolors.ENDC)
  • sujith
    We did try this and we are getting order id back with 200.
    Can you please share the exact params you are passing?
  • nikhil154
    error message i get ......


    File "", line 12, in
    trailing_stoploss=2)

    File "C:\Users\iconic\Anaconda3\lib\site-packages\kiteconnect-3.7.4-py3.6.egg\kiteconnect\connect.py", line 326, in place_order
    return self._post("order.place", params)["order_id"]

    File "C:\Users\iconic\Anaconda3\lib\site-packages\kiteconnect-3.7.4-py3.6.egg\kiteconnect\connect.py", line 701, in _post
    return self._request(route, "POST", params)

    File "C:\Users\iconic\Anaconda3\lib\site-packages\kiteconnect-3.7.4-py3.6.egg\kiteconnect\connect.py", line 766, in _request
    raise exp(data["message"], code=r.status_code)

    InputException: Invalid `order_id`.
  • sujith
    @nikhil154,
    Can you run in debug mode and paste the whole stack trace here?
  • abhivin123
    Seriously?? OK ... let me dig a little deeper to get you the exact string ... 5 mins.
  • nikhil154
    nikhil154 edited January 2019
    @sujith , i started learning python a few months ago , i dont even get half the lingo u guys use... may be @abhivin123 can help
  • abhivin123
    order_id = kite.place_order(exchange='NFO',
    variety='REGULAR',
    tradingsymbol='INDUSINDBK19JAN1620CE',
    transaction_type='SELL',
    quantity='300',
    price='4.65',
    product='MIS',
    order_type='LIMIT')

    $ python --version
    Python 2.7.9
  • sujith
    The variety you are passing is in the uppercase, it is supposed to be lower case variety (regular).
  • abhivin123
    Yup ... That's it ... Good catch ... Thanks a ton.
  • nikhil154
    nikhil154 edited January 2019
    now its working
  • sujith
    It was always the lower case, we have mentioned it in the documentation. Ideally, you should be using enums like this.

    It was working till last week because we were using Nginx till last week and we moved to HAProxy.
    In Nginx, it modifies the URL to lower case by default. The behavior is different on HAProxy.
  • abhivin123
    abhivin123 edited January 2019
    Hmmm ... Baat to sahe hai ... :) ... Thnx. Nice to know about - the migration.
This discussion has been closed.