Portfolio Optimization AI

AI-Driven Portfolio Optimization: Reinforcement Learning for Smart Stock Suggestions and Custom Data Interface for User Convenience

Download as .zip Download as .tar.gz View on GitHub

Reinforcement learning portfolio optimization

TODO

About

Proposed System

Pre-Requisite

Procedure

Website

Screenshot 2023-09-14 at 11 07 57 PM

  1. Download and extract the jcomp.zip to your desired folder (say dest)
  2. In a new Powershell terminal
cd path/to/dest/jcomp/stonks
npm i
npm run dev
  1. Website would be hosted at http://localhost:3000/
  2. (Alternative) We hosted the website at vercel and can be visted at STONKS (stonks-five.vercel.app)

RL Agent

  1. Download and extract the code.zip to your desired folder (say dest)
  2. In code folder, open environment.yml
  3. Scroll to last line and change subhr to your windows username.
prefix: C:\Users\<your username here>\.conda\envs\multi_stock_rl_trading
  1. In a new Anaconda Powershell
cd /path/to/dest
conda env create --file=environment.yml
  1. Open your choice of Code editor, set your kernal to multi_stock_rl_trading
  2. We have provided with sample data.
  3. (Alternative) Get data (in .json format)for your intrested company from the website and replace the sample sata at /dest/code/test_data.
  4. Make sure there are exactly 3 companies , no more, no less.
  5. Run all the Code blocks of main.ipynb
  6. DONE

Experimental Results

The results of the tested models are:

Screenshot 2023-09-15 at 12 14 38 AM

Screenshot 2023-09-15 at 12 14 45 AM

Screenshot 2023-09-15 at 12 14 52 AM

Screenshot 2023-09-15 at 12 14 59 AM

Screenshot 2023-09-15 at 12 15 07 AM

Screenshot 2023-09-15 at 12 15 13 AM

Screenshot 2023-09-15 at 12 15 23 AM

Screenshot 2023-09-15 at 12 15 31 AM

Screenshot 2023-09-15 at 12 15 39 AM

Screenshot 2023-09-15 at 12 15 46 AM

Screenshot 2023-09-15 at 12 15 51 AM

Screenshot 2023-09-15 at 12 15 58 AM

Each model has predicted different actions for the test datasets which obtains different rewards. The suppression rate=75% and transactional cost=0.05 has generated the least rewards as a large proportion of the amount in the environment is reduced due to the transaction cost.