---
# System prepended metadata

title: Untitled

---

## Alpha Tuning

The purpose of this document is to outline the idea of effective parameterization and inference of the modulator term, $\beta$, in the slope expression for free collateral:

$$
FC(u) = \max\left[0,B - \alpha N + u ,(1 - \alpha\beta)\right]
$$

Since the intercept remains unchanged, we focus only on the slope term
$$
s = 1 - \alpha\beta
$$

The parameters must respect the following constraints by construction: 
$$
1 \le \beta \le \frac{1}{\alpha}
$$
This ensures that positive unrealized PnL, $u$, always increases total $FC$, and $\beta \ge 1$ ensures that we are effectively attenuating the slope (i.e. increasing the penalty).

We will make further observations:
	1.	The slope $s$ has an absolute theoretical lower bound of zero and an upper bound of 1:
$$
0 < s \le 1
$$
	2.	In practice, the slope will fall in the empirical range $s \in [s_{\min}, s_{\max}]$.

Intuitively, the lower bound $s_{\min}$ corresponds to the volatile (or stress) regime, as it results in a smaller contribution to $FC$ from $u\cdot s_{\min}$. Similarly, the upper bound $s_{\max}$ corresponds to the safer regime, since it results in a greater contribution to $FC$ from $u\cdot s_{\max}$.

Instead of directly computing $\beta$, we instead target the slope $s$, and use linear parametrization, as follows:

$$
s(R) = s_{\max} - (s_{\max} - s_{\min})R
$$

where $R$ is the asset-specific risk score.

The risk score $R$ can be estimated, for example, from the asset-specific min–max band of the volatility distribution:

$$
R = \mathrm{clip}\left(
\frac{\sigma_t - \sigma_{\mathrm{low}}}{\sigma_{\mathrm{high}} - \sigma_{\mathrm{low}}},
0,1
\right)
$$

We can calculate $\sigma_t$ as the volatility of log returns at time $t$, and $\sigma_{\mathrm{low}}$ and $\sigma_{\mathrm{high}}$ as the 5th and 95th percentiles of historical volatility distribution for the asset.

Note that $R$ is also a linear function of $\sigma_t$, and is constrained by $\sigma_{\mathrm{low}} \le R \le \sigma_{\mathrm{high}}$. In situations where $\sigma_{\mathrm{low}} \approx \sigma_{\mathrm{high}}$, we can default to $R = 0.5$.

Once the slope $s$ is calculated, the modulating parameter $\beta$ is implicitly calculated from
$$
\beta = \frac{1 - s(R)}{\alpha}
$$
since $\alpha$ is assumed to be known.

Below are plots of the functional dependence of the slope $s(R)$, and the risk score $R(\sigma_t)$.

How can we estimate the bounds for $s_{\min}$ and $s_{\max}$? Intuitively, $s_{\max}$ correlates to the fraction of unrealized PnL you’re willing to credit in calm markets, and opposite for $s_{\min}$. Exchange specific constraints might apply. Let’s use an example where $s_{\max} = 0.95$ and $s_{\min} = 0.25$, and $\sigma_{\mathrm{low}}$ (5th pct) $= 0.35$ and $\sigma_{\mathrm{high}}$ (95th pct) $= 1.2$, and current volatility is $\sigma_t = 0.7$. This yields $R = 0.41$, $s(R) = 0.66$, and the implied $\beta \approx 3.4$. So within this volatility profile, we can attenuate the slope with the maximum likelihood estimate of $\beta$ given above.

Is it possible to construct the risk score to be non asset-specific? We need a rationalization for this, since BTC–USDC pair does not have the same risk profile as DOGE–USDC pair. However, we can circumvent this by constructing a cross-sectional rank (purely relative quantity). This can be accomplished by taking pooled volatilities $S = {\sigma_{a,t}}$ for every asset $a$ at time $t$ and calculating $R = \mathrm{rank}_{a,t}$. We can also use clusters of low, medium, and high volatility, depending on the current market dynamics. For example, 0.2, 0.5, 0.8 values of $R$, respectively, independent of the asset. Another way is to precompute values of $R$ for assets and have generic values (broad range, clusters) and create a lookup mapping for assets to cluster, and re-use them without frequent updates. If we have no asset information at all, a flat prior will serve, with $R = 0.5$ (default value). 

![slope](https://hackmd.io/_uploads/r1DQdR3dll.jpg)
![risk](https://hackmd.io/_uploads/B1QV_C2Olx.jpg)
