Giter Site home page Giter Site logo

anotherkamila / currency-exchange-rates Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 659 KB

Script to retrieve currency exchange rates and put them in a CSV, plus the CSV with daily data

License: The Unlicense

Python 91.92% Shell 8.08%
currency-exchange-rates csv daily-data currencies

currency-exchange-rates's Introduction

currency-exchange-rates

Script to retrieve currency exchange rates and put them in a CSV, plus a CSV with data added every day. Attempts to have a lot of currencies.

Uses the Yahoo Finance API (which has a lot of currencies) to retrieve current exchange rates and stick them in a CSV together with the date.

This repository will be updated once in a while to include daily data.

This should not break when the world changes and currencies appear or disappear -- the script will just retrieve whatever is available and correctly merge the new data with the old CSV. (Therefore the CSV file cannot be append-only. At least it is written atomically.)

Usage

  • rates.csv: Data that falls out of the script when it is run once a day (from 2017-01-10). Example thing to do with it:

    from datetime import date
    from currency_converter import CurrencyConverter  # https://pypi.python.org/pypi/CurrencyConverter/
    URL = 'https://raw.githubusercontent.com/AnotherKamila/currency-exchange-rates/master/rates.csv'
    cc = CurrencyConverter(URL, ref_currency='USD')
    print(cc.convert(10, 'EUR', 'CHF', date=date(2016, 12, 20)))  # prints 10.69
  • getrates.py: commandline tool to retrieve the data. Make sure to install the requirements (probably in a venv). See getrates.py --help.

  • cron.sh: If your venv is called venv and the requirements are installed, this will run getrates.py and commit the updated rates.csv.

All of this is best effort: I will not be responsible if your world-domination bot makes wrong decisions because of the data/script here.

License

I believe that the currency exchange rates are public domain, correct me if I am wrong.

I unlicense everything in this repository. But it would be nice if you linked to this repo when you use it.

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.