Bitcoin Futures Basis Trade
Yesterday I decided to see if I could build a quick futures basis rate calculator for Bitcoin futures. The “basis rate” is the spread that exists between a future, and the current spot price of an asset. When the asset futures are in contango, this rate will be positive, because the future price is higher than the current spot price. Conversely, the basis rate will be negative when the asset futures are in backwardation.
It turned out to be super quick and easy. I’ve embedded the resulting table belowe, but you can also check out the entire notebook here. I’m calculating the annualized APY for each futures product available on Deribit using their public v2 api. The notebook updates itself every 5 seconds (adjustable by the user on the ObservableHQ site) with the latest prices and rates. Do note that I’m currently calculating the APY (annualized basis rate) based on the
mark_price rather than the
last_price. I’m also using the
BTC-PERPETUAL as a proxy for the current spot price of Bitcoin, as you can’t actually trade spot on Deribit. As with any moving, volatile market, you may not actually be able to capture that APY, but it gives a good reference for comparison of where rates are at. This is also, obviously, not investment advice. The
percent_delta column is the simple percentage delta between the
mark_price, and the respective futures’
marke_price, to give you an idea of the actual rate, vs the annualized APY.
Current Deribit Bitcoin Futures Basis
I think this will be a useful tool to prototype ideas quickly, and share them with others without having to have a server running or have each person set up a local development environment. I look forward to making use of this tool more in the future.
I also want to play with Polynote a bit more, as it can leverage more languages (Scala, Python, Haskell), and is probably better suited for things that require a bit more computation, as well as things that may need to talk to private APIs.