This repository contains a simple portfolio management system written in Python. It allows users to calculate returns on investment for different stocks based on predicted returns and actual prices.
portfolio.py
: Contains thePortfolio
class responsible for managing financial portfolios.stock.py
: Contains theStock
class responsible for managing stocks in portfolios.main.py
: Main script to execute portfolio calculations.README.md
: This documentation file.
- Ensure you have Python installed on your system.
- Clone this repository to your local machine.
- Install the required dependencies by running
pip install pandas
. - Modify
main.py
to provide appropriate file paths for prediction data and test data. - Define return_strategy in
main.py
. - Run
main.py
to execute the portfolio calculations.
The Portfolio
class contains the following trading strategies:
simple_return
: Trade each stock individually based on the predicted return. Each stock has the same initial capital for investment. If predicted return > 0, buy or hold; if predicted return <= 0, sell.portfolio_simple_return
: At time t, sell all stocks with negative predicted return, and use the gained capital to invest all the stocks with positive capital.long_short_return
: Short the stocks with predicted negative return, STILL UNDER DEVELOPMENT.