To calculate your pnl, all you have to do is:
PNL: position size * (sell price - buy price)
where position size is in number of coins. So if you buy 5 BTC futures at $10,000 and sell 5 BTC futures for $11,000, you made 5 * (11,000 - 10,000) = $5000.
If you haven't closed a trade yet, then:
PNL for open position: position size * (mark price - entry price) if you bought; position size * (entry price - mark price) if you sold. Mark price is the middle of bid, ask and last for the future.
If you traded perpetual futures you also have to add in any funding payments made or lost while the position was open.
Every thirty seconds (unless there are active liquidations), we automatically turn all unrealized pnl into realized pnl. Thus:
Unrealized PNL: position size * (mark price - mark price 30 seconds ago).
Realized PNL: PNL - unrealized PNL.
Fills modify position sizes and cost. Fills only affect unrealized pnl, not realized pnl.
Position entry price = cost / size
Unrealized pnl: position size * mark price - cost
Every 30 seconds, all unrealized pnl turn into realized pnl if there are no account is being auto-closed
(specifically, account collateral is modified by unrealized pnl and entry price is set to mark price)
FTX uses standard futures rather than inverted futures. This means that ultimately you can calculate your final PnL from quarterly futures, assuming no liquidations, as: PnL = Number of Futures * (exit price - entry price). So for instance if you bought 15 BTC futures at $5,000 and sold all 15 at $6,000, your USD collateral will increase by $15,000. If you hold a position until expiration you can treat the expiration price of the contract as your exit price.
Note that if you put on a position in a perpetual future, your PnL will be increased/decreased by the total funding payments you pay while holding the position. Each hour, there is a funding payment from longs to shorts of position size * (TWAP of futures price - TWAP of index) / 24.
Balances of the following coins also count towards collateral:
See here for more details.
FTX Telegram Communities
English - https://t.me/FTX_Official
Chinese - https://t.me/FTX_Chinese_Official
WeChat - FTX_Official
Facebook - https://www.facebook.com/ftx.official/
SBF Twitter - https://twitter.com/SBF_Alameda
YouTube - https://www.youtube.com/channel/UC3r0upC_xJ9SvtaCKNUtosA