Usain: A Low-Latency Tick Generation Program

Discussion in 'Programming' started by kmiklas, Aug 5, 2016.

  1. kmiklas


    Dear All,

    Given the high fees for "non-display use" of tick data, I have written a program to generate ticks, and published it in the open source community. "Usain" allows the user to generate ticks at their chosen speed.. and it is FAST!

    This will allow one to build algorithms without giving an arm and a leg away to the exchanges.

    Please take a look, and tell me what you think. Be gentle.. it's the first release. If any of you would like to contribute, please message me. This is going to be good!

    Thank you

    Github link:



  2. marsman


    Hi, a good approach, congrats.
    Just a quick question: has it some statistical properties like the "jump diffusion" method by Black? (nowadays there are newer methods, but which are not that easy to apply).
    Ie. where you specify the volatility as one of the input parameters, and that afterwards the generated data come close to that a-priori defined volatility.
    I previously tested my systems with a similar method: Geom. Brownian Motion (GBM), and had added a Q&D jump diffusion to it to simulate gaps/jumps/spikes in the time-series, but it was just bar-data, not tick-data.
    Last edited: Aug 6, 2016
  3. kmiklas


    Yes, it's on the "Todo" list.

    I just refactored the timing mechanism. I want to build the socket interface and the client; then, I'll work something like this in.
  4. kmiklas


    Someone asked me why this is a big deal. Here is the answer that I wrote up for them:

    Here are three reasons why Usain is extremely useful.

    1. Performance and S P E E D. Blazing speed! This program can generate about 2ns (two nanosecond) ticks locally on my $1000 rig. That's 1/1000000000th of a second. It enables a programmer to work, build, develop, and gain experience in an ultra-low-latency environment--at sanctum sanctorum speeds. Just to give you a point of reference:

    a. Interactive brokers tick time (U.S. equities): 250ms (four ticks per second).
    b. tick time (FOREX): 50ms (twenty-five ticks per second)
    c. Interactive brokers tick time (FOREX): 5ms (250 ticks per second).
    d. tick time: 1ms (1000 ticks per second)
    e. Big brokerage tick times (Morgan Stanley, BNY Mellon, JPM, etc): 1mcs (100,000 ticks per second)
    f. HFT Hedge funds and other monsters with and exchange-collocated equipment: tick times: 500ns (2,000,000 ticks per second)
    g. Usain: 2ns tick time (50,000,000 ticks per second)... perhaps even picosecond (1,000,000,000 ticks per second) on heavy hardware.

    2. Non-Display Fees and Regulations. Usage of market data dramatically affects subscriber fees. For simple "Display" usage--such as piping data into Ninjatrader or the like--NYSE charges $16 per non-pro subscriber, $70 for a pro. If the data are used with an API, and "not displayed" on the screen (hence the term, "non-display fees") they jump to $20,000. Furthermore, each exchange charges separately, so it can really add up. NYSE reference follows. Usain allows a programmer to develop low-latency algorithms, while staying in compliance with exchange regulations, and avoiding these astronomical fees.

    NOTE: I believe that these fees are a knee-jerk response to the crash of 2008, where HFT was the scapegoat. The intent is to create a paywall to keep out all but the wealthiest. IMO, this is not the truth; the crash of 2008 had other root causes.

    3. Incredible Simulations. Allow the user to specify volatility as an input parameter, such as Geometric Brownian Motion (GBM), with a jump diffusion to simulate spikes. Then, test algorithms against the specified patterns, to see if they can identify them in the data. I'm planning to build this out after I create the Usain client for data processing, and a couple of other features.

    4. More to come! Exciting!

    Keith Miklas
    Last edited: Aug 8, 2016
    wave likes this.