forex-python Documentation

Similar documents
INFORMATION FROM EUROPEAN UNION INSTITUTIONS, BODIES, OFFICES AND AGENCIES

Official Journal C 313

Annual Market Review Portfolio Management

Official Journal C 373

2017 Annual Market Review

Risk-free interest rate term structures. Report on the. Calculation of the UFR for 2019

Official Journal C 398

Exchange rate statistics. Statistical Supplement to the Monthly Report 5 JULY 2010 SEPTEMBER OCTOBER NOVEMBER AUGUST

Official Journal C 248

Official Journal C 270

Official Journal C 406

Income. Income Amounts. Income Segments. As part of the Core survey, GWI asks all respondents about their annual household income.

BLOOMBERG DOLLAR INDEX 2018 REBALANCE

Listing of bonds. at the Stuttgart Stock Exchange

2016 Annual Market Review

Official Journal C 245

Official Journal C 300

Official Journal C 270

2017 Annual Market Review

Loewenstrasse 1 Cours de Rive Zurich 1204 Genève

Ground Rules. FTSE Russell Fixed Income Currency Hedging Methodology v1.0

Ground Rules. Russell Currency Hedging Methodology v1.1

PIMCO Global Advantage Government Bond Index. Index Specification

Alpha-Beta Series: Currency ETFs. November 10, 2011, 2pm EDT

Official Journal C 308

Interest Rates for Deposit Products

New Contract Submission : Rule 40.2(a) Certification of Thomson Reuters (SEF) LLC Cross-Currency Non-Deliverable Forwards

WECC Global PCB Production Report For 2016

SKAGEN Tellus Status Report December 2015

Policy Updates Page 1 of 181. This page shows important changes that were made to the PayPal service, its User Agreement, or other policies.

GEF-6 REPLENISHMENT: FINANCING FRAMEWORK (PREPARED BY THE TRUSTEE)

SKAGEN Tellus Status Report February 2017

Incoming International Wire Standard Settlement Instructions

ILLUSTRATIVE SCENARIOS FOR GEF-5 CONTRIBUTIONS

Payment Transaction BUSINESS BANKING

Quarterly Market Review. Fourth Quarter 2017

WIRE TRANSFER GUIDE RECEIVING WIRE TRANSFERS

SKAGEN Tellus Statusrapport maj 2017

Effective for transactions prior to 30 May 2011 Commission rates

Ground Rules. FTSE Currency Hedging Methodology v1.2

PAYMENT TRANSACTION. Your payment transaction information

STANDARD TARIFF SCALE STOCK, ADR, ETF

Financial Institutions Payment Services Cut-off times

SCALE OF CONTRIBUTIONS

Rates and Charges. Effective from 19 May 2017

SKAGEN Tellus Statusrapport april 2017

2015 FUZZY DAY CONFERENCE Facts that are Not Facts. The US dollar Safe Haven Myth and the United States Hedge Fund.

Cboe Europe Index File Specification

PRESS CONFERENCE 2 November 2012

Information and Notices

Finding Quality Income

Official Journal C 258

Interest rate yield shocks absolute changes (basis points)

Quarterly Market Review. Fourth Quarter 2017

Welcome to DCC. An Introduction to Currency Select

IN THE MATTER OF STRONGHOLD INSURANCE COMPANY LIMITED ("STRONGHOLD") (ALSO REFERRED TO AS THE "SCHEME COMPANY") AND ITS SCHEME CREDITORS

FOREIGN SOVEREIGN BONDS AND NOTES

Market Briefing: Currencies

CONTENTS. Vol 28 No 11 November In summary

NEUBERGER BERMAN INVESTMENT FUNDS PLC

Payments via Unitel & Corporate Netbank Request for Transfer Customer tariff effective from 1 October 2017

Payments via Unitel & Corporate Netbank Request for Transfer Customer tariff effective from 1 January 2017

STANDARD TARIFF SCALE

Media Reinforcement in International Financial Markets

SOLA 5 Message Changes Guidelines

Voya Emerging Markets Local Currency Debt Fund Portfolio Holdings as of June 29, 2018 (Unaudited)

Citi Dublin Funds Transfer Cut-off Times

Margin Service API - Developer Guide

An Overview of Opportunities Within China s Interbank Bond Market

EXETER FINANCIAL. Quarterly Market Review

Quarterly Market Review. Third Quarter 2017

Investors Cornerstone I Portfolio

IG Mackenzie Global Inflation-Linked Pool

Alto Moderate Aggressive Canada Focus Portfolio

Investors Retirement Growth Portfolio

Framework for the euro foreign exchange reference rates

1 Transfers. 1, minimum EUR 25.00* EUR *on bank business days. 1, minimum EUR 25.00* 0.5, minimum EUR EUR 10.00

OPTIMTRADER COMMISSIONS

SKAGEN Tellus Status Report April 2016

Investors Cornerstone I Portfolio

An Overview of Opportunities Within China s Interbank Bond Market

1. Deposit products Current accounts 01 Attorney, Notary escrow account 01 Deposit accounts in CZK 02 Deposit accounts in foreign currency 02

FOREIGN SOVEREIGN BONDS AND NOTES

Market Review First Quarter 2017

Intragroup Margin Exemption Disclosure Under The European Market Infrastructure Regulation

Classes of OTC derivatives that LCH Limited has been authorised to clear as notified to ESMA under Regulation 648/2012

Quarterly Market Review. Third Quarter 2017

Renaissance Global Focus Currency Neutral Fund. Annual Financial Statements for the financial year ended August 31, 2018

Investors Global Fixed Income Flex Portfolio

MANAGEMENT S RESPONSIBILITY FOR FINANCIAL REPORTING

CURRENCY INDICES FTSE PUBLICATIONS. Q Currency Markets Review

iprofile TM Canadian Equity Class

Quarterly Report January 31, MFS Emerging Markets Debt Local Currency Fund

Terms and conditions - International payments - Personal Clients

8. Country names, codes and currencies

Exchanges Index Monthly Analysis

Terms and conditions - International payments - Corporate Clients

Exchanges Index Monthly Analysis

ADDITIONAL SERVICES ACCOUNT CHARGES & PROCESSING TIMES. Your account charges and processing times explained

Adverse scenario for the European Insurance and Occupational Pensions Authority s EU-wide insurance stress test in 2018

Transcription:

forex-python Documentation Release 0.3.0 MicroPyramid Informatics Pvt. Ltd. Jan 02, 2018

Contents 1 Features: 3 1.1 Installation................................................ 3 1.2 Usage Examples:............................................. 4 1.3 currency source.............................................. 7 i

ii

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

2 Contents

CHAPTER 1 Features: List all currency rates. BitCoin price for all curuncies. Converting amount to BitCoins. Get historical rates for any day since 1999. Conversion rate for one currency(ex; USD to INR). Convert amount from one currency to other.( USD 10$ to INR) Currency Symbols Currency names Contents: 1.1 Installation The recommended way to install the Debug Toolbar is via pip: $ pip install forex-python Install from development branch: $ pip install git+https://github.com/micropyramid/forex-python.git Note: forex-python uses requests to make API calls. 3

1.2 Usage Examples: 1.2.1 Currency Rates 1. list all latest currency rates for USD :: >>> from forex_python.converter import CurrencyRates >>> c = CurrencyRates() >>> 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:: datetime.datetime(2014, 5, 23, 18, 36, 28, 151012) >>> 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') # same as get_rate('usd', 'INR') 67.473 # return type float 4. Get conversion rate from USD to INR on 2014-05-23:: datetime.datetime(2014, 5, 23, 18, 36, 28, 151012) >>> 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) # convert('usd', 'INR', 10) 674.73 6. Convert amount from USD to INR based on 2014-05-23 exchange rates:: datetime.datetime(2014, 5, 23, 18, 36, 28, 151012) >>> c.convert('usd', 'INR', 10, date_obj) 585.09 7. Force use of Decimal:: 4 Chapter 1. Features:

>>> from forex_python.converter import CurrencyRates >>> c = CurrencyRates(force_decimal=True) >>> c.convert('usd', 'INR', Decimal('10.45')) Decimal('705.09') >>> c.convert('usd', 'INR', 10) DecimalFloatMismatchError: convert requires amount parameter is of type Decimal when use_decimal=true 8. Detect use of Decimal:: >>> from forex_python.converter import CurrencyRates >>> c = CurrencyRates() >>> c.convert('usd', 'INR', Decimal('10.45')) Decimal('705.09') >>> c.convert('usd', 'INR', 10) 674.73 1.2.2 Bitcoin Prices: 1. Get latest price of one Bitcoin:: >>> from forex_python.bitcoin import BtcConverter >>> b = BtcConverter() # add "force_decimal=true" parmeter to get Decimal rates >>> 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:: datetime.datetime(2016, 5, 18, 19, 39, 36, 815417) >>> 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') # convert_to_btc(5000, 'USD') 9.36345369116708 4. Convert Amount to bitcoins based on previous date prices:: datetime.datetime(2016, 5, 18, 19, 39, 36, 815417) >>> 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') # convert_btc_to_cur(1.25, 'USD') 668.1012499999999 6. Convert Bitcoins to valid currency amount based on previous date price:: 1.2. Usage Examples: 5

datetime.datetime(2016, 5, 18, 19, 39, 36, 815417) >>> b.convert_btc_to_cur_on(1.25, 'EUR', date_obj) 504.23625000000004 7. Get list of prices list for given date range:: >>> start_date 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) # 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. Force use of Decimal:: >>> from forex_python.bitcoin import BtcConverter >>> b = BtcConverter(force_decimal=True) >>> b.get_latest_price('eur') # you can directly call get_latest_price('eur ') Decimal('942.245000000000004547') # return type Decimal 9. Get Bitcoin symbol:: >>> print(b.get_symbol()) # get_btc_symbol() 1.2.3 Currency Symbols & Codes 1. Get Currency symbol Using currency code:: >>> from forex_python.converter import CurrencyCodes >>> c = CurrencyCodes() >>> c.get_symbol('gbp') u'\xa3' >>> print c.get_symbol('gbp') >>> print c.get_symbol('eur') C 2. Get Currency Name using currency code:: >>> c.get_currency_name('eur') u'european Euro' >>> c.get_currency_name('inr') u'indian rupee' 6 Chapter 1. Features:

1.3 currency source 1.3.1 fixer.io Fixer.io is a free API for current and historical foreign exchange rates published by European Central Bank. The rates are updated daily 3PM CET. 1.3.2 List of Supported Currency codes. Updated On 2016-05-22 EUR - Euro Member Countries IDR - Indonesia Rupiah BGN - Bulgaria Lev ILS - Israel Shekel GBP - United Kingdom Pound DKK - Denmark Krone CAD - Canada Dollar JPY - Japan Yen HUF - Hungary Forint RON - Romania New Leu MYR - Malaysia Ringgit SEK - Sweden Krona SGD - Singapore Dollar HKD - Hong Kong Dollar AUD - Australia Dollar CHF - Switzerland Franc KRW - Korea (South) Won CNY - China Yuan Renminbi TRY - Turkey Lira HRK - Croatia Kuna NZD - New Zealand Dollar THB - Thailand Baht USD - United States Dollar NOK - Norway Krone RUB - Russia Ruble INR - India Rupee MXN - Mexico Peso CZK - Czech Republic Koruna BRL - Brazil Real PLN - Poland Zloty PHP - Philippines Peso ZAR - South Africa Rand 1.3.3 Bitcoin Prices: Bitcoin prices calculated every minute from CoinDesk API. 1.3. currency source 7