Skip to content

Instantly share code, notes, and snippets.

@0xperp
Created January 6, 2022 23:49
Show Gist options
  • Save 0xperp/610307b926dd685fe56770e0bcf77774 to your computer and use it in GitHub Desktop.
Save 0xperp/610307b926dd685fe56770e0bcf77774 to your computer and use it in GitHub Desktop.
squeeth_option_hedge.py
###
# Hedging options with squeeth (eth^2) and perps
# https://medium.com/opyn/how-to-hedge-options-with-squeeth-b5e30d5d83ac
# https://docs.google.com/spreadsheets/d/1PBwyqmZXGRZoAlgSa9_ZZiUM28J92-vm7mUybH9HsBc/edit#gid=0
#
# Steps:
# 1. Sell oSQTH with the same gamma as the option that was bought
# 2. Buy ETH futures to hedge the delta from the option that was bought and oSQTH that you sold
###
### imports
import mibian
### eth/usd call option
strike = 4000 # strike price of the option
expiry = 30 # time in days till expiry
iv = .9 # annualized implied vol of the option
price = 4000 # price of eth
r = 0 # risk free rate
call = mibian.BS([price, strike, r, expiry], iv*100)
### squeeth calculations
squeeth_delta = 2*price
squeeth_gamma = 2
squeeth_short_amount = (1/squeeth_gamma) * call.gamma # match the gamma on the option
future_long_amount = squeeth_short_amount * squeeth_delta # hedge the squeeth delta
print("Your call option should be hedged with {0} short oSQTH and {1} long ETH futures".format(squeeth_short_amount, squeeth_gamma))
@someben
Copy link

someben commented Mar 10, 2022

Does this take into account the current Squeeth normalization factor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment