Currency Quotes

Alun Champion list at achampion.net
Thu Nov 9 08:20:28 EST 2017


Yes, I was looking at the F::Q Currencies.pm, unfortunately I’m not
proficient enough in Perl to do that confidently.

Alphavantage also has a the separate API for currencies which will be more
efficient because it only returns the current exchange rate (vs this daily
history for stocks), e.g.:

$ curl "[https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=GBP&to_currency=USD&apikey=XXX](https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=GBP&to_currency=USD&apikey=XXX)"

This API call also works for Crypto Currencies, e.g.:

$ curl "[https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=USD&apikey=XXX](https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=USD&apikey=XXX)"

It just happens that ‘function=TIME_SERIES_DAILY’ with ‘symbol=GBPUSD=X’
also returns currency exchange rates for daily history, e.g.:

$ curl "[https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&outputsize=compact&symbol=GBPUSD=X&apikey=XXX](https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&outputsize=compact&symbol=GBPUSD=X&apikey=XXX)"

Which allowed gnc-fq-dump to work.
-A.

On 9 November 2017 at 03:51, Erik Colson <eco at ecocode.net> wrote:


> Alun Champion <list at achampion.net> writes:
>
> > Alphavantage supports currencies, e.g.:
> >
> > $ export ALPHAVANTAGE_API_KEY=XXX
> > $ gnc-fq-dump alphavantage GBPUSD=X
> > Finance::Quote fields Gnucash uses:
> >     symbol: GBPUSD=X             <=== required
> >       date: 11/09/2017           <=== recommended
> >   currency: USD                  <=== required
> >       last: 1.3139               <=\
> >        nav:                      <=== one of these
> >      price:                      <=/
> >   timezone:                      <=== optional
> >
> > Haven't quite figured out how to get Gnucash to use this yet.
>
> F::Q has a different API for currencies.  The source has to be moved to
> alphavantage which will probably be done next weekend.  Till then,
> GnuCash will probably not have currency rates anymore..
>
> best
> --
> erik colson
>


More information about the gnucash-user mailing list