Skip to main content

No project description provided

Project description

twrate

A Python package for querying real-time exchange rates from major Taiwanese banks.

Overview

twrate provides a simple and efficient way to retrieve up-to-date currency exchange rates from Taiwanese banks. Currently, it supports the following banks:

  • Bank of Taiwan (台灣銀行)
  • DBS Bank Taiwan (星展銀行)
  • Sinopac Bank (永豐銀行)
  • E.SUN Bank (玉山銀行)

Installation

pip install twrate

Usage

Basic Usage

from twrate import query_bot_rates  # Bank of Taiwan
from twrate import query_dbs_rates  # DBS Bank

# Get exchange rates from Bank of Taiwan
bot_rates = query_bot_rates()
print(bot_rates)

# Get exchange rates from DBS Bank
dbs_rates = query_dbs_rates()
print(dbs_rates)

Command-Line Interface

You can also use twrate directly from the command line:

# Query exchange rates for USD from all supported banks
twrate USD

Example output:

Exchange          Spot Buy    Spot Sell    Cash Buy    Cash Sell
--------------  ----------  -----------  ----------  -----------
BANK_OF_TAIWAN      30.095       30.245      29.77        30.44
DBS                 30.076       30.279      29.863       30.47
SINOPAC             30.092       30.203      29.892       30.403
ESUN                30.1         30.2        29.85        30.4

Rate Information

The Rate object provides the following information:

  • exchange: The bank code (e.g., "BOT" for Bank of Taiwan, "DBS" for DBS Bank)
  • source: The source currency code
  • target: The target currency code (always "TWD")
  • spot_buy: The bank's buying rate for spot transactions
  • spot_sell: The bank's selling rate for spot transactions
  • cash_buy: The bank's buying rate for cash transactions
  • cash_sell: The bank's selling rate for cash transactions
  • spot_mid: A calculated property that returns the mid-rate between spot buy and sell

License

See the LICENSE file for details.

Contributing

Contributions are welcome! Currently, the package supports Bank of Taiwan and DBS Bank, but you can help extend the functionality to cover more Taiwanese banks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twrate-0.1.4-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file twrate-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: twrate-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for twrate-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 82850cf305b96c220196523676b7284983ac6709a62f65d02259f9a6b0edf23a
MD5 c1484cfa7b7e6bc0a88068bae8a3e069
BLAKE2b-256 d3dffe228af9a2f88e4ce07a56028502258324186a71563842f158d394336125

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page