Coder Social home page Coder Social logo

awilliea / risk-based_rl_for_optimal_trading_execution Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 7.0 3.19 MB

License: MIT License

Python 99.79% JavaScript 0.07% TypeScript 0.14%
reinforcement-learning order-placement optimal-trading-execution multi-objective ddqn tf-agents gym-environment limit-order-book trading-bot reward-shaping

risk-based_rl_for_optimal_trading_execution's Introduction

Risk-based Reward Shaping Reinforcement Learning for Optimal Trading Execution

This is a research extened from Juchli(2018) https://github.com/mjuchli/ctc-executioner

Enviroment

You can create an virtual enviroment with requirement.txt. e.g.

conda create --name <env_name> python==3.7.6
source activate <env_name>
pip install -r requirements.txt

However, we revised some part of the tf-agents package but have not done the pull-request. You need to overwrite the tf-agents package with ours (in this github directory)

cp -r tf_agents ~/anaconda3/envs/<env_name>/lib/python3.7/site-packages/

Usage

Get the results of the baselines

python get_baseines.py

Training the normal RL agent by CNN for buying signals on the downtrend dataset

python TFA_DDQN_Risk.py -s buy -d dn -m CNN -r profit

Training the reward-shaping RL agent by CNN for buying signals on the downtrend dataset

python TFA_DDQN_Risk.py -s buy -d dn -m CNN -r profit_vol

Training the MORL agent by CNN for buying signals on the downtrend dataset given preference = [0.8,0.2] (0.8 for profit and 0.2 for risk, which is a strategy for a risk-seeker)

python TFA_DDQN_Risk.py -s buy -d dn -m CNN -r profit_vol -p [0.8,0.2]

Training the risk-sensitive agent by CNN for buying signals on the downtrend dataset given beta = 0.2 (which is a strategy for a risk-seeker)

python TFA_DDQN_Risk.py -s buy -d dn -m CNN -r profit_vol -b 0.2

Training the risk-averse agent by CNN for buying signals on the downtrend dataset given lambda = 0.8 (which is a strategy for a risk-seeker)

python TFA_DDQN_Risk.py -s buy -d dn -m CNN -r profit_vol -l 0.2

After the training of the RL agents, you can extract the final dataframe of the comparision of the results. For example, if you want to output the comparision between the normal RL agent and the reward-shaping RL agent given the buying signals and downtrend dataset, you can do this:

python get_results.py -s buy -d dn --tdir 1

risk-based_rl_for_optimal_trading_execution's People

Contributors

awilliea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.