[GNC] Finance::Quote - AlphaVantage Trade Currencies
Bruce Schuck
bschuck at asgard-systems.com
Mon Jul 17 14:11:21 EDT 2023
On 7/17/23 10:02 AM, john wrote:
> It's not all non-US securities. In AlphaVantage it appears to be only
> LSE stocks; JSE stocks aren't supported and Tel Aviv stocks support
> only ILS. The Yahoo JSON module adjusts prices for Zac (South Africa)
> and ILA (Israel) as well as GBX, but Yahoo JSON apparently includes a
> currency code to make that easy. That seems to be missing from
> YahooWeb, perhaps an oversight on Vincent's part. The currency is
> available on https://finance.yahoo.com/quote/GBP.L
> <https://finance.yahoo.com/quote/GBP.L> prefixed by "Currency In" in
> div id="quote-header-info".
The currency is being captured by YahooWeb. For GBP.L (traded in
GBp/GBX) has its price converted to GBP and currency reported as such.
At the time of this writing, GBP.L was 0.1850 GBp, F::Q v1.57 yahooweb
returns 0.00185 GBP.
% gnc-fq-dump -v yahooweb GBP.L
stock field value
----- ----- -----
GBP.L currency: GBP
GBP.L date: 07/17/2023
GBP.L exchange: LSE - LSE Delayed Price
GBP.L isodate: 2023-07-17
GBP.L last: 0.00185
GBP.L method: yahooweb
GBP.L name: Global Petroleum Limited
GBP.L success: 1
GBP.L symbol: GBP.L
> So for AlphaVantage it seems only .L and .IL suffix securities would
> need to be queried, and maybe only .L unless there are known
> instances where .IL-suffixed symbols are priced in GBP.
I will change the AlphaVantage.pm fix I'm working on to only execute the
extra API call for securities ending with '.L'.
> Rather than spending an extra query maybe AlphaVantage.pm could
> accept a special extra suffix indicating that the user wants quotes
> to be multiplied by 100, perhaps X, so a request for GBP.L priced in
> GBP would be GBP.L.X.
If I understand, this method assumes the user knows that the data from
AV for GBP.L is priced in GBp/GBX. Correct?
> Alternatively we could create a GBX, ZAX, and ILA pseudo-currencies
> in GnuCash and users would create parent accounts in those currencies
> for stocks quoted that way. That would take a little finessing on
> users' part because using it would depend both on the currency the
> stock is quoted in and whether F::Q converts it to the "real"
> currency.
F::Q currently sets currency based on suffix. '.L' gets mapped to 'GBP'.
I just checked, currently no map in AV for ZAR. By chance, you don't
have an example for me? Thanks. Like the previous comment, this also
expects users to know what currencies the different securities are
reports as coming from the AV module, correct? While I like the idea on
a high level, I think that is asking for trouble reports from users
having pricing issues.
Thanks again.
Bruce S.
More information about the gnucash-user
mailing list