Skip to content

Commit 63b5590

Browse files
Adding reinforcement learning example from popular RL textbook (#1176)
* Added reinforcement learning stock trading example * fixed reference path of symlink to be relative to repository Co-authored-by: Ajay Karpur <[email protected]>
1 parent b6498e9 commit 63b5590

File tree

11 files changed

+132559
-0
lines changed

11 files changed

+132559
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Stock Trading with Amazon SageMaker RL
2+
3+
This example applies the deep Q-network method to train an agent that will trade a single share to maximize profit. The goal is to demonstrate how to go beyond the Atari games and apply RL to a different practical domain. Based on the setup in chapter 8 of [1], we use one-minute historical share price intervals, and then apply a Double DQN architecture to accommodate a simple set of discrete trading actions: do nothing, buy a single share, and close the position. The customized environment is constructed using Open AI Gym and the RL agents are trained using Amazon SageMaker.
4+
5+
[1] Maxim Lapan. "[Deep Reinforcement Learning Hands-On." Packt (2018)](https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On/blob/master/Chapter08/lib/environ.py).
6+
7+
## Contents
8+
9+
* `rl_stock_trading_coach_customEnv.ipynb`: notebook used for training stock trading agent.
10+
* `src/`
11+
* `datasets/YNDX_160101_161231.csv`: source data. See notebook for license.
12+
* `config.py`: configurations including data selection, data directory.
13+
* `data.py`: data functions.
14+
* `trading_env.py`: custom environments and simulator.
15+
* `train-coach.py`: launcher for coach training.
16+
* `evaluate-coach.py`: launcher for coach evaluation.
17+
* `preset-stock-trading-ddqn.py`: coach preset for Double DQN.
18+
19+
## Risk Disclaimer (for live-trading)
20+
21+
This notebook is for educational purposes only. Past trading performance does not guarantee future performance. The loss in trading can be substantial, and therefore
22+
**investors should use all trading strategies at their own risk**.

reinforcement_learning/rl_stock_trading_coach_customEnv/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../common

0 commit comments

Comments
 (0)