GithubHelp home page GithubHelp logo

dorienh / sp1500stockpicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomasrochefortb/sp1500stockpicker

0.0 0.0 0.0 447 KB

A machine learning approach to investment portfolio composition. The program analyzes the fundamentals of the listed companies on the S&P1500 in order to emit monthly buy signals.

License: GNU General Public License v3.0

Python 0.89% Jupyter Notebook 99.11%

sp1500stockpicker's Introduction

SP1500stockPicker

This project incorporates a random forest algorithm which can emit monthly buy signals from the fundamentals of the companies listed on the S&P1500.

Objective

The objective of this project is to beat the performance of the Standard & Poor 500, the most commonly used benchmark in the finance industry.

Getting Started

All the required code is found in the SP1500stockPicker.ipynb file. You can run it using Jupyter Notebook which comes with the Anaconda distribution which you can find at https://www.anaconda.com/distribution/#download-section. The code is running on Python 3.7.

The data used in the program was obtained from Bloomberg and Compustat. Both services are proprietary and therefore the data cannot be published online.

  • ratios_1990_2019.csv ( File containing all the financial ratios of the US companies, obtained with Compustat)
  • yield_1962_2019.csv (File containing all the monthly returns of the US companies, obtained with Bloomberg)
  • SP1500constituents.csv (File containing all the past and present constituents of the S&P 1500 index, obtained with Compustat)
  • ^GSPC.csv (File containing all the closing price of the S&P 500, obtained via Yahoo Finance)

Requirements

  • python== 3.7

  • scikit-learn==0.21.2

  • pandas==0.24.2

  • matplotlib==3.1.1

  • numpy==1.16.4

Running

The critical functions of the program (merging database and machine learning) use multiprocessing to accelerate the different task. The entire notebook takes about 2.5h to run on a 24 thread computer with 128gb RAM installed. Performance will therefore vary depending on your hardware.

In Jupyter, hit "Run All Cells" to execute the entire script. You will find intermediate steps after the data cleaning and feature selection to skip unecessary work for the CPU when changing components of the code.

Built With

Contributing

Feel free to reach out to me by email at [email protected] for suggestions or questions about the repo.

Authors

  • Thomas Rochefort-Beaudoin - Initial work

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details

Acknowledgments

  • Robert Normand, Teacher at Polytechnique Montréal and researcher at CIRANO Montréal, for his insights and help.

sp1500stockpicker's People

Contributors

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