This repository is the official implementation of the paper Optimal Stopping via Randomized Neural Networks.
Clone this git repo and cd into it.
git clone https://github.com/HeKrRuTe/OptStopRandNN.git
cd OptStopRandNN
Then create a new environment and install all dependencies and this repo.
- with conda:
conda create --name OptStopRandNN python=3.7
conda activate OptStopRandNN
pip install --no-cache-dir -e .
- with virtualenv, use equivalent command for non debian based systems.
sudo apt-get install python3-venv
python3 -m venv py3
source py3/bin/activate
pip3.7 install -e .
That's all!
- Backward Induction
- LSM: Least Square Monte Carlo. (Longstaff and Schwartz, 2001)
- NLSM: Neural Least Square Monte Carlo. (Lapeyre and Lelong, 2019) (Becker, Cheridito and Jentzen, 2019)
- DOS: Deep Optimal Stopping. (Becker, Cheridito and Jentzen, 2019)
- RLSM: Randomized Least Square Monte Carlo. (Herrera, Krach, Ruyssen and Teichmann 2021)
- RRLSM: Randomized Recurrent Least Square Monte Carlo. (Herrera, Krach, Ruyssen and Teichmann 2021)
- Reinforcement Learning
- FQI: fitted Q-Iteration. (Tsitsiklis and Van Roy, 2001) (Li, Szepesvari and Schuurmans, 2009)
- LSPI: least-squares policy iteration. (Li, Szepesvari and Schuurmans, 2009)
- RFQI: randomized fitted Q-Iteration. (Herrera, Krach, Ruyssen and Teichmann 2021)
First cd into "OptStopRandNN". Then activate the virtual environmant:
- with conda
conda activate OptStopRandNN
- with virtualenv
source py3/bin/activate
Specify number of parallel jobs (i.e. CPUs that are used parallelly to run multiple algorithms) by replacing N by the wanted number of CPUs. By default, it uses all but one available CPUs.
python optimal_stopping/run/run_algo.py --nb_jobs=N --configs=...
Generate tables directly:
python optimal_stopping/run/run_algo.py --generate_pdf=True --configs=...
Write comparison tables and figures used in PDF:
python optimal_stopping/run/write_figures.py --configs=single_test_maxcall_10stocks
Profiling performances:
python3 -m cProfile optimal_stopping/run/run_algo.py --algo=longstaffSchwartz --stock_model=BlackScholes --strike
=100 --volatility=0.3 --spot=100 --rate=0.02 --dividend=0.0 --maturity=1 --nb_stocks=1
--nb_paths=1000 --nb_steps=100 --payoff=MaxPut --output_dir=output
Generate the tables of the paper:
python optimal_stopping/run/run_algo.py --configs=table_spots_Dim_BS_MaxCall --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_Dim_Heston_MaxCall --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_spots_Dim_BS_MaxCall_bf --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_Dim_Heston_MaxCall_bf --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_spots_Dim_BS_MaxCall_do --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_Dim_Heston_MaxCall_do --nb_jobs=10;
python optimal_stopping/run/write_figures.py --configs=table_spots_Dim_BS_MaxCall_gt;
python optimal_stopping/run/write_figures.py --configs=table_Dim_Heston_MaxCall_gt;
python optimal_stopping/run/run_algo.py --configs=table_smallDim_BS_GeoPut --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_Dim_BS_BasktCall --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_Dim_BS_BasktCall_bf --nb_jobs=10;
python optimal_stopping/run/write_figures.py --configs=table_other_payoffs_gt;
python optimal_stopping/run/run_algo.py --configs=table_manyDates_BS_MaxCall1 --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_manyDates_BS_MaxCall2 --nb_jobs=5;
python optimal_stopping/run/write_figures.py --configs=table_manyDates_BS_MaxCall_gt;
Generate convergence studies of the paper:
python optimal_stopping/run/run_algo.py --configs=table_conv_study_Heston_LND --nb_jobs=80 --generate_pdf;
python optimal_stopping/run/run_algo.py --configs=table_conv_study_BS_LND --nb_jobs=80 --generate_pdf;
python optimal_stopping/run/run_algo.py --configs=table_conv_study_Heston_FQIR --nb_jobs=80 --generate_pdf;
python optimal_stopping/run/run_algo.py --configs=table_conv_study_BS_FQIR --nb_jobs=80 --generate_pdf;
Generate the hurst plot of paper:
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS_PD --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS_bf --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS_randRNN --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS_FQIR_PD --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_RNN_DOS_FQIRRNN --nb_jobs=10;
python amc2/plot_hurst.py;
Generate the hurst table of paper:
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst0 --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst_PD0 --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst_RNN0 --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst_PD --nb_jobs=10;
python optimal_stopping/run/run_algo.py --configs=table_highdim_hurst_RNN --nb_jobs=10;
python optimal_stopping/run/write_figures.py --configs=table_highdim_hurst_gt;
python optimal_stopping/run/run_algo.py --configs=table_Ridge_MaxCall --nb_jobs=10;
python optimal_stopping/run/write_figures.py --configs=table_Ridge_MaxCall;
python optimal_stopping/run/run_algo.py --configs=table_OtherBasis_MaxCall --nb_jobs=10;
python optimal_stopping/run/write_figures.py --configs=table_OtherBasis_MaxCall;
This code can be used in accordance with the LICENSE.
If you use this library for your publications, please cite our paper: Optimal Stopping via Randomized Neural Networks.
@article{OptStopRandNN2021,
author = {Herrera, Calypso and Krach, Florian and Ruyssen, Pierre and Teichmann, Josef },
title = {Optimal Stopping via Randomized Neural Networks},
journal = {CoRR},
volume = {abs/2104.13669},
year = {2021},
url = {https://arxiv.org/abs/2104.13669}}
Last Page Update: 29/04/2021