[GNC] [GNC-dev] Finance Quote 1.50 release candidate 1 is available

John Ralls jralls at ceridwen.us
Sun Mar 7 20:03:29 EST 2021



> On Mar 7, 2021, at 2:25 PM, Rainer Dorsch <ml at bokomoko.de> wrote:
> 
> Am Sonntag, 7. März 2021, 22:00:04 CET schrieb John Ralls:
>>> On Mar 7, 2021, at 11:39 AM, John Ralls <jralls at ceridwen.us> wrote:
>>>> On Mar 7, 2021, at 11:31 AM, Rainer Dorsch <ml at bokomoko.de> wrote:
>>>> 
>>>> Am Sonntag, 7. März 2021, 19:12:35 CET schrieb John Ralls:
>>>>>> On Mar 7, 2021, at 9:15 AM, Rainer Dorsch <ml at bokomoko.de> wrote:
>>>>>> 
>>>>>> [ move this thread from gnucash-devel to gnucash-user, the original
>>>>>> gnucash- devel thread is here
>>>>>> https://lists.gnucash.org/pipermail/gnucash-devel/2021-March/045777.htm
>>>>>> l
>>>>>> ]>
>>>>>> 
>>>>>> Am Sonntag, 7. März 2021, 17:51:19 CET schrieb John Ralls:
>>>>>>> You're on the wrong list, please use gnucash-user for this sort of
>>>>>>> question.
>>>>>>> 
>>>>>>> GnuCash can't use the quotes because Fondsweb.pm doesn't make a field
>>>>>>> "symbol" in its return array. You should raise an issue at
>>>>>>> https://github.com/financequote/financequote.
>>>>>> 
>>>>>> If I understand you right, the field "symbol" is that same symbol which
>>>>>> gnucash supplied. I added this locally here.
>>>>>> 
>>>>>> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ gnc-fq-dump
>>>>>> fondsweb
>>>>>> LU0119891520 LU2027374805
>>>>>> 
>>>>>> Finance::Quote fields Gnucash uses:
>>>>>> symbol: LU0119891520         <=== required
>>>>>> 
>>>>>>   date: 03/05/2021           <=== recommended
>>>>>> 
>>>>>> currency: EUR                  <=== required
>>>>>> 
>>>>>>   last: 708.99               <=\
>>>>>> 
>>>>>>    nav: 708.99               <=== one of these
>>>>>> 
>>>>>>  price:                      <=/
>>>>>> 
>>>>>> timezone:                      <=== optional
>>>>>> 
>>>>>> =====
>>>>>> 
>>>>>> Finance::Quote fields Gnucash uses:
>>>>>> symbol: LU2027374805         <=== required
>>>>>> 
>>>>>>   date: 03/05/2021           <=== recommended
>>>>>> 
>>>>>> currency: USD                  <=== required
>>>>>> 
>>>>>>   last: 68.39                <=\
>>>>>> 
>>>>>>    nav: 68.39                <=== one of these
>>>>>> 
>>>>>>  price:                      <=/
>>>>>> 
>>>>>> timezone:                      <=== optional
>>>>>> 
>>>>>> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$
>>>>>> 
>>>>>> I also opened a bug report and cross-referenced it:
>>>>>> 
>>>>>> https://github.com/finance-quote/finance-quote/issues/179
>>>>>> 
>>>>>>> As for your complaint about duplicate prices, your pasted-in results
>>>>>>> don't
>>>>>>> show that.
>>>>>> 
>>>>>> Many thanks for your quick reply, John. I move the discusion to
>>>>>> gnucash-user.
>>>>>> 
>>>>>> There are two things which I think are strange from the gnucash side:
>>>>>> 
>>>>>> 1. gnc-fq-dump reports that stock quote cannot be used, but gnucash
>>>>>> uses
>>>>>> it
>>>>>> 2. duplicate prices: I do not see them with gnc-fq-dump but gnucash
>>>>>> shows
>>>>>> them
>>>>>> 
>>>>>> Ist gnucash using gnc-fq-dump in the same way I did?
>>>>> 
>>>>> No. gnc-fq-dump is a user-convenience tool. GnuCash uses gnc-fq-helper,
>>>>> which formats its results so that they can be fed directly to Scheme.
>>>>> Instructions for using it by hand are in its POD.
>>>>> 
>>>>> apparently there are others that don't pass a "symbol" element so if it
>>>>> doesn't find the "symbol" entry in the F::Q results hash it uses the
>>>>> user-supplied symbol instead. There's probably something about the
>>>>> Fondweb.pm results hash that messes up retrieving the right entry.
>>>>> 
>>>>> You can use .cpan/build/Finance-Quote-1.49-0/Examples/stockdump.pl
>>>>> (.cpan is probably in your $HOME) to see exactly what F::Q is sending.
>>>> 
>>>> I run stockdump.pl, but did not see anything wrong or unexpected in
>>>> there:
>>>> 
>>>> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ ./stockdump.pl
>>>> Fondsweb LU2027374805
>>>> $VAR1 = {
>>>> 
>>>>        'LU2027374805success' => 1,
>>>>        'LU2027374805name' => 'Morgan Stanley INVF Global Endurance Fund
>>>> 
>>>> (USD) Z',
>>>> 
>>>>        'LU2027374805isin' => 'LU2027374805',
>>>>        'LU2027374805isodate' => '2021-03-05',
>>>>        'LU2027374805method' => 'fondsweb',
>>>>        'LU2027374805nav' => '68.39',
>>>>        'LU2027374805date' => '03/05/2021',
>>>>        'LU2027374805type' => 'fund',
>>>>        'LU2027374805currency' => 'USD',
>>>>        'LU2027374805last' => '68.39',
>>>>        'LU2027374805year_range' => '81.19 - 16.47',
>>>>        'LU2027374805symbol' => 'LU2027374805'
>>>> 
>>>>      };
>>>> 
>>>> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ ./stockdump.pl
>>>> Fondsweb LU0119891520
>>>> $VAR1 = {
>>>> 
>>>>        'LU0119891520name' => 'MEDICAL BioHealth EUR',
>>>>        'LU0119891520method' => 'fondsweb',
>>>>        'LU0119891520isodate' => '2021-03-05',
>>>>        'LU0119891520isin' => 'LU0119891520941135',
>>>>        'LU0119891520success' => 1,
>>>>        'LU0119891520year_range' => '807.77 - 414.77',
>>>>        'LU0119891520currency' => 'EUR',
>>>>        'LU0119891520last' => '708.99',
>>>>        'LU0119891520type' => 'fund',
>>>>        'LU0119891520nav' => '708.99',
>>>>        'LU0119891520date' => '03/05/2021',
>>>>        'LU0119891520symbol' => 'LU0119891520'
>>>> 
>>>>      };
>>>> 
>>>> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$
>>>> 
>>>> The symbol part I added in Fondsweb.pm (see also
>>>> 
>>>> https://github.com/finance-quote/finance-quote/issues/179
>>>> 
>>>> )
>>>> 
>>>> Do you see something unexpected or suspicious in there which can cause
>>>> the
>>>> mess up?
>>> 
>>> Not offhand, but it's quite possible that adding symbol fixes the problem.
>>> Did you try gnc-fq-helper, and if so what was its output?
>> Another thought, though: You passed just one symbol at a time to stock
>> dumper.pl. When I pass both, I get
>> ~/.cpan/build/finance-quote/Examples/stockdump.pl fondsweb LU0119891520
>> LU2027374805
>> 
>> $VAR1 = {
>>          'LU0119891520last' => '708.99',
>>          'LU2027374805date' => '03/05/2021',
>>          'LU0119891520isin' => 'LU0119891520941135',
>>          'LU0119891520method' => 'fondsweb',
>>          'LU0119891520success' => 1,
>>          'LU2027374805nav' => '708.99',
>>          'LU0119891520type' => 'fund',
>>          'LU2027374805name' => 'MEDICAL BioHealth EURMorgan Stanley INVF
>> Global Endurance Fund (USD) Z', 'LU2027374805isodate' => '2021-03-05',
>>          'LU2027374805currency' => 'EUR',
>>          'LU0119891520year_range' => '807.77 - 414.77',
>>          'LU0119891520nav' => '708.99',
>>          'LU2027374805success' => 1,
>>          'LU2027374805last' => '708.99',
>>          'LU0119891520date' => '03/05/2021',
>>          'LU2027374805method' => 'fondsweb',
>>          'LU2027374805isin' => 'LU0119891520941135',
>>          'LU2027374805year_range' => '807.77 - 414.77',
>>          'LU0119891520currency' => 'EUR',
>>          'LU0119891520isodate' => '2021-03-05',
>>          'LU0119891520name' => 'MEDICAL BioHealth EUR',
>>          'LU2027374805type' => 'fund'
>>        };
>> 
>> While if I do
>> ~/.cpan/build/finance-quote/Examples/stockdump.pl yahoo_json CSCO AAPL
>> I get
>> $VAR1 = {
>>          'CSCOlast' => '46.25',
>>          'AAPLvolume' => 153766501,
>>          'AAPLhigh' => '121.935',
>>          'CSCOpe' => '19.351463',
>>          'AAPLname' => 'AAPL (Apple Inc.)',
>>          'AAPLopen' => '120.98',
>>          'AAPLcurrency' => 'USD',
>>          'CSCOisodate' => '2021-03-05',
>>          'CSCOdate' => '03/05/2021',
>>          'CSCOeps' => '2.39',
>>          'CSCOtype' => 'EQUITY',
>>          'CSCOexchange' => 'Sourced from Yahoo Finance (as JSON)',
>>          'CSCOmethod' => 'yahoo_json',
>>          'CSCOlow' => '45.27',
>>          'AAPLsymbol' => 'AAPL',
>>          'CSCOclose' => '44.56',
>>          'AAPLdiv_yield' => '0.67177224',
>>          'CSCOyear_range' => '        32.4 - 49.34',
>>          'CSCOsuccess' => 1,
>>          'CSCOcurrency' => 'USD',
>>          'CSCOhigh' => '46.74',
>>          'CSCOopen' => '45.4455',
>>          'AAPLpe' => '32.931923',
>>          'CSCOname' => 'CSCO (Cisco Systems, Inc.)',
>>          'CSCOvolume' => 33197580,
>>          'AAPLlast' => '121.42',
>>          'AAPLtype' => 'EQUITY',
>>          'AAPLisodate' => '2021-03-05',
>>          'AAPLeps' => '3.687',
>>          'AAPLdate' => '03/05/2021',
>>          'AAPLlow' => '117.57',
>>          'AAPLexchange' => 'Sourced from Yahoo Finance (as JSON)',
>>          'AAPLmethod' => 'yahoo_json',
>>          'AAPLsuccess' => 1,
>>          'AAPLyear_range' => '     53.1525 - 145.09',
>>          'AAPLclose' => '120.13',
>>          'CSCOdiv_yield' => '3.2315977',
>>          'CSCOsymbol' => 'CSCO'
>>        };
>> 
>> So ISTM the problem is that Fondsweb.pm isn't able to handle batched
>> requests.
> 
> Many thanks, indeed that is a big difference.
> 
> I propose a fix in
> 
> https://github.com/finance-quote/finance-quote/issues/179#issuecomment-792364563 
> 
> and can confirm that this makes fondsweb working in gnucash.
> 
> 
> Just for curiosity, how would gnc-fq-helper work? I tried to follow the 
> manpage:
> 
> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ man gnc-fq-helper                            
> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ echo '(Fondsweb 
> "LU2027374805" "LU0119891520")' | gnc-fq-helper 
> gnc-fq-helper: bad input line ((Fondsweb "LU2027374805" "LU0119891520") 
> ) 
> rd at h370:/usr/share/doc/libfinance-quote-perl/examples$ 

fondsweb in lowercase (I haven't applied your patches):

 echo '(fondsweb "LU2027374805" "LU0119891520")' | /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-helper
(("LU2027374805" (symbol . "LU2027374805") (gnc:time-no-zone . "2021-03-05 12:00:00") (last . #e68.39) (currency . "USD"))
 ("LU0119891520" (symbol . "LU0119891520") (gnc:time-no-zone . "2021-03-05 12:00:00") (last . #e68.39) (currency . "USD")))

Regards,
John Ralls



More information about the gnucash-user mailing list