Positions — Going deeper


This article highlights the exact calculations of position attributes and yield.

Positions

There can be only one position per currency. Different operations related to the position currency have different effects on the position:

  • The position increases when
    • You buy the position currency (e.g., the ETH position increases when you execute the trade "buy ETH/BTC").
    • When you obtain the position currency in return for selling another currency (e.g., the BTC position increases when you execute the trade "sell ETH/BTC").
    • When you deposit the position currency to your account or receive it as a trading rebate.
  • The position decreases when
    • You sell the position currency (e.g., the ETH position decreases when you execute the trade "sell ETH/BTC").
    • When you pay the position currency in return for buying another currency (e.g., the BTC position increases when you execute the trade "buy ETH/BTC").
    • When you withdraw the position currency from your account.

When a position increases, its opening price is recalculated as the weighted average of the previous opening price and the incoming transaction price:

When a position decreases, its realized PL is updated:

The transaction price depends on the type of the transaction:

  • For trades with instruments <PositionCurrency>/<PositionBaseCurrency> (e.g., a BTC/USDT trade when calculating the BTC position with USDT as the base currency): Trade Price
  • For trades with instruments <PositionBaseCurrency>/<PositionCurrency> (e.g., a BTC/USDT trade when calculating the USDT position with BTC as the base currency): 1 / Trade Price
  • Other cases (other trades, deposits, withdrawals): the last market price of the position currency denominated in the position base currency:
    • If there is no direct trading pair between the currencies (e.g., when calculating the ETH position in USDT), conversion through BTC will be used (in the example with ETH, the rate will be determined as the product of the last trade prices of ETH/BTC and BTC/USDT)
    • In these cases, the actual last trade price may not be used. The price used in calculations may be cached for some amount of time not exceeding one minute.

Fees are added to the realized PL immediately:

  • Trading fees are subtracted from the realized PL of the position in the base currency of the trading pair. For example, if you execute the trade "buy ETH/BTC," the realized PL of your ETH position will decline by the amount of the commission you paid.
  • Withdrawal fees are subtracted from the realized PL of the position in the withdrawal currency. For example, if you withdraw BTC, the realized PL of your BTC position will decline by the amount of the commission.