[GNC] Finance::Quote stock code with ampersand

Geoff cleanoutmyshed at gmail.com
Sun Aug 16 20:18:52 EDT 2020


Divakar, further to John's reply, this also works for me on Windows 10.

gnucash 4.1.

C:> perl -v
This is perl 5, version 30, subversion 0 (v5.30.0) built for 
MSWin32-x64-multi-thread

Finance::Quote version 1.49
https://metacpan.org/pod/Finance::Quote

NOTE: Double quotes are needed with gnc-fq-dump under Windows:

C:> perl 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: 610.8                <=\
        nav:                      <=== one of these
      price:                      <=/
   timezone:                      <=== optional

C:> echo (yahoo_json "M%26M.NS") | perl gnc-fq-helper
(("M%26M.NS" (symbol . "M%26M.NS") (gnc:time-no-zone . "2020-08-14 
12:00:00") (last . #e610.8) (currency . "INR")))


I have attached a screenshot of the security set up in gnucash.

Hope this helps.

Regards

Geoff
=====


On 17/08/2020 1:21 am, John Ralls wrote:
> 
> 
>> 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
> 
> 
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mahindra.jpg
Type: image/jpeg
Size: 78980 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20200817/67a940a4/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mahindra_price.jpg
Type: image/jpeg
Size: 32336 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20200817/67a940a4/attachment-0003.jpg>


More information about the gnucash-user mailing list