Treating the Bid/Ask spread as a Normal Distribution...

Discussion in 'App Development' started by earth_imperator, Mar 8, 2023.

  1. Treating the Bid/Ask spread as a Normal Distribution and
    computing the probability for getting a fill for the own offer price
    (that lies between the last/current Bid and Ask in the orderbook).

    Obviously the probability for getting a fill for the MidPrice has to be p = 0.5 (ie. 50%).
    And in case of a Long:
    p(Bid) = 0.0, p(Ask) = 1.0

    And in case of a Short:
    p(Bid) = 1.0, p(Ask) = 0.0

    The task is of course to compute this:
    p(OwnOfferPrice) = ...

    Bid and Ask are the ultimate limits, ie. the whole address space lies inbetween.

    So, the question is: how to do this mathematically as we don't have a StdDev?
    Can we arbitrarily use 34.1% for the StdDev?
    Any other solution?
     
    Last edited: Mar 8, 2023
  2. 2rosy

    2rosy

    probability of getting filled at mid is not 50%. Also, would need to look at size. Is this something like hitting times?
     
  3. KISS.

    Your bid will be filled at the market's ask... and vice versa for your sale. Unless a MM decides to play your order between the bid/ask spread, your limit bid gets filled when the market moves down so that your bid has become the market's ask.

    (I understand... you want to buy at the bid and sell at the ask. Unfortunately, doesn't usually work that way.)
     
    murray t turtle likes this.
  4. In my case it's enough to assume that own qty is <= qty in the top of the book.
    So, in this case we can ignore the size.
    And: I don't have Level-2 data, rather just the top-of-the-book, ie. Level-1 quotes.
     
    Last edited: Mar 8, 2023
  5. My story behind this ideá:
    I first used DistancePercent of own Price from the Ask (or Bid in case of short), but then decided that this new idea here is much better when programatically scanning many (hundreds) trade candidates.
     
  6. Why don’t you just run a study by analyzing a historical data set of bid/ask and comparing to tas data?
     
  7. I need to apply this in a scanner. I only have the current Level-1 data.
     
    Last edited: Mar 8, 2023
  8. Sprout

    Sprout

    Came across a great interview by Lex Fridman of Neal Stephenson (Snow Crash, Cryptonomicon,..)

    He so happened to also be the first employee of Blue Origin and tasked with designing a new propulsion system for space travel. A lasting comment from that interview was as he spent his mental capital "designing" later he discovered someone had already invented it and done all the math. He pivoted and started to just extensively research and leveraged the prior works of others.




    Estimating the Components of the Bid/Ask Spread by L. Harris et al
    https://www8.gsb.columbia.edu/researcharchive/articles/1547
     
    Last edited: Mar 8, 2023
    earth_imperator likes this.
  9. Found a Q&D solution:
    An example for Long, Bid=80, Ask=120 using a const StdDev=34.134475 (= (0.5 - z2p(-1.0)) * 100). and zMin=-5.0, zMax=5.0 :
    Code:
    Sx=80.00 : z=-5.00000 p=0.00000 pPct=0.000 
    Sx=81.00 : z=-4.75000 p=0.00000 pPct=0.000 
    Sx=82.00 : z=-4.50000 p=0.00000 pPct=0.000 
    Sx=83.00 : z=-4.25000 p=0.00001 pPct=0.001 
    Sx=84.00 : z=-4.00000 p=0.00003 pPct=0.003 
    Sx=85.00 : z=-3.75000 p=0.00009 pPct=0.009 
    Sx=86.00 : z=-3.50000 p=0.00023 pPct=0.023 
    Sx=87.00 : z=-3.25000 p=0.00058 pPct=0.058 
    Sx=88.00 : z=-3.00000 p=0.00135 pPct=0.135 
    Sx=89.00 : z=-2.75000 p=0.00298 pPct=0.298 
    Sx=90.00 : z=-2.50000 p=0.00621 pPct=0.621 
    Sx=91.00 : z=-2.25000 p=0.01222 pPct=1.222 
    Sx=92.00 : z=-2.00000 p=0.02275 pPct=2.275 
    Sx=93.00 : z=-1.75000 p=0.04006 pPct=4.006 
    Sx=94.00 : z=-1.50000 p=0.06681 pPct=6.681 
    Sx=95.00 : z=-1.25000 p=0.10565 pPct=10.565 
    Sx=96.00 : z=-1.00000 p=0.15866 pPct=15.866 
    Sx=97.00 : z=-0.75000 p=0.22663 pPct=22.663 
    Sx=98.00 : z=-0.50000 p=0.30854 pPct=30.854 
    Sx=99.00 : z=-0.25000 p=0.40129 pPct=40.129 
    Sx=100.00: z=+0.00000 p=0.50000 pPct=50.000 
    Sx=101.00: z=+0.25000 p=0.59871 pPct=59.871 
    Sx=102.00: z=+0.50000 p=0.69146 pPct=69.146 
    Sx=103.00: z=+0.75000 p=0.77337 pPct=77.337 
    Sx=104.00: z=+1.00000 p=0.84134 pPct=84.134 
    Sx=105.00: z=+1.25000 p=0.89435 pPct=89.435 
    Sx=106.00: z=+1.50000 p=0.93319 pPct=93.319 
    Sx=107.00: z=+1.75000 p=0.95994 pPct=95.994 
    Sx=108.00: z=+2.00000 p=0.97725 pPct=97.725 
    Sx=109.00: z=+2.25000 p=0.98778 pPct=98.778 
    Sx=110.00: z=+2.50000 p=0.99379 pPct=99.379 
    Sx=111.00: z=+2.75000 p=0.99702 pPct=99.702 
    Sx=112.00: z=+3.00000 p=0.99865 pPct=99.865 
    Sx=113.00: z=+3.25000 p=0.99942 pPct=99.942 
    Sx=114.00: z=+3.50000 p=0.99977 pPct=99.977 
    Sx=115.00: z=+3.75000 p=0.99991 pPct=99.991 
    Sx=116.00: z=+4.00000 p=0.99997 pPct=99.997 
    Sx=117.00: z=+4.25000 p=0.99999 pPct=99.999 
    Sx=118.00: z=+4.50000 p=1.00000 pPct=100.000
    Sx=119.00: z=+4.75000 p=1.00000 pPct=100.000
    Sx=120.00: z=+5.00000 p=1.00000 pPct=100.000
    
     
    Last edited: Mar 8, 2023
  10. This would be difficult to do if there is only one or two price steps between the bid and ask. Maybe you could do this for less liquid instruments, where the gap between bid and ask is a (large) multiple of the minimum price step size.
     
    #10     Mar 9, 2023