GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Zahgon/forex-python: Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

138 Commits
138 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
forex_python
forex_python
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
setup.py
setup.py
 
 

Repository files navigation

forex-python

travis-ci coveralls Code Health pypi

Forex Python is a free library for foreign exchange rates and currency conversion, supporting Python 3.6 and above.

Note: Install the latest version (forex-python>=1.6) to avoid RatesNotAvailableError.

Features

  • List all currency rates
  • Bitcoin price for all currencies
  • Convert amounts to and from Bitcoin
  • Get historical rates (since 1999)
  • Currency conversion (e.g., USD to INR)
  • Currency symbols and names

Currency Source

theratesapi.com provides current and historical foreign exchange rates published by the European Central Bank. Rates are updated daily at 3PM CET.

Bitcoin Price Source

Bitcoin prices are updated every minute. For more information, visit CoinDesk.

Installation

Install via pip:

pip install forex-python

Or clone the repository and install manually:

git clone https://github.com/MicroPyramid/forex-python.git
cd forex-python
python3 setup.py install

Usage Examples

Initialize the class:

from forex_python.converter import CurrencyRates
c = CurrencyRates()

List all latest currency rates for "USD":

c.get_rates('USD')
# Example output: {'INR': 83.12, 'EUR': 0.92, ...}

Get conversion rate from USD to INR:

c.get_rate('USD', 'INR')
# Example output: 83.12

Convert amount from USD to INR:

c.convert('USD', 'INR', 10)
# Example output: 831.2

Force use of Decimal:

from decimal import Decimal
c = CurrencyRates(force_decimal=True)
c.convert('USD', 'INR', Decimal('10.45'))
# Example output: 868.75

Get latest Bitcoin price:

from forex_python.bitcoin import BtcConverter
b = BtcConverter()
b.get_latest_price('USD')
# Example output: 67000.0

Convert amount to Bitcoins:

b.convert_to_btc(400, 'USD')
# Example output: 0.00597

Get currency symbol using currency code:

from forex_python.converter import CurrencyCodes
codes = CurrencyCodes()
codes.get_symbol('GBP')
# Example output: '£'

For complete documentation, see the forex-python docs.


Support & Feedback

  • Found a bug? Please open a GitHub issue.
  • Need a new feature or custom development? Contact us here.
  • Visit our Python Development Services page for more information.

About

Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io

forex-python.readthedocs.io/en/latest/usage.html

Resources

Readme
License
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.