FRONTIER is a deep reinforcement learning model for portfolio management that takes investor preferences into account. The original version allows long-only trades (see this paper for more details). This repo will extend the original version to allow short trades as well.
There are two ways to set up this development environment. One for development with VS Code, and the other for development through a browser interface using Jupyter Lab. Please refer to the relevant section below:
Specify your training configuration settings in src/config/train_config.json
and run:
python src/utilities/train_parallel.py
Specify your backtesting configuration settings in src/config/backtest_config.json
and run:
python src/utilities/backtest_parallel.py
Prerequisites: You must have Docker and VS Code installed.
- Ensure your VS Code has the
Remote-Containers
extension installed - Clone this repo
- Open the root folder using the
Remote-Containers
extension:- Open your command pallette in VS Code (
fn
+F1
) - Type in and select:
Remote-Containers: Open Folder in Container
- Select the
frontier-rl
folder - Wait for the container to build (first time will take a couple of minutes)
- Open your command pallette in VS Code (
- Once the container is built, you can start developing.
- Insert your API keys and desired plot theme into
.env
as per.env_example
- Browse through
src/models/frontier.py
to see the details of the environment and model architecture, training, backtesting, etc. - Run
notebooks/train_template.ipynb
to see an example of how the models are trained - Run
notebooks/backtest_template.ipynb
to see an example of how trained models are backtested
Prerequisites: You must have Docker and Docker Compose installed.
- Clone this repo
- Navigate to the
.devcontainer
folder by runningcd frontier-rl/.devcontainer
- Build the development environment container by running
docker-compose up
(this will build and configure the environment and start a jupyter lab server inside the notebook which can be accessed remotely) - Once done, open a web browser and navigate to the jupyter server using your token. It should be something like
http://127.0.0.1:10000/lab?token=f1731cd54965375ea245efc131ef6c1172f415139e38e8e9
- Now you can start developing.
- Insert your API keys and desired plot theme into
.env
as per.env_example
- Browse through
src/models/frontier.py
to see the details of the environment and model architecture, training, backtesting, etc. - Run
notebooks/train_template.ipynb
to see an example of how the models are trained - Run
notebooks/backtest_template.ipynb
to see an example of how trained models are backtested
- Add code from original study
- Add data folders containing market data
- Set up containerised development environment to easily reproduce results
- Fore development with VS Code through the
Remote-Containers
extension - For remote development with Jupyter Lab through jupyter server in container
- Fore development with VS Code through the
- Set up Discord server for project
- Add other paper authors as repo contributors (in progress)
- Add Prof. van Zyl
- Add Andrew
- Run simple test on small portfolio (5 assets) to see if containerised environment setup works properly
- Training of RL models with CNN policy network
- Backtesting trained RL models with CNN policy network
- Reorganise folders and files to improve repo readability
- Restructure folders, scripts, notebooks, etc.
- Update contents of notebooks and scripts to respect new folder structure
- Rename REINFORCE to FRONTIER (folder names, script imports, documentation, etc.)
- Put Quandl key in dotenv, make sure it's in .gitignore, and update loading key in src/utilities/data_manager.py
- Test all noteboks and scripts to see if everything works as expected after folder restructure and renaming
- notebooks/train_template.ipynb
- notebooks/backtest_template.ipynb
- notebooks/backtest_actions.ipynb
- notebooks/get_all_frontiers.ipynb
- notebooks/inspect_backtest_actions_template.ipynb
- notebooks/data_preprocessor.ipynb
- notebooks/get_index_data.ipynb
- notebooks/hot-fix.ipynb
- Add plot preferences config (LaTeX-like font and light/dark theme selector)
- Branch off main to add new features for NCAA paper
- Disable transaction costs and investor preferences and run a simple long-only test to maximise portfolio returns to see how it compares to MA-FDRNN, DDPG, PPO, etc.
- Update transaction cost function to accomodate short trades - see Boyd et al. (2017)
- Update transaction cost faunction in reward signal
- Update activation function of policy network output layer to allow short positions (and make sure weights sum to 1)
- Run a couple of tests to confirm transaction costs and portfolio balances are modelled correctly
- Rerun study experiments on different markets to see how performance is impacted after allowing short trades
- Write paper
- Make docs from docstrings for all code
- Include detailed README or documentation for steps to use repo and reproduce results
- Publish paper and open source this repo