# TLDR

We construct an optimization problem to set optimal margin requirements based on expectiles to balance between prudentiality and opportunity cost. See the full write-up here.

# Motivation

We aim to build an exchange that can facilitate trading contracts on illiquid underlyings. To manage risk, we need to set proper margin requirements. Typical industry approaches involve simulating scenarios and setting margins according to worst-case losses (e.g. CME’s SPAN). On the other hand, crypto exchanges open opportunities for more prudent, near real-time risk management.

# Risk measures

To quantify risk, we will choose a risk measure, \rho: \mathcal{G} \mapsto \mathbb{R}, where \mathcal{G} is the set of all functions X: \Omega \mapsto \mathbb{R} that represents the future returns of a portfolio. In particular, we are interested in convex risk measures (i.e. coherent risk measures that relax positive homogeneity) because they satisfy monotonicity, translation invariance, and convexity (Artzner et al., 2001). Note however that because crypto assets are highly correlated and have fat-tailed return distributions, it may be more desirable to require subadditivity conditional on two assets being negatively correlated.

In addition to their theoretical soundness, we desire a risk measure that is practical. This entails two more requirements: elicitability and robustness. A risk measure \rho is elicitable if there exists a scoring function whose minimizer is an optimal forecast for \rho (Ziegel, 2014). Elicitability is important for backtesting, which allows us to compare the performance of different forecasting methods.

We consider a risk measure \rho to be robust if it is continuous with respect to the Wasserstein distance (Emmer et al., 2015). Robustness is important because a robust risk measure is insensitive to a small perturbation in the probability measure, which implies greater tolerance to model misspecification. Indeed, all risk measures require the specification of a model \mathbb{P}, a distribution over future returns of an account (unless we directly forecast risk measure, or rather statistic, from historical samples).

Existing risk measures include: value-at-risk, expected shortfall, spectral risk measures (Cotter and Dowd, 2006), median shortfall (Kou et al., 2013), and liquidity-adjusted risk measure (Weber et al., 2013; Angelidis and Benos, 2006), each of which satisfies some but not all the requirements mentioned above.

Instead, we choose to explore expectiles

e_\tau(X) = -\text{arg} \min_{x \in \mathbb{R}} \mathbb{E} [\tau (X - x)^2_+ + (1 - \tau) (x - X)^2_+]

for some 0 < \tau < 1 and (x)_+ = \max(0, x).

We can then define expectile value-at-risk EVaR_\tau(X) = -e_\tau(X). We choose to explore EVaR_\tau because it is the only risk measure to be coherent, robust, and elicitable for \tau \leq \frac{1}{2}. We can characterize EVaR_\tau by its acceptance set \mathcal{A}_{EVaR_\tau} = \{ X \mid \frac{\mathbb{E} [(X - e_\tau(X))_+]}{\mathbb{E} [(e_\tau(X) - X)_+]} \geq \frac{1-\tau}{\tau} \} (Bellini and Bernardino, 2017). Note that \Omega(X, \tau) = \frac{\mathbb{E} [(X - e_\tau(X))_+]}{\mathbb{E} [(e_\tau(X) - X)_+]} is a performance measure referred to as the omega ratio (Chen, 2018), the ratio of expected gains to expected losses. Hence, \mathcal{A}_{EVaR_\tau} defines a set of accounts with sufficiently large omega ratios. \tau can then be intuitively thought of as the weight given to expected gains relative to expected losses.

# Designing optimization problem

It’s easy to set margin requirements equal to some risk measure, but this could lead to high margins that disincentivize trading (and certainly would not reflect the risk appetite of crypto-traders). Instead, optimal margin requirements involve balancing two factors: prudentiality and opportunity cost (Lam et al., 2003). Prudentiality can be captured by a risk measure, while opportunity cost is more abstract. Opportunity cost could be defined as the expected overcharge \mathbb{E}[(M-L)_+] where M is margin and L is loss, or as some risk-free rate multiplied by the required margin, sometimes known as funding cost. It follows that higher margin products demand higher expected returns in an equilibrium (Gâleanu and Pedersen, 2011).

See Brennan, 1986; Shanker, 2014; Berlinger et al., 2019; Capponi and Cheng, 2018 for existing optimization problem formulations.

For our formulation, we want to balance between prudentiality and opportunity cost without relying on exogenous parameters that we need to calibrate, so we will minimize the sum of expected margin shortfall and expected margin overcharge. The only constraint we will impose is that we want to remain solvent under this margin requirement. Hence, we formulate our optimization problem with expectile value-at-risk as the following:

\begin{align*} \underset{0 \leq \tau \leq \frac{1}{2}}{\text{minimize}} \quad &\sum_{i=1}^n \mathbb{E} [(EVaR_\tau(X_i) + X_i)_+] + \mathbb{E} [(-X_i - EVaR_\tau(X_i))_+] \\ \text{subject to} \quad &EVaR_\tau(X_i) \geq -x_i^t \end{align*}

where n is the number of traders, and x_i^t denotes the unrealized profit and loss of the account for trader i and current time t. In words, the first term in the summation of our objective function is expected margin overcharge \mathbb{E}[(M - L)_+] and the second term is expected margin shortfall \mathbb{E}[(L - M)_+]. The constraints require the new margin requirement for each trader to be no less than their current loss.

One issue, however, is that the optimal margin requirement EVaR_{\tau^*} could be too lenient compared to \tau \approx 0.00145, which results in similar values to the industry standards VaR_\alpha with \alpha = 0.01 and ES_{\alpha'} with \alpha' = 0.025 under normal distributions.

For the future, we will also consider margin change frequency via “margin bands” (Lam et al., 2010), initial margin requirements, partial liquidation mechanisms, and requiring additional margin for large positions.

# Questions

1. What are some efficient methods to solve this optimization problem?
2. What are suitable, alternative formulations for the objective function?
8 Likes
1. What are your thoughts on FTX’s liquidation/risk system? and how does this fit into your thinking?

2. Can you provide some more background that elucidates on some of the 20 sources you have listed? How do the listed sources connect together? What were original insights and what limitations did they come across? Why were they chosen? What are the major schools of thoughts that you can categorized the sources into?

2 Likes

We’ve looked at FTX’s risk engine and in terms of margin requirements, it seems that they are using base and stress VaR at 99% confidence according to Basel III’s standard (Risk Management: Avoiding the Next “LME Nickel” Market Incident). The reason we didn’t want to go with VaR is because it doesn’t capture the magnitude of tail risk, especially for crypto tokens (and furthermore long-tail tokens).

In general, there seems to be two schools of thought when it comes to margin requirements: efficient contract design (Brennan, 1986) vs prudentiality. Efficient contract design focuses on minimizing margin requirements, while prudentiality focuses on minimizing the risk of traders defaulting, which is why we wanted to construct an optimization problem that balances the two.

These papers all involve modelling the market in some way but all with different approaches. Shanker, 2014 takes in a probability that the trader meets the margin requirement within a certain grace period as a constraint. Berlinger et al., 2019 takes in an overall market funding illiquidity parameter to model the cyclical effects of increasing margin during high volatility periods. Capponi and Cheng, 2018 formulates a profit maximization problem from an equilibrium model where traders want to maximize their profits ex ante. All share the limitation that these models require calibrating their respective exogenous parameters.

3 Likes

are you looking to implement optimal margin requirement framework entirely on-chain?

1 Like

Ideally, yes but not sure how feasible this is as of the current formulation

1 Like

do you have a target blockchain ecosystem you are constrained to?

1 Like

Targeting EVM-compatible

1 Like

have you explored any literature regarding stochastic optimization to solve this problem? I’m not familiar with any of the literature, but I know I see a lot of stochastic models being used to get superior results in finance in general (but not at the cost of complexity)

1 Like

We haven’t looked at the stochastic control literature but it does seem like a natural approach to possibly explore as well (although there doesn’t seem to be a lot of these papers on setting margin requirements)

2 Likes

hmm yea maybe stochastic literature isn’t the best for margin specifically. I was thinking more of it as an application for utility indifference pricing and got the threads mixed up!

Understanding margin is inherently based in probability right?

2 Likes

Yeah seems that way, I don’t know if constructing a model for margin requirements (similar to the margin optimization framework papers we looked at) would make sense in practice

2 Likes

well looking at currently implemented margin systems, it seems like GMX has the best on-chain system. Do you have an opinion on that right now?

2 Likes

In terms of risk management they seem to be very conservative in that any potential gain for each trader is reserved for them (i.e. the exchange is never exposed to insolvency risk). From what I see, the margin requirement and liquidation threshold are constant and not really risk based, but given LPs are there to absorb any potential loss it might be less of a concern for them.
If you were referring to their new synthetics contract, we haven’t really looked into it yet.

2 Likes

You can view how been realized margin function on Vela Exchange. In nearby time they lunch public beta test. But now they already have documentation. Maybe you can see some interesting there for you.

for long tail asset, oracle may not be available or not efficient, what would you do to ensure that the process for triggering a liquidation will not be manipulated by bad players.