Querying Instruments with '&' character in Symbol

Hello,

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?

Hi There,

Could you please share the symbol name or provide the code to help us understand it better? Kindly use the format specified in the “Symbol master

Ex:
For “L&T TECHNOLOGY SER. LTD” symbol format is " NSE:LTTS-EQ "

Hi Naresh,

Following are symbols I am querying:

NSE:ARE&M-EQ

NSE:GMRP&UI-EQ

NSE:J&KBANK-EQ

NSE:M&MFIN-EQ

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.

Regards.

Hi,

I have tried all these symbols and successfully fetched the data.

Could you please check one more time and confirm?

@102061119369336379612,

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?

response = await this.session.getHistory({
    symbol: instrument.Symbol,
    resolution: BrokerService.convertTimeframeIntoResolution(timeframe),
    date_format: 1,
    range_from: DateTimeProvider.Format(from, "YYYY-MM-DD"),
    range_to: DateTimeProvider.Format(to, "YYYY-MM-DD"),
    cont_flag: 1,
    oi_flag: 1
});

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?

Regards.

Hi @102061119369336379612,
We will test Node.js and provide an update here. Thank you for your patience.

@102061119369336379612
Yes, it is a known issue with @communications_team Node.js SDK for & character in symbol name. We need to replace it with **%26 **to solve it.

cc : @naresh_janagama
Refer older post here

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!

Any updates on this?

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.

Thank you for highlighting it.

Our team is working on it, we will update here once it’s rectified.

Hi @102061119369336379612, @nsuyash11-m18,

This has been rectified. Thank you for bringing it to our attention. Apologies for any inconvenience caused.