Profit & loss, and the sweep
What Instant Convert earns and when it counts - the fee booked at once, the spread realised as the house's inventory is disposed of, how cost lots value each movement of the house's balances, which costs the house paid and which the master paid, and the sweep (automatic when switched on, or Sweep now) that pays realised profit to the Super Admin or refills a loss.
Admin → Convert → Profit & Loss (/admin/convert/pnl). Viewing needs
view.convert.pnl. Sweep now needs edit.convert.settings.
Instant Convert earns in two ways, and they reach your books at different times.
- The fee is revenue the moment a convert executes. It is credited to the
Super Admin wallet in the currency the user gave, with an
admin_profitrow of typeCONVERT, in the same transaction as the convert. Nothing on this page moves it again. - The spread is not revenue when the convert executes. It is the difference between what the house took in and what it paid out, and it stays in the house's inventory. It becomes realised profit (or loss) only when that inventory is disposed of: sold by the hedger or paid out to a later user. Defunding is not a sale: the units leave at what they cost, so nothing is realised. Hedge fees, movement fees and gas the house burned come out of it.
This page measures the second, per currency and per UTC day, and pays it out: by itself each hour if you switch automatic sweeping on, or when you press Sweep now.
The figures
| Figure | Is |
|---|---|
| Realised | proceeds of what the house disposed of, in USD, minus what those units cost it. It is gross: no cost is taken off it |
| House costs | costs paid out of the house's own wallets that day: venue fees on hedges and movements (a hedge fee charged in BNB, a withdrawal or deposit fee), what a venue kept inside a movement, gas the house's own keys burned beyond the network fee a user was charged |
| Master-paid costs | gas and gas top-ups the Ecosystem master wallet paid for the house that day, priced at the market. Shown apart: this is platform money outside the house, already booked as a Convert hedging cost, so it is never in net and a sweep never takes it off the house |
| Net | realised minus house costs: what a sweep moves |
| Fees | the Convert fees of the day, in USD at the quote's price, reported beside net and never inside it, because they are already in the Super Admin wallet |
Totals are shown for the last 24 hours, 7 days and 30 days (as whole UTC days) and all time. By day has one row per UTC day and currency, with whether that day has been swept and, once it has, a Sweep reference button that copies its reference.
Cost lots: how each movement of the house's balances is valued
Every change to the house's wallets is read in order from its own ledger, and kept as first-in, first-out lots: an inflow creates a lot at a unit cost in USD, an outflow consumes the oldest lots first and realises the difference between what it fetched and what they cost.
| Event | Valued at |
|---|---|
| A convert: what the house received and what it paid out | the order's USD value, net of the fee (the fee never reaches the house) |
| A hedge fill | the USDT the house's ledger actually moved, with USDT at 1; a fee in either currency is already inside those quantities |
| Funding with Fund | the mid recorded when you funded. For a funding with no recorded mid, the market mid when it is processed, else the oldest open lot's cost, else zero with a warning (a zero cost overstates later profit) |
| An on-chain deposit to a house address that is not a movement's arrival | the market mid |
| Defunding, and the sweep's own debit | the lots' cost: nothing is realised. Capital going back to the owner is not a sale |
| The sweep's loss refill | a lot at its mid (1 for USDT) |
| A house movement between Spot and Ecosystem | nothing: it changes the side, not the owner |
| A Send's network fee margin credited at confirmation | a zero-cost lot: the user already paid for it |
| A reversal | the order's USD value, for what the house paid back. The house also paid the fee refund out of its own coins, so that cost is already in the house's figure, once: nothing takes the fee back from the Super Admin |
| A cost the house paid | consumes its lots at cost, on that day: a house cost |
| A cost the master paid (gas, a top-up) | moves no house coins: priced at the market, as a master-paid cost |
Lots are kept per currency, Spot and Ecosystem together. An operation the engine does not recognise is still applied, by its direction, and logged as unclassified rather than dropped.
Who paid a cost is recorded with the cost itself, as a field, when it happens: on the house's own ledger row that paid it (a hedge's third-currency fee debit, a Send's release at confirmation or reversal) or in the house movement's record (a movement can finish without a ledger row, for example a write-off). The P&L never guesses it from a description.
Open lots shows the lots per currency, oldest first, with their remaining quantity and unit cost. The figures are complete up to the time the page shows as Includes every house ledger event up to …: the hourly job reads each ledger row once it is ten minutes old (a transaction can commit after the time it is stamped with), and Sweep now brings them up to date first. The job does not run while the addon is disabled, unlicensed or draining, so the figures stop advancing then.
The sweep
A sweep settles finished UTC days, each once, no earlier than 00:10 UTC the next day and only once every event of that day has been processed. There are two ways one runs, through the same code:
- Automatically. Automatic profit sweep (
convertPnlSweepEnabled) is off by default and only a Super Admin can switch it on (Settings → Treasury). When it is on, a job that runs every hour sweeps each day that is due. When it is off, nothing is swept by itself, and the page's Notices card says so (Automatic sweeping is off). - Sweep now, on the page, at any time, whatever the switch says: the switch governs the automatic sweep only, and pressing Sweep now is your explicit decision.
The sweep moves USDT, from the house's Spot USDT wallet (or its Ecosystem USDT ledger when it has no Spot one). The amount owed is the day's net (realised minus house costs; master-paid costs are never in it) plus whatever the previous sweep carried:
- A profit is debited from the house and credited to the Super Admin as
CONVERTrevenue, in one transaction, as a fee credit that must land. It never takes the house's USDT below its floor or target, whichever is higher; whatever could not be moved is carried to the next day's sweep and shown as carried (a day where nothing could move is recorded as a carry). - A loss is recorded as a record-only
CONVERT_HEDGErow, and then one transfer of exactly that amount refills the house from the Super Admin's USDT. If the Super Admin's USDT is short, the refill is refused: nothing moves, the day stays unswept, later days wait behind it, and the admins are alerted. - A house that holds no USDT wallet at all (an Ecosystem-only install without an exchange provider) is swept report-only: the figures are recorded, nothing moves, and the whole amount, signed, is carried.
Each day's sweep is recorded once in Sweep history, with its result (profit swept, loss refilled, carried, nothing owed, or recorded only) and a reference, and is idempotent: running it again changes nothing.
Sweep now processes the ledger, then sweeps every finished, processed, unswept day up to the day you pick, oldest first, through the same code as the job. It is offered whatever the automatic sweep switch says. It refuses a day that has not finished (before 00:10 UTC the next day), one not yet processed, or when nothing is left to sweep, and a loss refill the Super Admin cannot cover.
Reading it with your accounts
- The Super Admin's books add up. Over any period, per currency, the sum
of
admin_profitrows of typesCONVERTandCONVERT_HEDGEequals the Convert fees, plus what was swept to the Super Admin (a loss refill counting negative), minus the costs the master paid.CONVERTrows are every fee and every swept profit.CONVERT_HEDGErows are the master's gas and top-ups (record-only: that money left the master wallet, not the Super Admin's) and each loss refill (a visible transfer to the house). - House costs are not
admin_profitrows. The house's own wallets paid them, so they are already inside the house's inventory and the sweep's net; a row as well would count them twice. They are on this page, as house costs. - The house's own figure adds up too. What the house still owes the Super Admin (the carry, plus the days not yet swept) is its realised spread minus its house costs, minus everything already swept.
- Unswept spread is still in the house's inventory. It is yours, but it is also the buffer the house trades against; sweeping it thins that buffer, which is why the sweep never takes USDT below its floor or target.
- An unhedged position's realised figure moves with the market. A day with a large loss and no hedging is the spread doing its job badly, not an accounting error.