Giter VIP home page Giter VIP logo

stock-price-prediction-with-optimization's Introduction

Stock price prediction with portfolio optimization.

Portfolio optimization is a process of allocating funds into financial assets with the goal of maximizing returns over risk. This research is our attempt at utilising machine learning methods to create an optimized portfolio that will perform well into the future. This was achieved by utilising 2 different Random Forest models to forecast stock prices, namely:

•Model 1 – uses technical indicator features.
•Model 2 – uses technical indicator features combined with sentiment features.

Having predicted the stock prices, we then calculate the relevant expected returns. From these we apply an optimisation technique, using a custom mean-variance loss function that optimises the returns over the portfolio risk. Each model repeats this process 500 times before proposing the best suited portfolio as per the results.

Authors

Built with

Packages used;
•numpy
•pandas
•sklearn
•torch
•SciPy
•seaborn
•os
•matplotlib.pyplot

Methods and concepts

•Principal Component Analysis.
•Random Forest Regression.
•Optimisation.

Relevant Technologies.

•R
•Python

Getting Started.

The data set used in this project can be accessed and imported directly into each model, from the folder. The data pre-processing for each model is done in its respective Jupyter notebook. The suggested order to view the Jupyter notebooks begins with:

• Model 1.
• Model 2.
• Graphs.

Pre requirements.

•PyTorch

Usage.

‘Model 1’ and ‘Model 2’ in the ‘Models’ folder, can be used to iteratively predict future stock prices and optimize each the 5-asset portfolio’s weights depending on the results. The dataset expected is a 2d DataFrame, with dates as rows and different metrics for stocks in columns. These can be used by simply running all cells in the notebook.
‘News extraction model’ demonstrates the extraction and manipulation of the said sentiment features (news headlines).
‘Comparison metrics’ takes results from ‘Model 1’ and ‘Model 2’ and displays graphs and visuals detailing their differences and similarities to draw conclusions

stock-price-prediction-with-optimization's People

Contributors

keitharogo avatar

Watchers

 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.