Coder Social home page Coder Social logo

dsignals's Introduction

dsignals

Utilities and information for the signals.numer.ai tournament.

Working with eodhistoricaldata.com

eodhistoricaldata.com provides excellent ticker coverage (including delisted Signals tickers) for historical prices. While a free tier is available, I recommend the "EOD Historical Data - All World" package at $19.99/mo to make the most of dsignals.

dsignals solves the two main challenges with using eodhistoricaldata in Signals:

  • build_eodhd_map.py generates the ticker mappings from bloomberg_ticker.
  • download_quotes.py provides comprehensive global coverage by downloading from eodhistoricaldata on its supported stock exchanges, and from yahoo for Japan, Czech Republic and New Zealand.

Generate the ticker map

To generate the up-to-date ticker mappings for the entire Signals universe (live and historical), run:

python build_eodhd_map.py

Step 1, this will download and merge tickers from three sources:

  • live_universe (a small 40 KB file with the ~5,340 tickers for the current round)
  • historical_targets (a large 150 MB file, and extract ~13,370 unique historical tickers)
  • the bloomberg to yahoo map courtesy of Liam @ numerai

Step 2, tickers are mapped, and overrides in db/eodhd-overrides.csv are applied.

Step 3, db/eodhd-map.csv is generated in the following format:

bloomberg_ticker yahoo data_provider signals_ticker
MONY LN MONY.L eodhd MONY.LSE
ANIM3 BZ ANIM3.SA eodhd ANIM3.SA
CAO US eodhd CAO.US
7013 JP 7013.T yahoo 7013.T

Download historical data

There are two ways to specify your eodhistoricaldata API token for use by download_quotes.py:

  • set "NUMERAI_EODHD_TOKEN" environment variable:

    linux: export NUMERAI_EODHD_TOKEN="your_eodhd_api_key"

    windows: set NUMERAI_EODHD_TOKEN="your_eodhd_api_key"

  • or, edit download_quotes.py and replace "your_eodhd_api_key" with your API token.

To start the download, run:

python download_quotes.py

This will download price data from either eodhistoricaldata or yahoo, and save each ticker to a separate pickle file in the data/ticker_bin folder. As of February 2022, this yields price data for 11,200+ tickers.

Read the downloaded quotes

Example code to receive a pandas DataFrame for a given bloomberg_ticker:

from download_quotes import read_quotes
quotes = read_quotes("MSFT US")

Alternatively, copy the make_filename_safe() function to your codefile to generate the name of the pickle file for a given ticker, and read the pickle file directly with pd.read_pickle(filename).

dsignals's People

Contributors

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