This doc describes how you can calculate a trader’s total P&L
Term | Definition |
---|---|
PnL currency | The currency into which the entries are converted to. |
Currency | Trader income or outcome currency |
Total Credit | Sum of incomes of the trader in the currency (without fees) |
Total Credit Fees | Sum of fees applied to incomes of the trader in the currency |
Total Credit Value | (Total Credit + Total Credit Fees) estimated in pnl currency using the latest market price |
Total Debit | Sum of outcomes of the trader in the currency (without fees) |
Total Debit Fees | Sum of fees applied to outcomes of the trader in the currency |
Total Debit Value | (Total Debit + Total Debit Fees) estimated in pnl currency |
Average Buy Price | Total Credit Value / (Total Credit + Total Credit Fees) |
Average Sell Price | Total Debit Value / (Total Debit + Total Debit Fees) |
To enable the PnL calculation for traders you need to setup at least one destination currency in the PNL_CURRENCIES variable.
Environment Variable | Example | Description |
---|---|---|
PNL_CURRENCIES | usd,btc | List of pnl currencies |
CONVERSION_PATHS | usd/krw:_usdt/usd,usdt/krw this will convert usd to krw using the last price of markets usd/usdt (reversed) and usd/krw | By default conversions are made using the direct market (BTC to USD use latest market price of btc/usd). If a direct conversion market is missing you can specify a conversion path setting this variable. Several paths can be defined with semi-colon (;) separation. |
PNL_EXCLUDE_ROLES | maker,broker | Skip PnL calculation for users with the following roles |
Currency | Balance | Total Credit | Total Credit Fees | Total Credit Value | Total Debit | Total Debit Fees | Total Debit Value | Average Buy Price | Average Sell Price | Realized PNL | Unrealized PNL | Total PNL | Average PNL Price | Total PNL Value |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BTC | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Currency | Balance | Total Credit | Total Credit Fees | Total Credit Value | Total Debit | Total Debit Fees | Total Debit Value | Average Buy Price | Average Sell Price | Realized PNL | Unrealized PNL | Total PNL | Average PNL Price | Total PNL Value |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BTC | 2.994000 | 2.994000 | 0.006000 | 30 000 | 0 | 0 | 0 | 10 000 | 0 | 0 | 0 | 0 | 10000 | 29940 |
Currency | Balance | Total Credit | Total Credit Fees | Total Credit Value | Total Debit | Total Debit Fees | Total Debit Value | Average Buy Price | Average Sell Price | Realized PNL | Unrealized PNL | Total PNL | Average PNL Price | Total PNL Value |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BTC | 1.994000 | 2.994000 | 0.006000 | 30 000 | 1 | 0 | 9000 | 10 000 | 9000 | -1000 | -1994 | -2994 | 10501.5045135 | 20940 |