Open Sourcing an Options Trading Algo

When I was a trader at Goldman, it constantly bothered me that the trading mentality was too oriented around the zero sum idea — for one person to win, another has to lose. That’s a horrible way to go about things and also happens to be entirely inaccurate.

Zero sum is a matter of scope. If you scope the game to an individual trade, there is no question that it’s zero sum. One person gains money, the other loses it. But that’s an entirely unrealistic economic scoping of what is actually happening.

If Bill Gates sells some Microsoft shares to a retiree, and the shares go up, the cynic will say that Gates lost and the retiree investor won. But of course that is nothing close to the richness of what is happening in an interaction like that — what is each person doing with the trade, after? If Gates took the proceeds of that trade to invest in another even higher yielding project, such as a new company, or to invest in projects to control Malaria, he could very well be earning a higher return on his proceeds than he would have had with holding his stock. Also, the retiree wins as well. Positive sum.

Bitcoin is a new ecosystem, and derivatives on Bitcoin can be considered some of the most zero sum transactions in the world. But we certainly don’t see it that way — for example, miners who work with us, selling call options and investing the proceeds in projects to advance the state of the art in hardware, mean that both buyer and seller can benefit.

So with that in mind, LedgerPrime (our affiliated market maker) is open sourcing their basic codebase for quoting options algorithmically. I have a lot of friends who are curious as to how these algos work, and I can say with certainty that it’s a ton of fun algorithmically trading options. But it’s also nontrivial to build from scratch. It’s easily an order of magnitude more complex than trading spot, and we want to make it as accessible as possible to those interested, because we think at this stage in the market, there is room for a lot of participants who can all do well.

You can find the initial repo here: and there will be more installments coming. Of course, there are no promises of quality and effectiveness, it’s just a good starting point for those who might be interested. This code is specifically integrated to the LedgerX API, but the ideas and strategy are more general so you can use them in principle on any platform. We hope you find it helpful.


One of my obnoxiously smart friends from college rightfully pointed out an error in this post:

BTC does not have to use the real number system to achieve the aspects I was describing. It only has to be a quotient of two integers, so real numbers are overkill. Instead, BTC needs only to be in the rational number subset of the reals.

So it turns out Bitcoin doesn’t need to be real, it just needs to be rational.

(Thanks Boris A. for the feedback)

— Paul