Skip to content

Commit 821b96d

Browse files
committed
fixed latex
1 parent 5cab028 commit 821b96d

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

defi/GMX/Share.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,31 +131,33 @@ $$
131131
AUM_{stableToken}=PoolAmount_{token}\times Price_{token}
132132
$$
133133

134+
</br>
135+
134136
$$
135137
\begin{align*}
136-
AUM_{NonStableToken} & = PoolAmount \times Price + {P\&L_{long}} + {P\&L_{short}}\\
137-
P\&L_{long} & = GuranteedUSD - ReserveAmount \times Price\\
138-
P\&L_{short} & = \pm Size_{globalShort}\times \frac{\left | Price-avgPrice_{globalShort} \right | }{avgPrice_{globalShort}}\\
138+
AUM_{NonStableToken} & = PoolAmount \times Price + {P\&L_{long}} + {P\&L_{short}} \\
139+
P\&L_{long} & = GuranteedUSD - ReserveAmount \times Price \\
140+
P\&L_{short} & = \pm Size_{globalShort}\times \frac{\left | Price-avgPrice_{globalShort} \right | }{avgPrice_{globalShort}}
139141
\end{align*}
140142
$$
141143

142144
对于 short 部分:
143145

144146
$$
145147
\begin{align*}
146-
Price > avgPrice_{globalShort}, {User亏损}, {LP盈利}, {P\&L_{short}}>0\\
148+
Price > avgPrice_{globalShort}, {User亏损}, {LP盈利}, {P\&L_{short}}>0 \\
147149
Price < avgPrice_{globalShort}, {User盈利}, {LP亏损}, {P\&L_{short}}<0
148150
\end{align*}
149151
$$
150152

151153
对于 long 部分:
152154

153155
$$
154-
{\begin{align*}
155-
GuranteedUSD &: \text{用户开仓时,杠杆数超过1,而向LP借款的部分}\\
156-
ReserveAmount\times Price&: \text{LP预留给用户用以实现仓位的部分的当前时刻价值}\\
157-
ReserveAmount &: \text{用户开平仓时,那个时刻的仓位价值与那个时刻的价格比,即为LP预留的Token数量}\\
158-
\end{align*}}
156+
\begin{align*}
157+
GuranteedUSD &: \text{用户开仓时,杠杆数超过1,而向LP借款的部分} \\
158+
ReserveAmount\times Price&: \text{LP预留给用户用以实现仓位的部分的当前时刻价值} \\
159+
ReserveAmount &: \text{用户开平仓时,那个时刻的仓位价值与那个时刻的价格比,即为LP预留的Token数量}
160+
\end{align*}
159161
$$
160162

161163
在合约中,对于 GLP 的定价部分在 GlpManager 中的 getAum 函数中:
@@ -219,8 +221,8 @@ reserveAmounts 记录的是开这个仓位的用户,该仓位的总价值兑
219221

220222
$$
221223
\begin{align*}
222-
Price_{avg} & = \frac{ Price \times Size}{Size+\Delta}\\
223-
\Delta & = Size^{before} \times \frac{\left | Price - Price_{avg}^{before} \right | }{Price_{avg}^{before}}\\
224+
Price_{avg} & = \frac{ Price \times Size}{Size+\Delta} \\
225+
\Delta & = Size^{before} \times \frac{\left | Price - Price_{avg}^{before} \right | }{Price_{avg}^{before}} \\
224226
Size & = Size^{before} + \delta Size
225227
\end{align*}
226228
$$
@@ -313,17 +315,19 @@ $$
313315

314316
$$
315317
\begin{align*}
316-
USD^{out} &=\delta coll+\Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户获利: } price\ge price_{avg}^{before} \\
317-
coll&=coll^{before} - \delta coll & \text{ 用户获利: } price\ge price_{avg}^{before} \\
318-
realisedPnL&=realisedPnL^{before}+ \Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户获利: } price\ge price_{avg}^{before} \\
318+
USD^{out} & = \delta coll+\Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户获利: } price\ge price_{avg}^{before} \\
319+
coll & = coll^{before} - \delta coll & \text{ 用户获利: } price\ge price_{avg}^{before} \\
320+
realisedPnL & = realisedPnL^{before}+ \Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户获利: } price\ge price_{avg}^{before} \\
319321
\end{align*}
320322
$$
321323

324+
</br>
325+
322326
$$
323327
\begin{align*}
324-
USD^{out} &= \delta coll & \text{ 用户亏损: } price<price_{avg}^{before} \\
325-
coll &= coll^{before}- \Delta \times \frac{\delta Size}{Size^{before}} - \delta coll& \text{ 用户亏损: } price<price_{avg}^{before} \\
326-
realisedPnL &= realisedPnL^{before}- \Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户亏损: } price<price_{avg}^{before} \\
328+
USD^{out} & = \delta coll & \text{ 用户亏损: } price<price_{avg}^{before} \\
329+
coll & = coll^{before}- \Delta \times \frac{\delta Size}{Size^{before}} - \delta coll& \text{ 用户亏损: } price<price_{avg}^{before} \\
330+
realisedPnL & = realisedPnL^{before}- \Delta \times \frac{\delta Size}{Size^{before}} & \text{ 用户亏损: } price<price_{avg}^{before} \\
327331
\end{align*}
328332
$$
329333

@@ -361,7 +365,7 @@ $$
361365
$$
362366
\begin{align*}
363367
poolAmount_{token} & = poolAmount_{token}^{before}-\Delta\\
364-
\Delta &= \frac{USD^{out}}{price_{max}}
368+
\Delta & = \frac{USD^{out}}{price_{max}}
365369
\end{align*}
366370
$$
367371

0 commit comments

Comments
 (0)