Code Monkey home page Code Monkey logo

securitiesdb's Introduction

securitiesdb

This project populates a local Postgres database with security symbols, un-adjusted EOD data, splits, dividends, company fundamentals, and options data. Economic indicators - employment and labor statistics, inflation rates, interest rates, exchange rates, imports/exports, domestic production stats, treasury rates, debt, tax revenues, etc. - are also available.

Michael Halls-Moore, the guy behind quantstart.com, described and popularized the idea of a securities master database in his two excellent articles - (1) Securities Master Databases for Algorithmic Trading and (2) Securities Master Database with MySQL and Python. This project is an implementation of his idea of a securities master database.

Getting Started

  1. git clone this project

    git clone https://github.com/davidkellis/securitiesdb.git
    
  2. [Optional] If you want any data from Quandl.com, create an account at Quandl.com and configure project with your Quandl API key and version information:

    1. Register for an account at Quandl.com
    2. Look up your API key:
      1. Go to Account Settings at https://www.quandl.com/account
      2. Click the API Key link in the navigation bar on the left-hand side of the Account Settings page
      3. Note the API Key and version information
    3. Create a config/application.yml file by copying the config/application.sample.yml file into config/application.yml
    4. Open config/application.yml and change the lines that read:
      quandl:
         api_key: abc123
         api_version: "2015-04-09"
      
      so that they api_key and api_version match the values you noted from Quandl.com
    5. Save your changes to config/application.yml
  3. [Optional] If you want any historical options data from OptionData.net:

    1. Place an order for data
    2. Download the zipped data sets from the link they send you by e-mail
    3. Copy the downloaded zip files into the data/ directory within the securitiesdb project directory
  4. Install Postgres libraries so that step 7 can install the pg gem (this is only applicable if using MRI, as JRuby doesn't need the pg gem).

  5. Install Ruby or JRuby

    rbenv install 2.2.3
    

    OR

    rbenv install jruby-9.0.4.0
    

    Set the JRUBY_OPTS environment variable in your ~/.bash_profile to a few GB of memory:

    export JRUBY_OPTS=-J-Xmx8g
    
  6. Install bundler (if not already installed)

    gem install bundler
    
  7. bundle install

    bundle install
    
  8. Change database connection string in application.yml

  9. Setup Database

    script/setup_db
    
  10. Import data

Import all data

script/import --all

Import all stock symbols, EOD prices, fundamentals

script/import --csi --quandl-eod --quandl-fundamentals

Import all stock symbols and options

script/import --csi -o data/options2006.zip

Reset Database

script/reset_db

securitiesdb's People

Watchers

James Cloos avatar WealthCity 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.