Welcome to this overview of some free python code that allows you to visualise the payoffs of options, including combinations of multiple options.

The GitHub repository can be found here.

This program can handle the usual linear contracts that most traders will be used to, where you’re trading the dollar price of something, and your collateral and profits are also paid in dollars. However, it can also handle the inverse contracts that traders of the cryptocurrency options on Deribit will be familiar with. These inverse contracts use the base currency, such as bitcoin, as collateral. The profit/loss is still calculated in dollars, but is then paid or received in the base currency. This leads to some interesting differences in the payoff charts.

To visualise some options, the user first selects whether they are looking at linear or inverse contracts. They then enter the range of underlying price they would like the chart to display. This is the minimum and maximum value of the x axis of the chart.

In the option details frame, the user can then enter the option type, option premium, strike price, and position size of as many options as they would like. To include an option in the chart, the relevant ‘include’ checkbox must be checked.

Once all desired option details have been entered, clicking the ‘Plot’ button will calculate the combined profit and loss for all included options. This version currently shows only the profit and loss at expiry, and assumes all options share the same expiry date. The same button will need to be pressed again to refresh the chart after any changes have been made.

Option premium for inverse contracts

When using inverse contracts, the option premium is entered as an amount of the base currency. For example, if you are trading a bitcoin option on Deribit, you may see the price of the option quoted as something like 0.03, and this is 0.03 bitcoin, not 0.03 dollars.

It is important to use the correct units for the option premium, or the results will make no sense. When trading linear contracts, just use the dollar price of the option. When trading inverse contracts, use the price of the option quoted in the base currency (such as bitcoin) instead.

Python UI libraries

Tkinter is used for the GUI, and Matplotlib is used to plot the charts. Both are very commonly used libraries in Python, so there is plenty of information available online if you want to edit things.

Using the code

This code is free for all to use and edit as they wish, and I hope this code saves some of you some programming time. As with all the code I’m posting at the moment, I hope each program is useful as it is, but they are also meant to be building blocks with which you can build your own more personalised applications.


Cryptarbitrage Cryptarbitrage

Deribit Content - Spreadsheets, Options, Futures Premiums..