Code Monkey home page Code Monkey logo

avellaneda-stoikov's People

Contributors

mdibo avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

avellaneda-stoikov's Issues

Sigma Unit in Avellaneda -Stoikov market making model

as issue

same experiment, if I change price unit in S generator, vol risk value changed. It is not make sense, So what is wrong in my experiment.

import math
import numpy as np


def vol_risk_price(price_unit=1):
    S0 = 100.  # initial price
    T = 1.0  # time
    sigma = 2  # volatility
    M = 200  # number of time steps
    dt = T / M  # time step
    Sim = 1000  # number of simulations
    I = 1

    std = list()
    for i in range(1, Sim + 1):
        ###reservation price:
        ### r(s,t) = s - q * gamma * sigma**2 * (T-t)

        S = np.zeros((M + 1, I))
        S[0] = S0
        for t in range(1, M + 1):
            z = np.random.standard_normal(I)
            S[t] = S[t - 1] + sigma * math.sqrt(dt) * z

        std.append(np.diff(S[:, 0] * price_unit).std(ddof=1) / np.sqrt(dt))

    average_risk_percent_in_s0 = np.mean(std) ** 2 / (S0 * price_unit)
    return average_risk_percent_in_s0


var = vol_risk_price()
# 0.04 = 2**2 / 100
np.testing.assert_allclose(var, 0.04, rtol=0.1)

var = vol_risk_price(10)
# 0.04 = 20**2 / 1000
np.testing.assert_allclose(var, 0.4, rtol=0.1)

Probabilities and intensities

Hi Marco! I was working also in an implementation of this algorithm, and I had a doubt about how to compute probabilities. Researching, I found your code and I see you compute probabilities of order execution using the following formula:
probA = 1 - np.exp(-lambdaA * dt)
instead of just use
probA = lambdaA * dt
as I undertand the authors explain.
Why do you use this implementation? Thanks!

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.