Giter Site home page Giter Site logo

xiaotangtj127 / isac Goto Github PK

View Code? Open in Web Editor NEW

This project forked from im1235/isac

0.0 0.0 0.0 309 KB

Optimal control of risk aversion in Avellaneda Stoikov high frequency market making model with Soft Actor Critic reinforcement learning

Python 100.00%

isac's Introduction

Optimal control of risk aversion in Avellaneda Stoikov high frequency market making model with Soft Actor Critic reinforcement learning

Description

Inventory Soft Actor Critic (ISAC) is an experimental extension of Inventory strategy described by Avellaneda and Stoikov[1]. Numerical simulations described in [1] have risk aversion parameter gamma configured arbitrarily. ISAC uses soft actor critic (SAC)[2] to control gamma. Two dimensional state space is defined with absolute value of inventory q and remaining time (total time - step * dt), while one dimensional action space is gamma. Reward is defined as a change in agents value (PL) discounted by penalty function. Penalty is proportional to volatility in mark to market value of inventory.
Strategy is trained on 2000 simulated price paths containing 200 steps each. Benchmark is performed on 2000 simulated paths against inventory and symmetric strategy. Simulation settings are identical to ones described in [1]. Inventory and symmetric strategies have gamma configured to 0.1 as such setting produces most attractive PL profile for given simulation settings.

Running the code

  • run_as.py โ€“ Inventory and Symmetric strategy numerical simulations, replication of Avellaneda and Stoikov[1]
  • run_experiment.py โ€“ train ISAC strategy, benchmark against Inventory and Symmetric, visualization of results

Note: plots are saved to results folder

Requirements

  • PyTorch
  • Numpy
  • Matplotlib

Results

Benchmark statistics: Terminal PL and abs(q)

Symmetric Inventory ISAC
mean(PL) 68.12 64.86 61.79
std(PL) 13.16 (19.33%) 6.45 (9.95%) 6.15 (9.95%)
mean(|q|) 6.65 2.32 1.48
std(|q|) 4.95 1.77 1.25






gamma-surface
Fig. 1: Visualization of learned policy, state space (inventory, step) and action space (gamma)




inventory-time
Fig. 2: Evolution of inventory over time, mean and 95th percentile




price-simulation
Fig. 3: Example of simulated price and system behaviour, diamonds mark filled limit orders




Note: Additional plots available in /results_demo/ .

References

isac's People

Contributors

im1235 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.