[GNC] Problem getting Finance::Quote working

Tomas Volf ~ at wolfsden.cz
Fri Jan 3 09:48:29 EST 2025


David H <hellvee at gmail.com> writes:

> Have you setup your Alpha Vantage API key the output warns you about ?
> Preferences >> Online Quotes -
> https://wiki.gnucash.org/wiki/Online_Quotes#Alphavantage
>
>  00:58:05  WARN <gnc.price-quotes> [GncFQQuoteSource::set_api_key()] No
> Alpha Vantage API key set, currency quotes and other AlphaVantage based
> quotes won't work

I did not, since at this point I do not have a use for AlphaVantage and
wanted to leverage other sources listed by the `--quotes info'.

>
> Cheers David H.
>
>
> On Fri, 3 Jan 2025 at 12:51, Tomas Volf <~@wolfsden.cz> wrote:
>
>> Hello,
>>
>> Today I installed gnucash and am trying to get fetch quotes from the
>> internet, and I am having troubles getting it to work.  I am not
>> subscribed, so please CC.
>>
>> When I try the `gnucash-cli --quotes info', it seems to work:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ /gnu/store/fq2bix6lr0rls6vld4xwb1dchkkdjnx1-gnucash-5.9/bin/gnucash-cli
>> --quotes info
>> * 00:56:27  WARN <gnc.price-quotes> [GncFQQuoteSource::set_api_key()] No
>> Alpha Vantage API key set, currency quotes and other AlphaVantage based
>> quotes won't work.
>> Found Finance::Quote version 1.64.
>> Finance::Quote sources:
>> aex          alphavantage              amfiindia    asegr        asx
>> aufunds      australia    bamosz       bats         bet          bloomberg
>> borsa_italiana            bourso       bse          bseindia     bvb
>> canada       comdirect    consorsbank  cse          deka         dutch
>> dwsfunds     europe       fetch_live_currencies     financeapi
>> finanzpartner             fondsweb     fool         france       ftfunds
>> goldmoney    googleweb    greece       hu           hufund       hungary
>> hustock      india        indiamutual  known_currencies
>> marketwatch
>> morningstarau             morningstarch             morningstarjp
>> morningstaruk             mstaruk      nasdaq       nseindia     nyse
>> nzx          onvista      oslobors     poland       romania      seb_funds
>> sinvestor    six          stockdata    stooq        tesouro_direto
>> tiaacref     tmx          tradegate    tradeville   treasurydirect
>> troweprice   troweprice_direct         tsp          tsx          twelvedata
>> ukfunds      unionfunds   usa          xetra        yahoo_json   yahoojson
>> yahooweb     za
>> --8<---------------cut here---------------end--------------->8---
>>
>> However when I try to actually get some quotes, I get this "error":
>>
>> --8<---------------cut here---------------start------------->8---
>> $ /gnu/store/fq2bix6lr0rls6vld4xwb1dchkkdjnx1-gnucash-5.9/bin/gnucash-cli
>> --quotes dump australia CML
>> * 00:58:05  WARN <gnc.price-quotes> [GncFQQuoteSource::set_api_key()] No
>> Alpha Vantage API key set, currency quotes and other AlphaVantage based
>> quotes won't work.
>> CML Finance::Quote returned no data and set no error.
>> --8<---------------cut here---------------end--------------->8---
>>
>> Which seems weird.  The helper itself appears to work:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ echo '{"defaultcurrency": "USD","australia": {"CML": ""}}' |
>> /gnu/store/fq2bix6lr0rls6vld4xwb1dchkkdjnx1-gnucash-5.9/bin/finance-quote-wrapper
>> -f
>> {"australia":{"CML":{"name":"CONNECTED MINERALS
>> LIMITED","success":1,"last":0.2,"method":"asx","price":0.2,"type":"","net":0,"errormsg":"","bid":0.18,"symbol":"CML","p_change":"0","volume":1019,"currency":"AUD","exchange":"Australian
>> Securities Exchange","ask":0.2}}}
>> --8<---------------cut here---------------end--------------->8---
>>
>> When I strace the `gnucash-cli' binary, it seems it does get the JSON
>> back:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ strace -v -s 8192 --
>> /gnu/store/fq2bix6lr0rls6vld4xwb1dchkkdjnx1-gnucash-5.9/bin/gnucash-cli
>> --quotes dump australia CML
>> [..]
>> read(15,
>> "{\"australia\":{\"CML\":{\"errormsg\":\"\",\"price\":0.2,\"net\":0,\"type\":\"\",\"bid\":0.18,\"success\":1,\"volume\":1019,\"name\":\"CONNECTED
>> MINERALS
>> LIMITED\",\"method\":\"asx\",\"p_change\":\"0\",\"currency\":\"AUD\",\"ask\":0.2,\"last\":0.2,\"symbol\":\"CML\"}}}\n",
>> 512) = 224
>> [..]
>> write(1, "CML Finance::Quote returned no data and set no error.\n", 54CML
>> Finance::Quote returned no data and set no error.
>> ) = 54
>> [..]
>> --8<---------------cut here---------------end--------------->8---
>>
>> I am on 5.9 version:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ /gnu/store/fq2bix6lr0rls6vld4xwb1dchkkdjnx1-gnucash-5.9/bin/gnucash-cli
>> --version
>> GnuCash 5.9
>> Build ID: 5.9+(2024-09-28)
>> --8<---------------cut here---------------end--------------->8---
>>

In the mean time I discovered an email stating that the `dump' operation
is simply broken in 5.9.  Updating to 5.10 fixed my issue.

>> Would anyone have some suggestion what might be wrong and how I can fix
>> this?
>>
>> Thank you and have a nice day,
>> Tomas Volf
>>
>> --
>> There are only two hard things in Computer Science:
>> cache invalidation, naming things and off-by-one errors.
>> _______________________________________________
>> 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
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.


More information about the gnucash-user mailing list