I have notices while calling ‘getHistory’ api endpoint that if the symbol of the instrument has ‘&’ character in it, this end points gives error code -300 saying instrument name is invalid even though it is a valid symbol.
Could you please have a look? Is there something we need to do like encoding or replacing this character with something else? Or it is a bug needs to be fixed?
Please note that my code works fine. I am able to get historical data successfully for all the other instruments. Only these instruments return error code -300. It is my observation that they all have ‘&’ character in their symbol while all other instruments (which I have been able to query successfully) does not have it.
Try using the raw character **%26 **instead of **& **in the symbol name.
Example -
Instead of NSE:J&KBANK-EQ, try with NSE:J%26KBANK-EQ
Instead of NSE:ARE&M-EQ, try with NSE:ARE%26M-EQ
If %26 does not work, try with another escape sequence &
Also mention which SDK you are using, because some underlying interpreters/compilers especially with JavaScript encode/decode strings in some weird way.
I have already asked support if we need to encode the symbol but there is no clarification for this nor it is mentioned in docs. Did you face same problem and you solved it like this?
Nothing fency going on in the code. this “instrument.symbol” passes the instrument symbol in proper format like “NSE:ARE&M-EQ”. As I have mentioned above, this is happening with node.js sdk. I am also able to fetch other symbols successfully but the once which have “&” in their symbol. Did you try with node.js (javascript) sdk?
Hi,
Currently, you can encode the symbol and pass it as a workaround, it should work fine. We are in the process of addressing this issue at the SDK level.
Thank you for your patience!
Ok so you have found this issue. Good… Encoding does not work either. Please resolve this. Once done, please let me know so I will download the latest SDK and try with it. I shall give you the feedback accordingly. Thank you.