Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ forex-python
[![license](https://img.shields.io/github/license/MicroPyramid/forex-python.svg?maxAge=2592000)](https://pypi.python.org/pypi/forex-python)
[![Code Health](https://landscape.io/github/MicroPyramid/forex-python/master/landscape.svg?style=plastic)](https://landscape.io/github/MicroPyramid/forex-python/master)

Free Foreign exchange rates and currency conversion.
Free Foreign exchange rates, bitcoin prices and currency conversion.

Features:
---------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.2.3'
version = u'0.3.0'
# The full version, including alpha/beta/rc tags.
release = u'0.2.3'
release = u'0.3.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/currencysource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ List of Supported Currency codes.
|PLN - Poland Zloty
|PHP - Philippines Peso
|ZAR - South Africa Rand

Bitcoin Prices:
---------------
Bitcoin prices calculated every minute from CoinDesk API.
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
forex-python
============

Free Foreign exchange rates and currency conversion.
Free Foreign exchange rates, bitcoin prices and currency conversion.

Features:
---------
Expand Down
24 changes: 12 additions & 12 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ Currency Rates
1. list all latest currency rates for "USD"::
>>> from forex_python.converter import CurrencyRates
>>> c = CurrencyRates()
>>> c.get_rates('USD')
>>> c.get_rates('USD') # you can directly call get_rates('USD')
{u'IDR': 13625.0, u'BGN': 1.7433, u'ILS': 3.8794, u'GBP': 0.68641, u'DKK': 6.6289, u'CAD': 1.3106, u'JPY': 110.36, u'HUF': 282.36, u'RON': 4.0162, u'MYR': 4.081, u'SEK': 8.3419, u'SGD': 1.3815, u'HKD': 7.7673, u'AUD': 1.3833, u'CHF': 0.99144, u'KRW': 1187.3, u'CNY': 6.5475, u'TRY': 2.9839, u'HRK': 6.6731, u'NZD': 1.4777, u'THB': 35.73, u'EUR': 0.89135, u'NOK': 8.3212, u'RUB': 66.774, u'INR': 67.473, u'MXN': 18.41, u'CZK': 24.089, u'BRL': 3.5473, u'PLN': 3.94, u'PHP': 46.775, u'ZAR': 15.747}

2. List all Currency rates for "USD" on 2012-09-05::
>>> date_obj
datetime.datetime(2014, 5, 23, 18, 36, 28, 151012)
>>> c.get_rates('USD', date_obj)
>>> c.get_rates('USD', date_obj) # same as get_rates('USD', date_obj)
{u'IDR': 11612.0, u'BGN': 1.4349, u'ILS': 3.4861, u'GBP': 0.5938, u'DKK': 5.4762, u'CAD': 1.0901, u'JPY': 101.92, u'HUF': 222.66, u'RON': 3.2359, u'MYR': 3.2101, u'EUR': 0.73368, u'SEK': 6.6471, u'SGD': 1.2527, u'HKD': 7.7519, u'AUD': 1.0845, u'CHF': 0.89582, u'KRW': 1024.9, u'CNY': 6.2377, u'TRY': 2.0888, u'HRK': 5.5751, u'NZD': 1.1707, u'THB': 32.6, u'LTL': 2.5332, u'NOK': 5.9652, u'RUB': 34.122, u'INR': 58.509, u'MXN': 12.893, u'CZK': 20.131, u'BRL': 2.2178, u'PLN': 3.0544, u'PHP': 43.721, u'ZAR': 10.356}

3. Get conversion rate from USD to INR::
>>> c.get_rate('USD', 'INR')
>>> c.get_rate('USD', 'INR') # same as get_rate('USD', 'INR')
67.473 # return type float

4. Get conversion rate from USD to INR on 2014-05-23::
>>> date_obj
datetime.datetime(2014, 5, 23, 18, 36, 28, 151012)
>>> c.get_rate('USD', 'INR', date_obj)
>>> c.get_rate('USD', 'INR', date_obj) # get_rate('USD', 'INR', date_obj)
58.509

5. Convert amount from USD to INR::
>>> c.convert('USD', 'INR', 10)
>>> c.convert('USD', 'INR', 10) # convert('USD', 'INR', 10)
674.73

6. Convert amount from USD to INR based on 2014-05-23 exchange rates::
Expand All @@ -40,27 +40,27 @@ Bitcoin Prices:
1. Get latest price of one Bitcoin::
>>> from forex_python.bitcoin import BtcConverter
>>> b = BtcConverter()
>>> b.get_latest_price('EUR')
>>> b.get_latest_price('EUR') # you can directly call get_latest_price('EUR')
476.5225 # return type float

2. Get price of Bitcoin based on prevois date::
>>> date_obj
datetime.datetime(2016, 5, 18, 19, 39, 36, 815417)
>>> b.get_previous_price('USD', date_obj)
>>> b.get_previous_price('USD', date_obj) # get_previous_price('USD', date_obj)
453.378

3. Convert Amout to bitcoins::
>>> b.convert_to_btc(5000, 'USD')
>>> b.convert_to_btc(5000, 'USD') # convert_to_btc(5000, 'USD')
9.36345369116708

4. Convert Amount to bitcoins based on previous date prices::
>>> date_obj
datetime.datetime(2016, 5, 18, 19, 39, 36, 815417)
>>> b.convert_to_btc_on(5000, 'USD', date_obj)
>>> b.convert_to_btc_on(5000, 'USD', date_obj) # convert_to_btc_on(5000, 'USD', date_obj)
11.028325150316071

5. Convert Bitcoins to valid currency amount based on lates price::
>>> b.convert_btc_to_cur(1.25, 'USD')
>>> b.convert_btc_to_cur(1.25, 'USD') # convert_btc_to_cur(1.25, 'USD')
668.1012499999999

6. Convert Bitcoins to valid currency amount based on previous date price::
Expand All @@ -74,11 +74,11 @@ Bitcoin Prices:
datetime.datetime(2016, 5, 18, 19, 39, 36, 815417)
>>> end_date
datetime.datetime(2016, 5, 23, 19, 39, 36, 815417)
>>> b.get_previous_price_list('INR', start_date, end_date)
>>> b.get_previous_price_list('INR', start_date, end_date) # get_previous_price_list('INR', start_date, end_date)
{u'2016-05-19': 29371.7579, u'2016-05-18': 30402.3169, u'2016-05-22': 29586.3631, u'2016-05-23': 29925.3272, u'2016-05-20': 29864.0256, u'2016-05-21': 29884.7449}

8. Get Bitcoin symbol::
>>> print(b.get_symbol())
>>> print(b.get_symbol()) # get_btc_symbol()
฿

Currency Symbols & Codes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from setuptools import setup, find_packages

VERSION = '0.2.3'
VERSION = '0.3.0'

with io.open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding='utf-8', errors='ignore') as readme:
LONG_DESCRIPTION = readme.read()
Expand Down