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 (玉山銀行)
- Line Bank (LINE Bank)
- HSBC Bank Taiwan (匯豐銀行)
Installation
pip install twrate
Usage
Basic Usage
from rich import print
from twrate import Exchange
from twrate import fetch_rates
for exchange in Exchange:
print(fetch_rates(exchange))
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 codetarget: The target currency code (always "TWD")spot_buy: The bank's buying rate for spot transactionsspot_sell: The bank's selling rate for spot transactionscash_buy: The bank's buying rate for cash transactionscash_sell: The bank's selling rate for cash transactionsspot_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, DBS Bank, Sinopac Bank, E.SUN Bank, Line Bank, and HSBC Bank, but you can help extend the functionality to cover more Taiwanese banks.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twrate-0.2.0-py3-none-any.whl.
File metadata
- Download URL: twrate-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bfa6961bcaa3c13f6525d838585fc692feacd9665b3f20f018fada03b2a8c89
|
|
| MD5 |
9cd71eda9f254b5be0e26caa3d339372
|
|
| BLAKE2b-256 |
4cbd93f65ac5dfdb77321f0d9406dab82314ba6e417a31009a24caab75a52a7f
|