Node js getPositions giving error

bchopra
hi,
when i call kc.getPostions() function in node js ,
i get below response with error:


{
status: 'error',
message: 'The instrument you are placing an order for has either expired or does not exist.',
data: null,
error_type: 'InputException'
}
  • SRIJAN
    This error is from place order API and not positions API as clearly stated in the exception message.

    This means you are placing order for an invalid instrument.

    You can get the list of all the instruments available for trading from the instruments dump:

    https://kite.trade/docs/connect/v3/market-quotes/#instruments
  • bchopra
    sorry, pasted wrong error by mistake , below is the error:

    {
    message: 'No response from server with error code: ENOTFOUND',
    error_type: 'NetworkException',
    data: null
    }
  • rakeshr
    ENOTFOUND
    Means Route is not found i.e 404. Looks like a DNS issue at your local setup. You need to inspect that.
  • bchopra
    I can view the positions in Zerodha kite web platform , which i think uses same Route to getPositions but when I try to get the positions in Node js using kite api then it gives this error
  • SRIJAN
    Positions API is working fine for me.
    As told by Rakesh Sir, you need to inspect your local setup.

    Also, Kite web/app and KiteConnect APIs use different routes .
    However,the backend database is same for both.
  • bchopra
    Hi,
    Thanks for replying,
    but its bit strange ....Now i am getting the previous error again :

    {
    status: 'error',
    message: 'The instrument you are placing an order for has either expired or does not exist.',
    data: null,
    error_type: 'InputException'
    }

    not able to understand why i am getting this error although i am simply calling getPositions();
  • bchopra
    I have found the error in my code. getPositions is working now.

    Thanks for helping me out :smile:
This discussion has been closed.