[GNC] Finance::Quote stock code with ampersand

John Ralls jralls at ceridwen.us
Sun Aug 16 11:21:47 EDT 2020



> On Aug 16, 2020, at 7:03 AM, Jour Maken <jourMaken at outlook.com> wrote:
> 
> This is an issue with F:Q accessed through Gnucash or gnc-fq-dump. A stock I need to retrieve quotes from Yahoo JSON has an ampersand in its code and hence fails to retrieve the correct prices. If someone has faced this and come up with a workaround, I would like to know, please. The code is M&M for Mahindra and Mahindra, and the links for the same are as follows:
> 
> https://www.nseindia.com/get-quotes/equity?symbol=M%26M
> 
> https://in.finance.yahoo.com/quote/M&M.NS?p=M&M.NS&.tsrc=fin-srch
> 
> I have tried escape sequence ‘M\&M.NS’, ‘M&M.NS’ and ‘M%26M.NS’ but in each case quotes for just ‘M’ corresponding to Macy’s is retrieved in USD - my locale is set for INR currency.
> 
> Please advise,
> 


The last works for me:

gnc-fq-dump yahoo_json 'M%26M.NS'
Finance::Quote fields Gnucash uses:
    symbol: M%26M.NS             <=== required
      date: 08/14/2020           <=== recommended
  currency: INR                  <=== required
      last: 614.45               <=\
       nav:                      <=== one of these
     price:                      <=/
  timezone:                      <=== optional

and
echo '(yahoo_json  "M%26M.NS")' | gnc-fq-helper
(("M%26M.NS" (symbol . "M%26M.NS") (gnc:time-no-zone . "2020-08-14 12:00:00") (last . #e614.45) (currency . "INR")))

I tried it in GnuCash. Worked there too.

Regards,
John Ralls




More information about the gnucash-user mailing list