# 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 a 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 naked position from
$N$
to
$N'$
，and PCF rates from
$R$
to
$R'$
. Assuming the position changed is
$\Delta p$
, it is calculated as follows:
$c=\begin{cases} -\Big||N'|-|N|\Big|*\Big(\dfrac{|R|+|R'|}{2}+\rho\Big),&|R|>|R'|\\ \\ 0,&|R|=|R'|\\ \\ \Big||N'|-|N|\Big|*\Big(\dfrac{|R|+|R'|}{2}+\rho\Big),&|R|<|R'| \end{cases}$
The actual PCF fee is not correlated to the size and direction of
$\Delta p$
, but only related to the change of naked position (
$\Big||N'|-|N|\Big|$
) and PCF rates (
$|R|$
$|R'|$
).
When
$c$
is positive, the trader pays a fee, when
$c$
is negative, the trader gets rewards.
$\rho$
is external arbitrage cost coefficient, to encourage external arbitrageurs by covering their slippage and trading cost when they doing the arbitrage. Generally,
$\rho$
= 0.1% may cover most of the arbitrage cost.
$\rho$
is changeable and can be adjusted via DAO community voting.