(Translated by https://www.hiragana.jp/)
GitHub - idefant/exrates-api: Simple exchange rates API. With historical exchange rates. No limits
Skip to content

Simple exchange rates API. With historical exchange rates. No limits

License

Notifications You must be signed in to change notification settings

idefant/exrates-api

Repository files navigation

ExRates

A simple Exchange Rates API

Data is collected once a day from Open Exchange Rates

Features

  • Getting up-to-date data
  • Getting rates by date
  • Getting rates by period (2 routes)
  • Filtering by currency code

Routes

Formats

  • {date} - Date in format YYYY-MM-DD
  • {period} - Date in format YYYY-MM-DD or YYYY-MM or YYYY
  • {symbols} - Сomma-separated list of currencies (Example: usd,eur,cny)

Endpoints

  • /currencies

Description: Get list of available currencies
Method: GET

  • /date/{date}

Description: Get exchange rate for a specific date
Method: GET
Optional params: symbols={symbols}

  • /date/last

Description: Get exchange rate for a last day
Method: GET
Optional params: symbols={symbols}

  • /period/simple/{period}

Description: Get list of rates for a certain period
Method: GET
Optional params: symbols={symbols}

  • /period/advanced

Description: Get list of rates for a certain period
Method: GET
Required params: from={period}, to={period}
Optional params: symbols={symbols}

  • /update_rates

Description: Update exchange rates (only localhost)
Method: POST

Examples

Production

  1. Create docker-compose.yml with content:
version: "3.8"

services:
  exrates-api:
    image: idefant/exrates-api
    container_name: exrates-api
    env_file:
      - .env
    restart: unless-stopped
    ports:
      - "8182:3000"
  1. Create .env and fill in similarly .env.sample
  2. Run docker compose up -d

Development

To begin development:

  1. Clone this repo
  2. Create .env and fill in similarly .env.sample
  3. npm i
  4. npm run build
  5. npm run dev

Please Star this repo by clicking on ⭐ button