• Stars
    star
    272
  • Rank 151,235 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An environment to high-frequency trading agents under reinforcement learning

Building Trading Models Using Reinforcement Learning

This repository contains the framework built to my dissertation of the quantitative finance mastership program, from FGV University. I proposed the use of a learning algorithm and tile coding to develop an interest rate trading strategy directly from historical high-frequency order book data.

Example simulator

No assumption about market dynamics was made, but it has required the creation of this simulator wherewith the learning agent could interact to gain experience. You can check my master thesis here and the presentation here. Both are in Portuguese. The code structure is heavily inspired by Udacity's smartcab project and in OpenAi's Gym.

Install

This project requires Python 2.7 and the following Python libraries installed:

Run

In a terminal or command window, navigate to the top-level project directory rl_trading/ (that contains this README) and run the following command:

$ python -m market_sim.agent [-h] [-t] [-d] [-s] [-m] <OPTION>

Where OPTION is the kind of agent to be run. The flag [-t] is the number of trials to perform using the same file, [-d] is the date of the file to use in the simulation, [-m] is the month of the date flag and [-s] is the number of sessions on each trial. Use the flag [-h] to get information about what kind of agent is currently available, as well as other flags to use. The simulation will generate log files to be analyzed later on. Be aware that any of those simulations options might take several minutes to complete.

Data

An example of the datasets used in this project can be found here. Unzip it and include in the folder data/preprocessed.

Main References

  1. GOULD, M. D. et al. Limit order books. Quantitative Finance, 2013.
  2. CHAN, N. T.; SHELTON, C. An electronic market-maker. 2001.
  3. BUSONIU, L. et al. Reinforcement learning and dynamic programming using function approximators. CRC press, 2010.
  4. SUTTON, R. S.; BARTO, A. G. Reinforcement Learning: An Introduction, draft, in progress. 2st. MIT Press, 2017.

License

The contents of this repository are covered under the Apache 2.0 License.

More Repositories

1

QLearning_Trading

Learning to trade under the reinforcement learning framework
Jupyter Notebook
497
star
2

FiniteDifference_Pricing

Pricing derivatives using the explicit finite-difference method
Jupyter Notebook
13
star
3

machine-translation

End-to-end machine translation pipeline using Deep Learning
Jupyter Notebook
10
star
4

banana-rl

Train an agent using RL to navigate (and collect bananas) in a large, square world
Python
7
star
5

Replicating_Strategy

A dynamic strategy that replicates the payoff of a derivative described as a stochastic process
HTML
5
star
6

cpp-binomial-greeks

Calculating options greeks using binomial tree model in C++
C++
4
star
7

mlops-predict-churn-clean-code

Build a customer churn prediction model using clean code principles
Python
4
star
8

VectorAutoregression_Model

Specification and estimation of VAR model to U.S. Dollar Future prices
HTML
4
star
9

AirCargo_Planning

Solving a logistic planning problems for an Air Cargo transport system with AI
Python
4
star
10

AssetReturns_Behavior

Statistical analysis of lognormal asset returns
HTML
3
star
11

reacher-rl

Keeping the double-jointed arm hand in the green sphere
Python
3
star
12

Customer_Segments

Using unsupervised learning techniques on product spending data to identify customer segments hidden in the data
Jupyter Notebook
3
star
13

ShortRate_Model

Implement the Kalotay-Williams-Fabozzi model to describe the future evolution of the short rate
HTML
2
star
14

IdentifyingFraud

Jupyter Notebook
2
star
15

dog-cnn

A Convolutional Neural Networks that identifies the canine's breed from a image
Jupyter Notebook
2
star
16

Smart_Cab

Training a cab how to drive using reinforcement learning
Jupyter Notebook
2
star
17

rnn_predictions

Building RNNs that generate sequences based on input data applied to time-series and text generation
Jupyter Notebook
1
star
18

cpp-traffic-simulation

Building a concurrent traffic simulation in C++
C++
1
star
19

kafka-spark-streaming

Streaming application using Apache Spark Structured Streaming and Kafka
Python
1
star
20

Student_Intervention

Predict how likely a student is to pass their high school final exam using Supervised Learning
Jupyter Notebook
1
star
21

mlops-dynamic-risk-assesment

Building a system to train and monitor an ML model to predict attrition risk
Python
1
star
22

etl-intraday-bidask

Hosting data lake with bid-ask data in S3 using Spark and Airflow
Python
1
star
23

tennis-rl

Training a pair of agents to play tennis
Python
1
star
24

ProsperLoan_EDA

final project for Udacity "Data Analysis With R" course
HTML
1
star
25

Boston_Housing

P1 for the Udacity's Machile Learning Egineer Nanodegree
Jupyter Notebook
1
star