Rain?

Last November, I went to climb Pleasant Overhangs at Seneca with the perfect group of 3. The weather forecast for the afternoon didn't look too good. My excitement got the better of me, and we went for it anyways. At 2PM as I was about to start pitch 3, it started POURING - just as the forecasts had predicted. I had the wettest rappel of my life.

It's starting to rain, but we're still protected by the especially pleasant overhang.

I regret nothing.

Birdsboro Quarry

Baltimore is perhaps not the best place to be for sport climbing. For a 2 hour drive, you can get to Birdsboro Quarry. The area is actually fairly well developed with nice little benches you can sit on. Its blasted walls sometimes still shed rock - careful.

The area has tons of short & sweet sport routes, and some longer ones if you like to do 5.11+.

Jenga is a fun one to get on.

ExchangeEngine

I started ExchangeEngine on GitHub in 2015 to experiment with setting up continuous integration and testing on some different services. Back in 2015 I didn't get far with the project after I had finished messing around with the continuous integration systems. I randomly picked it back up recently and got it to a minimal product.

At its most basic, ExchangeEngine is a Node.js library that allows you to create an exchange for any generic thing you wish. Currently, it is very minimal with no explicit architecture defined for users or authentication. In theory, you can use ExchangeEngine to back any type of exchange - be it stocks, Bitcoin, or Pokemon Cards.

The order types supported are Limit and Market orders with FIFO priority execution.

Example

Given the two orders coming in:

var order1 = {
    quantity: 1,
    price: 3,
    side: Order.SIDE.ASK,
    type: OrderTypes.LIMIT,
    owner: "user1",
    status: Order.STATUS.ACTIVE,
    time: new Date()
}

var order2 = {
    quantity: 1,
    price: null,
    side: Order.SIDE.BID,
    type: OrderTypes.MARKET,
    owner: "user2",
    status: Order.STATUS.ACTIVE,
    time: new Date()
}

The Exchange Engine will find a match and produce a trade:

[ Trade {
    fillPrice: 3,
    fillQuantity: 1,
    newOrders: [],
    childOrders: [ [Object], [Object] ],
    rejectedOrders: [],
    executionTime: 2019-02-05T04:47:36.119Z } ]

Benchmark

Backing the order matching engine is a fibonacci heap. I picked it because it sounds cool (just kidding). This seems to produce satisfactory performance on my dying MacBook Pro retina. As expected with the heap, the performance depends on the book depth.

Book Depth - Transactions/Second
100 219,257
500 56,879
1,000 26,894
10,000 2,171

Given that the daily volume of SPY today was 60,673,524, if each trade was one share, that'd be around 2,592 trades per second in the 6.5 hour trading day. Not a bad start.

If your application is running on the cheapest MacBook, has books 10k orders deep, and transacting more volume than SPY, you can probably afford something better than this free GitHub project.

Although this performance is more than sufficient for most, I am thinking of implementing a more memory intensive but much faster matching engine. I also have some fun ideas for projects with this. More on this later...

Volatility Surface Visualizer Updates

I finally added some updates to the Volatility Surface Visualizer that will allow you to finally get quantitative data from it (at GitHub). I also added some rudimentary empty fill interpolation to make the surface prettier. Furthermore, I finally added axes and ray casted value reader. Just click on the surface, and you can see the interpolated date, strike, and IV.


Interpolation / Parameterization

I wasn't really aware when I started this project, but this seems to be a subject that is far more complex that I had originally anticipated. The pricing data straight from CBOE becomes fairly ugly very quickly for the illiquid contracts. In order the make the surface less chaotic, I really prefer some sort of interpolation or parameterization.

Currently, the viewer uses a pretty rudimentary strategy. The surface is populated on a grid of all observed strikes and expirations. For all expirations, from the current price, an empty fill is done for all missing values - middle out. This gets the job done for now.

Popular strategies such as Arbitrage-free SVI volatility surfaces (pdf) exist, but for my purposes, I don't know if the juice is worth the squeeze.

Ray Cast Value Viewer

Now you can click anywhere on the surface and see the interpolated strike, price, and Implied Volatility.