Build reinforcement learning agents to trade USD_CAD and USD_CHF using data from OANDA v20 API.
After training, you can visualize the agents' trading activities (using testing data) on Dash app.
Credits: https://github.com/notadamking/RLTrader for gym environment codes, tutorials, and idea of using RL in trading https://dash-gallery.plotly.host/Portal/ for Dash template
- Install dependencies
- Make sure you have libopenmpi-dev
$ sudo apt install libopenmpi-dev
- If using GPU
$ pip install -r requirements-gpu.txt
- If not using GPU
$ pip install -r requirements-nogpu.txt
- Create a config file in ~/.v20.conf using information from your OANDA account. For example,
hostname: api-fxpractice.oanda.com
streaming_hostname: stream-fxpractice.oanda.com
port: 443
ssl: true
token: XXXXX
username: XXXXX
datetime_format: RFC3339
accounts:
- XXX-XXX-XXXXXXX-XXX
active_account: XXX-XXX-XXXXXXX-XXX
- Download data from OANDA
$ python data.py
- Train models using PPO2. For example,
$ python model.py --symbol EUR_USD --n 10000
- Visualize agent training
$ python app.py