Skip to content

In this project, the online optimization of the stock portfolio is discussed. Also, a multi-objective genetic algorithm is presented to solve the problem and the results are compared with some common methods.

Notifications You must be signed in to change notification settings

hamedasgari20/online-portfolio-optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Online portfolio optimization

The purpose of providing this software is to provide an open source tool for stock portfolio optimization in financial markets. Due to the limitations of the classic stock portfolio problem, online stock portfolio optimization has been discussed in this software. This tool will offer the possibility of comparing and evaluating different investment methods in the financial markets. This tool can be used in various financial markets and is not limited to the cryptocurrency market.

Developers:

Dr. Amir Hossein Ansaripoor

Hamed Asgari

Usage

How to use this tool is described below. First, download the software and install the dependencies using the commands below.

git clone https://github.com/hamedasgari20/online-portfolio-optimization.git
cd online-portfolio-optimization
virtualenv venv
source venv/Scripts/activate
pip install -r requirements.txt

Fetching required data

The required data can be stored in the datasets directory with the following command. This commands is in the tools.pyfile.

from online-portfolio.tools import get_data

# Define parameters
coin_list = ["BTC-USD", "ETH-USD", "BNB-USD", "XRP-USD"]
start_time = '2021-01-01'
end_time = '2021-10-27'
data_source = 'yahoo'

# Fetch data and stores in directory data
get_data(coin_list, start_time,end_time,data_source)

Run python main.py to run required strategy on each datasets. In step 1 and 2 in this file required dataset and strategy can be selected.

results of each strategy is shown in terminal such as below.

transaction cost (%) initial deposit: 0.035
sortino ratio is: 3.583
rate of return portfolio (%) initial deposit: 0.334

About

In this project, the online optimization of the stock portfolio is discussed. Also, a multi-objective genetic algorithm is presented to solve the problem and the results are compared with some common methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages