Orderbook
Derive calculates “reasonable” minimum and maximum prices for each instrument based on the current mark price and potential shocks in the spot prices and implied volatility (only for options). Maker and taker orders cannot cross outside of the minimum and maximum price range.Spot
min_price = mark / (1 + spot_shock)
max_price = mark * (1 + spot_shock)
Perps
Recall that perp mark prices are determined via a spot price feed plus aperp_diff feed which is a time-weighted average difference between the spot index and the perp mid price. The bands then are calculated as follows.
min_price = spot / (1 + spot_shock) + perp_diff
max_price = spot * (1 + spot_shock) + perp_diff
Options
For options, we consider both a potential shock to the underlying spot price, as well as to the mark volatility.spot_down = spot / (1 + spot_shock)
spot_up = spot * (1 + spot_shock)
iv_down = iv / (1 + vol_shock)
iv_up = iv * (1 + vol_shock)
Then, for calls we have:
min_price = Black76(spot_down, iv_down)
max_price = Black76(spot_up, iv_up)
And for puts:
min_price = Black76(spot_up, iv_down)
max_price = Black76(spot_down, iv_up)
The full table of shock values by currency is provided below. Note that “spot shock” differs between instrument types. The calculated minimum and maximum prices can be found in the Get Tickers endpoint.
RFQs
For RFQs, taker and maker protections differ. Takers can choose to reject a quote that is worse than an equivalent orderbook quote. This protection is off by default: setenable_taker_protection to true on private/execute_quote to turn it on. For makers, RFQ price banding is in place instead. Block trades use the same band for both sides.
Maker RFQ bands work similarly to orderbook ones, except all assets in a multi-leg RFQ share the same spot shock value, and options don’t consider volatility shocks. To find the maximum total cost of an RFQ, we first determine the maximum cost of each leg, and then add up the costs together.
For example, an RFQ consisting of a long call spread + short perp might have it’s total cost calculated as follows:
long_leg_max_cost = leg_amount * Black76(spot_up)short_leg_max_cost = leg_amount * Black76(spot_down)(note this will be a negative number because leg amount is negative)short_perp_max_cost = leg_amount * (spot_down + perp_diff)
max_cost = long_leg_max_cost + short_leg_max_cost + short_perp_max_cost
