Skip to content
/ QCurrency Public

🇹🇼📈💵💴💶💷 Simple NTD foreign exchange rates API 新台幣匯率API

License

Notifications You must be signed in to change notification settings

qcl/QCurrency

Repository files navigation

QCurrency

A simple NTD foreign exchange rates API

Build Status

QCurrency is a API for getting almost realtime NTD (New Taiwan Dollar, NT$, ISO-4217 currency code TWD) foreign exchange rates that published by Bank of Taiwan. And also fetched from Google Search result.

Usage

Directly use HTTP GET

GET API_ENDPOINT/latest

Then you will get the exchange rates response JSON object. See APIs for more infromation and excample.

APIs

API endpoint: https://qcurrency-exchange-rates.appspot.com/api. You can also use this repository to build your own API server.

Get latest exchange rates

GET /latest

Response

  • update: string, update time in ISO 8601 format.
  • source: string, name of soure.
  • rates: dictionary, currency name string in ISO 4217 to as key, and exchange rate in float as value.

Sample response

{
    "update": "2018-03-09T16:15:00+08:00",
    "source": "Bank of Taiwan",
    "rates": {
        "THB": 0.9586,
        "ZAR": 2.5,
        "GBP": 40.73,
        "NZD": 21.42,
        "CHF": 30.92,
        "CNY": 4.647,
        "JPY": 0.2765,
        "USD": 29.34,
        "SGD": 22.32,
        "HKD": 3.766,
        "SEK": 3.6,
        "CAD": 22.86,
        "AUD": 22.97,
        "EUR": 36.27
    }
}

Available exchange rates sources

GET /sources

To be implemented.

Get latest exchange rates by source

GET /SOURCE_NAME/latest

To be implemented.

How does it work?

Basically, it's a Google App Engine instance that fetchs data and parses it from Bank of Taiwan every few minutes.

Develop

Google Cloud SDK

Install Google Cloud SDK, so that you can start use gcloud commands.

After installation, install app engine component.

$ gcloud components install app-engine-python

If you already have gcloud, you can also update it.

$ gcloud components update

Python2.7

Dou to Google App Engine Python Standard Enviroment use python2.7 as its python version. If the default python command in your computer (e.g. Using homebrew python on a Mac) is Python 3, please modify enviroment variable or $PATH to make pathon2.7 as default one to make sure it will use python2.7 to execute scroipt like dev_appserver.py.

You can also check Makefile for some useful command to help you developing.

Run local app engine

$ dev_appserver.py app.yaml

Then it will start a local app engine server for developing and testing.

Run test cases

$ python2.7 -m pytest tests/

Depoly

$ gcloud app depoly --project=APP_ENGINE_PROJECT_NAME

Deploy cron job

$ gcloud app depoly cron.yaml --project=APP_ENGINE_PROJECT_NAME

License

See LICENSE.md.

Donate

  • PayPal
  • ETH 0x459E11281660e6D5192C746775c5d0EBC6287696

Releases

No releases published

Packages

No packages published