> For the complete documentation index, see [llms.txt](https://docs.reya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reya.xyz/trading/margin-system.md).

# Margin System

## Exposures

Instruments in REYA have linear exposures to these risk factors. Explicitly, this means that if risk factors are a multivariate random variable $$R\_t$$ of $$n$$ factors, then each instrument determines a vector $$E\_t$$such that the price of the instrument is

$$
P\_t=E\_t'R\_t
$$

This means in particular that the entries of $E\_t'$ transform the risk factors into token amounts. As a consequence, note that the exposure vector will often be a function of more than just time: for example, if a given risk factor is the relative (percentual) returns $$r\_{t,i}$$ of some asset, then $$e\_{t,i}$$ will generally have the price $$p\_{t,i}$$ as a factor to transform the percentual return $$r\_{t,i}$$ into an absolute return $$p\_{t,i}r\_{t,i}$$ in token amount. For example, if a user holds exposure of two units of ETH when its price is $1500, then their exposure is $3000.

Finally, note that by linearity, exposures are additive, meaning that a portfolio’s exposure is simply the weighted sum (with portfolio weights) of the exposure vectors of each component.

## The risk matrix

Having established the fundamental framework, pools in REYA take as risk parameters an $$n\times n$$ matrix $$A$$, as well as two multipliers $$\lambda\_M$$ and $$\lambda\_I$$. Given this matrix, REYA computes the liquidation margin requirement for a portfolio exposure vector $$E$$ as

$$
\mathrm{LMR}=\sqrt{E'AE}
$$

and then $$\mathrm{MMR}=\lambda\_M\mathrm{LMR}$$ and $$\mathrm{IMR}=\lambda\_I\mathrm{LMR}$$.

The matrix $$A$$of course, must be carefully chosen and updated for the system to appropriately margin portfolios. The cases of multivariate normal and Student's t-distribution are instructive in getting intuition about the risk matrix.

However, REYA will generally rely on a more flexible version, where the components can be independently adjusted according to risk estimates mixing, e.g., Value-at-Risk and Expected Shortfall methods.
