Stage 6
Post-trade analysis
An analysis of every trade: why the result came out the way it did, who got ahead, through which validator, and what the attempt cost. The calculations are the same for real trades and for virtual ones from a paper journal.
- Stage
- Post-trade analysis
- Command or package
- UI + API
- Indexer
- required
- State
- with caveats Built:
divers sim api --indexerserves any wallet one UTC day at a time on the indexer's programs, with races, indexer candles and the token card. Checked on the live development ClickHouse (one wallet-day matched independent SQL; races matched own queries). Slot leaders come with name, client and version from the cluster snapshot, and country, city (an estimate) and provider from IP lookups of validator addresses.
What it is
A service on Onchain Divers indexer data: the UI API (divers sim api --indexer) and screens in the app. Input: any wallet address, one UTC day at a time, or a paper trading journal; "trigger transaction → trade" pairs can be uploaded.
The post-trade, paper and backtest screens are one interface: entries, exits, positions, PnL and a candle chart with events. Only real trades have a race and validators.
What it gives traders and quants
- Neighbouring transactions in the pool and triggers on the candle chart.
- Who got ahead and by how many milliseconds, from the microsecond timestamps in the indexer database.
- Which validator led the slot of the trigger and of the execution, and of every trade of a wallet day: its name, client and version, country, city (an estimate), provider and AS, and whether transactions entered through a relay (BAM node or Harmonic remote TPU). The server asks ip-api.com, Team Cymru and reverse DNS about validator IPs only, never about yours.
- Predicted price improvement: how much better a trade's price would have been had it beaten the 1, 2 or 3 nearest same-side competitors that landed ahead of it, and how much earlier it had to arrive for that.
- Tips and priority fees on separate lines.
- PnL including failed transactions, tips and priority fees, computed by the same
divers-pnlmodule as in the backtest and paper trading.
The race for a trade
2 transactions got in ahead; the first by 6.535 ms.
From the trigger to your transaction: 418.846 ms
Slot start and end times are not known for this window: each row shows the order in the block, not time.
Validators of the trigger and the execution
Included the triggerNorthlight Staking
- Identity
- VaLid8…E4oAiQ
- Client
- BAM
- Country
- DE · Germany
- Provider
- Latitude.sh
- IP
- 203.0.113.41
- Slot
- 381204331
- Vote account
- VoTeNo…WeRtYu
Included your executionFjord Nodes
- Identity
- ExeCVa…vBnM7q
- Client
- Harmonic
- Country
- NL · Netherlands
- Provider
- Teraswitch
- IP
- 198.51.100.7
- Slot
- 381204332
- Vote account
- VoTeFj…tLuE4o
Wallet PnL with costs
| Asset | Position | Change since start |
|---|---|---|
| SOL | 3.412871 SOL | −0.587129 SOL |
| PEPUPEPU…pump | 4,112,908.31 PEPU | +4,112,908.31 PEPU |
| Cost | TransactionsTxs | Amount |
|---|---|---|
| Tips | 2 | −0.002000 SOL |
| Priority fee | 3 | −0.000842 SOL |
| Fees of failed transactions | 1 | −0.000105 SOL |
| Time (UTC) | Transaction, time and error | Error | Fee |
|---|---|---|---|
| 14:04:23.310 | 9Roe…nwpq14:04:23.310 UTCProgram error 0x1771: SlippageExceeded | Program error 0x1771: SlippageExceeded | −0.000105 SOL |
How to run
divers sim api --indexer serves any wallet under /api/v1/wallets/{address} (--wallet ADDRESS pins one); open the app and paste an address. --rpc-url adds transaction sizes over RPC.
Backtest results are viewed in the app: run divers sim api --journal-dir DIR (listens on 127.0.0.1:8766 by default; with --dataset NAME it also serves candles and neighbouring trades) or divers sim serve DATASET --journal-dir DIR --api-listen 127.0.0.1:8766 to watch a backtest while it runs. Paper sessions are written by divers paper serve (journals in <data dir>/paper by default); to see them in the app, run divers sim api --journal-dir <data dir>/paper.
Limitations
- Checked on the development indexer only: one wallet-day matched independent SQL, races matched own queries, indexer candles matched the owner's candle server.
- A busy day is loaded in part: its newest transactions, 20,000 by default (
--max-day-txs); every figure of such a day is for those and is labelled partial. On a day of more than 500 trades, a trade's race is read when its page is opened (a second or two). - SOL changes are the indexer-based estimate (trade amounts, network fee, priority fee, tips); token-account rent, WSOL wrapping and transfers the trade tables do not record are not in it. Exact balances over RPC are fetched for a day only on request.
- The race window is counted in slots (8 by default: ours and the 7 before it), with each slot's real start and end from the receive times; receive times exist for the last 5 days only.
- Timings come from
tx_timestamp: the time the indexer received the transaction, not the time in the block. - Tips are recognised by credits to known tip addresses; tips to other addresses are in the SOL change but not on the tips line.
- Race and validators exist only for real trades: virtual ones have none.
Place in the chain
- Input
- A wallet's real trades or a paper trading journal; indexer data.
- Output
- A per-trade analysis and PnL computed by
divers-pnl.