Giter Club home page Giter Club logo

fixerio's Introduction

A Python client for Fixer.io

Build Status Coverage Status Supports Wheel format Latest PyPI version Documentation Status Requirements Status

Fixer.io is a free JSON API for current and historical foreign exchange rates published by the European Central Bank.

The rates are updated daily around 3PM CET.

Installation

Install fixerio with:

pip install fixerio

Or with:

easy_install fixerio

Or you can get the source from GitHub at https://github.com/amatellanes/fixerio.

Usage

Get the latest foreign exchange reference rates in JSON format.

>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.latest()
'''
 {u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'AUD': 1.5483,
  u'BGN': 1.9558,
  u'BRL': 4.031,
  u'CAD': 1.456,
  u'CHF': 1.1068,
  u'CNY': 7.3281,
  u'CZK': 27.028,
  u'DKK': 7.4367,
  u'GBP': 0.76245,
  u'HKD': 8.6735,
  u'HRK': 7.4905,
  u'HUF': 314.21,
  u'IDR': 15157.25,
  u'ILS': 4.2938,
  u'INR': 74.867,
  u'JPY': 122.46,
  u'KRW': 1316.98,
  u'MXN': 20.6611,
  u'MYR': 4.5554,
  u'NOK': 9.282,
  u'NZD': 1.6586,
  u'PHP': 52.096,
  u'PLN': 4.3912,
  u'RON': 4.5034,
  u'RUB': 73.7516,
  u'SEK': 9.2673,
  u'SGD': 1.536,
  u'THB': 39.851,
  u'TRY': 3.2928,
  u'USD': 1.1168,
  u'ZAR': 17.4504}}
'''

Get historical rates for any day since 1999.

>>> import datetime
>>> from fixerio import Fixerio

>>> today = datetime.date.today()
>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.historical_rates(today)
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'AUD': 1.5483,
  u'BGN': 1.9558,
  u'BRL': 4.031,
  u'CAD': 1.456,
  u'CHF': 1.1068,
  u'CNY': 7.3281,
  u'CZK': 27.028,
  u'DKK': 7.4367,
  u'GBP': 0.76245,
  u'HKD': 8.6735,
  u'HRK': 7.4905,
  u'HUF': 314.21,
  u'IDR': 15157.25,
  u'ILS': 4.2938,
  u'INR': 74.867,
  u'JPY': 122.46,
  u'KRW': 1316.98,
  u'MXN': 20.6611,
  u'MYR': 4.5554,
  u'NOK': 9.282,
  u'NZD': 1.6586,
  u'PHP': 52.096,
  u'PLN': 4.3912,
  u'RON': 4.5034,
  u'RUB': 73.7516,
  u'SEK': 9.2673,
  u'SGD': 1.536,
  u'THB': 39.851,
  u'TRY': 3.2928,
  u'USD': 1.1168,
  u'ZAR': 17.4504}}
'''

Request specific exchange rates by setting the symbols parameter.

>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY', symbols=['USD', 'GBP'])
>>> fxrio.latest()
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'GBP': 0.76245, u'USD': 1.1168}}
'''
>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.latest(symbols=['USD', 'GBP'])
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'GBP': 0.76245, u'USD': 1.1168}}
'''

All exceptions that fixerio explicitly raises are fixerio.exceptions.FixerioException.

fixerio's People

Contributors

amatellanes avatar waffle-iron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.