Git Product home page Git Product logo

create_stock_portfolio's Introduction

Create stock portfolio using machine learning

Overview:

Notebook in this repo will create various technical analysis indicators using open source "pandas_ta" package and use those features to create a machine learning model to predict rate of return over the next couple of days. This is a regression problem.

Rate of return is defined as $r_{(k,t)} = \frac{C_{(k,t+2)} - C_{(k,t+1)}}{C_{(k,t+1)}} $

Where ${C_{(k,t)}}$ represents closing pricing of stock 'k' at time 't'

Business use case:

Creating a portfolio of stocks that could give better returns with less volatility is the main requirement of portfolio creation. Some stocks could give high returns with even higher draw downs. Having such high volatile stocks in a portfolio could lead to high risk and higher margin requirements.

Traders use fundamental and technical analysis to identify the stocks that outperform the index using various valuation and quantiative techniques. This ML model attempts to predict rate of return using Open, High, Low and Close (OHLC) data.

Dataset:

Dataset was sourced from a Kaggle competiton - "JPX Tokyo Stock Exchange Prediction". This dataset consists of

  1. stock_prices.csv -> Historical stock data prices (non-confidential)
  2. options.csv -> Options based data
  3. secondary_stock_prices.csv -> Historical prices of stocks that are less liquid
  4. trades.csv -> Trading volumes from previous business week
  5. financials.csv -> Quarterly earnings reports
  6. stock_list.csv -> General information about each stock

For this initial version of the notebook, only "stock_prices.csv" is used.

Product/Services included in the project

  1. Data science platform
  2. Model catalog

Pre-requisites to run the notebook

Notebook uses two conda pacakages:

  1. "financialservices_p37_gpu_v1"
  2. "generalml_p37_cpu_v1"

Install these two packages from environment explorer before running the notebook.

Repo description

This repo has 3 folders.

  1. build_model - This folder hosts the notebook with code for feature engineering and model building

  2. data- Copy the data from Kaggle source to "data/train_files" folder.

python notebook with create 5 parquet files one for each year of the data from 2017 to 2021.

  1. artifacts - All files creating during cataloging the model are saved here

How to run the notebook?

  1. Download the Kaggle competition files from Kaggle and place the files in "data/train_files"
  2. Access the notebook from "build_model" folder
  3. For feature engineering steps in the code - use "financialservices_p37_gpu_v1 conda environment
  4. For model building steps in the code use -"generalml_p37_cpu_v1"

create_stock_portfolio's People

Contributors

chandrak1907 avatar

Watchers

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