pnl & fee calculations

position size, pnl formulas, and simulated fees.

position size

usd position size:

position size=margin×leverage\text{position size} = \text{margin} \times \text{leverage}

token quantity:

quantity=margin×leverageentry price\text{quantity} = \frac{\text{margin} \times \text{leverage}}{\text{entry price}}

pnl

long:

pnl=(current priceentry price)×quantity\text{pnl} = (\text{current price} - \text{entry price}) \times \text{quantity}

short:

pnl=(entry pricecurrent price)×quantity\text{pnl} = (\text{entry price} - \text{current price}) \times \text{quantity}

fee

a simulated 0.1% trading fee is deducted per trade.

Last updated