Giter VIP home page Giter VIP logo

financial-data's Introduction

financial-data

Intraday financial data files for backtesting or analysis. Currently this includes minute bars for:

  • S&P 500 from 2010-2018 in USD (SPXUSD) (from Histdata)
  • NIKKEI 225 from 2010-2018 in JPY (JPXJPY) (from Histdata)
  • DAX 30 from 2010-2018 in EUR (GRXEUR) (from Histdata)
  • EUROSTOXX 50 from 2010-2018 in EUR (ETXEUR) (from Histdata)
  • Currencies pairs 2005-2020: AUD_JPY, AUD_USD, EUR_USD, GBP_USD, USD_CAD (from Oanda)
  • Cryptocurrency: BTC_USD (2012-2018) (from Bitstamp)
  • Cryptocurrency: BTC_EUR (2018), ETH_EUR (2018) (from Kraken)
  • Others 2005-2020: AU200, CORN, DE10YB, FR40, JP225, NAS100, NATGAS, NL25, SOYBN, SPX500, SUGAR, UK10YB, US2000, USB10Y, WHEAT, WTICO, XAU (from Oanda)

This package will parse the CSV files and return them as a Pandas DataFrame.

Pull requests welcome.

Install

You can check out the repo with git or install it and all the data with pip:

pip3 install https://github.com/FutureSharks/financial-data/archive/master.zip

Data file path structure

data/<type>/<provider>/<instrument>

For example, data/stocks/histdata/sp500/DAT_ASCII_SPXUSD_M1_2010.csv is stock data for the S&P 500 index from the histdata provider.

Examples

BTC

import pyfinancialdata
data = pyfinancialdata.get(provider='bitstamp', instrument='BTC_USD', year=2017)
data.tail(3)
                     open      high       low     close     price
date
2017-12-31 23:57:00  13908.73  13913.26  13874.99  13913.26  13913.26
2017-12-31 23:58:00  13913.26  13953.83  13884.69  13953.77  13953.77
2017-12-31 23:59:00  13913.28  13913.28  13867.18  13880.00  13880.00

S&P 500

import pyfinancialdata
data = pyfinancialdata.get(provider='histdata', instrument='SPXUSD', year=2017)
data.tail(3)
                        open     high      low    close    price
date
2017-12-29 16:55:00  2668.75  2668.75  2668.00  2668.25  2668.25
2017-12-29 16:57:00  2667.75  2668.50  2667.75  2668.00  2668.00
2017-12-29 16:58:00  2668.25  2668.50  2667.75  2668.50  2668.50

EUR/USD

import pyfinancialdata
data = pyfinancialdata.get(provider='oanda', instrument='EUR_USD', year=2017)
data.tail(3)
                       close     high      low     open  volume    price
date
2017-12-29 21:57:00  1.20045  1.20071  1.20004  1.20018      50  1.20045
2017-12-29 21:58:00  1.20041  1.20041  1.20041  1.20041       1  1.20041
2017-12-29 21:59:00  1.20039  1.20039  1.19970  1.20036      14  1.20039

Optional time grouping for longer timeframes

For details see the Pandas Grouper documentation.

1 hour bars:

import pyfinancialdata
data = pyfinancialdata.get(provider='oanda', instrument='EUR_USD', year=2017, time_group='60min')
data.tail(3)
                       close     high      low     open    price
date
2017-12-29 19:00:00  1.20093  1.20142  1.20072  1.20140  1.20093
2017-12-29 20:00:00  1.19982  1.20108  1.19976  1.20098  1.19982
2017-12-29 21:00:00  1.20039  1.20071  1.19922  1.19984  1.20039

Or 1 day bars for multiple years:

import pyfinancialdata
data = pyfinancialdata.get_multi_year(provider='oanda', instrument='EUR_USD', years=[2014, 2015, 2016, 2017], time_group='1d')
data.head(3)
              close     high      low     open    price
date
2014-01-01  1.37642  1.37738  1.37424  1.37534  1.37642
2014-01-02  1.36653  1.37756  1.36296  1.37644  1.36653
2014-01-03  1.35888  1.36720  1.35825  1.36654  1.35888

financial-data's People

Contributors

futuresharks 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.