beancount / beanprice

Daily price quotes fetching library for plain-text accounting
GNU General Public License v2.0
70 stars 38 forks source link

OANDA source no longer works #64

Open upsuper opened 3 years ago

upsuper commented 3 years ago

It seems that the API point returns 502 now. Probably they have removed that API point, as the document now shows a new revision.

chrisberkhout commented 2 years ago

There are now 2 relevant OANDA APIs:

1. Historical Exchange Rates (180 days data for free, 30 years data for $75/month)

https://www.oanda.com/foreign-exchange-data-services/en/historical-currency-converter/

Presented via a web UI.

Without registration, there's up to 180 days of data with no CSV download or API access. Relevant endpoint seems open and straightforward:

curl -G 'https://www.oanda.com/fx-for-business/historical-rates/api/data/update/' \
  -d 'source=OANDA' \
  -d 'adjustment=0' \
  -d 'base_currency=BTC' \
  -d 'start_date=2021-11-16' \
  -d 'end_date=2022-5-15' \
  -d 'period=daily' \
  -d 'price=bid' \
  -d 'view=graph' \
  -d 'quote_currency_0=EUR' \
  -d 'quote_currency_1=' \
  -d 'quote_currency_2=' \
  -d 'quote_currency_3=' \
  -d 'quote_currency_4=' \
  -d 'quote_currency_5=' \
  -d 'quote_currency_6=' \
  -d 'quote_currency_7=' \
  -d 'quote_currency_8=' \
  -d 'quote_currency_9=' | jq .

With a Pro registration ($75/month or $750/year or 30 day trail), there's 31+ years of data, 40+ Central Bank exchange rates, CSV download (only 1 CSV download per trail).

2. Exchange Rates API ($425/month, 30 day trial)

https://www.oanda.com/foreign-exchange-data-services/en/exchange-rates-api/

API key required for all endpoints. 30 day trail with up to 1000 quote currencies. Account fees start with the Standard account at $425/month or $4700/year.