# Position Change Fee

Position change means any activity that changes the value of positions, including open, close or liquidate positions. Position change cause changes in naked positions.

The hAMM system has a special Position Change Fee (PCF) mechanism rewarding position changes that decrease naked positions, and discouraging position changes that increase naked positions.

When traders increase the naked positions of a certain derivative, they will pay extra PCF to the system, and on the flip side, receive PCF from the system.

The existence of PCF will encourage arbitrageurs to earn risk-free profit as follows: open a position under Derify protocol that is opposite to the naked position, then open a hedged position in an external market.

Such action is called "naked position arbitrage", which effectively takes naked position to external markets, and decreases the risk exposure of the system.

The existence of arbitrageurs will keep the value of naked position $N$ close to zero, thus restricting naked position.

# Liquidity Depth Factor

Liquidity Depth Factor (LDF) $D$ is a function to position pool $P$, the formula of which is as follows:

$D=\boldsymbol{f}(P)=\min{(\kappa*P,\ \psi)}=\min{\Big(\kappa*(X_{all}-Y_{all}),\ \psi\Big)}$

When the liquidity depth is limited, $D$ equals risk sensitivity coefficient $\kappa$ multiplied by position pool $P$.

When the liquidity depth reached a certain threshold ($\kappa*P>\psi$), $D$ always equals to external liquidity depth simulator $\psi$.

Risk sensitivity coefficient $\kappa$ is a pre-set constant. A smaller $\kappa$ means the higher position pool $P$ is needed to maintain the liquidity depth, i.e. the system is more sensitive.

External liquidity depth simulator $\psi$ is another constant, determined by the liquidity depth of external markets.

$\kappa$ and $\psi$ are changeable and can be adjusted via DAO community voting.

# PCF Rates

PCF rates $R$ is used to calculate the PCF, the formula of which is as follows:

$R=\dfrac{N}{D}=\dfrac{X_c+Y_c}{\min{\Big(\kappa*(X_{all}-Y_{all}),\ \psi\Big)}}$
• $X$ is always positive and $Y$ is always negative.

The sign of $R$ is determined by $N$.

When $N$ is positive:

• naked position is long

• PCF is positive

• opening long position/closing short position shall pay PCF payment

• opening short position/closing long position shall receive PCF rewards

When $N$ is negative:

• naked position is short

• PCF is negative

• opening short position/closing long position shall pay PCF payment

• opening long position/closing short position shall receive PCF rewards

$R$ is an instantaneous state of the system.

# PCF Cost for A Transaction

PCF cost $c$ for a transaction, means the PCF payable upon the transaction which shift the system PCF rates from $R$ to $R'$. Assuming the position changed is $\Delta p$, $c$ is calculated as follows:

$c=\begin{cases} \Delta p*\Big(\dfrac{R+R'}{2}+\rho\Big),&R+R'>0\\ \\ 0,&R+R'=0\\ \\ \Delta p*\Big(\dfrac{R+R'}{2}-\rho\Big),&R+R'<0 \end{cases}$

$\Delta p$ is positive if the position change is an increase, and negative if it decrease. If a original position is long, the sign for $\Delta p$ remains the same. If a original position is short, the sign for $\Delta p$ changes to the opposite (i.e., if the original position is short, increasing original position means $\Delta p$ is negative).

When $c$ is positive, trader pay PCF payment. When $c$ is negative, trader receive PCF rewards.

$\rho$ is the coefficient of external arbitrage cost set to cover the cost that arbitrageurs have in external markets, including slippage or trading fees. Generally, $\rho$ is set at 0.1%, which should cover most of the normal costs, but this constant is also changeable and can be adjusted via DAO community voting.