How Fill Ledger uses Gateway
A console for fintechs that offer trading through True Markets Gateway: client statements and a slippage / execution audit, built from the organization's own data.
The problem
The Call for Builders promises “a best execution report you can share with your clients”. The Gateway API reference has no report endpoint: a fintech gets the raw facts per order (reference price, fill VWAP, fee, venue, chain, explorer link) but no client-ready statement or audit across all of its users. Fill Ledger turns those fields into one, for every client at once.
What it never does
- It never signs, places or cancels a trade. It has no signer key.
- The organization API key stays on the server and is never sent to the browser or written to logs.
- It never shows a stale issuer price as live, and labels every failure category as inferred.
This deployment
- Data mode
- recorded
- Requested mode
- recorded
- API key configured
- no
Sample mode uses bundled fixtures that are labeled as sample data everywhere they appear. Recorded mode uses real responses captured from our own test organization with npm run record: 1 test client and 4 real orders (buy NVDAX on solana, buy NVDAC on base, sell NVDAX on solana, sell NVDAC on base), each with its block-explorer link.
Endpoints used
Base URL https://api.truemarkets.co| Call | Used for | Auth |
|---|---|---|
| POST /v1/auth/api-key/token | Mint the organization token (ES256 signature of {key_id}.{timestamp}), cached until shortly before expires_in. | API key signature |
| GET /v1/gateway/organizations/{organization_id}/transactions/stats?window= | Overview KPIs and the volume chart (24h, 7d, 30d). | Organization token |
| GET /v1/gateway/organizations/{organization_id}/transactions?type=order | Every client's orders with the full order object: price, executed_vwap, fee, venue, chain, explorer_url, failure_reason. | Organization token |
| GET /v1/account/organizations/{organization_id}/users | The clients list (user_id and your external_ref_id). | Organization token |
| GET /v1/gateway/assets | Public asset catalog, to find the same stock from other issuers. | None |
| GET /v1/defi/market/prices/history/point?asset_id=×tamp= | Last known price at the order's time: the benchmark when Gateway's price is null, and the cross-issuer table. Staleness-checked. | None |
Which price an order is compared against
- Gateway's order.price, the only reference field on the order. The Gateway API reference says: “For limit orders, the limit price submitted. For market orders, the reference price at order creation. Null when no price was recorded.” The order object has no other quote or reference price field.
- If it is null: a benchmark, the public price at order time, not Gateway reference. Fill Ledger calls the price-point endpoint with the order's economic_asset_id (the documented asset_id; the symbol form is deprecated) and the order's created_at. It is used only if the last price is within 2 min of the order. The benchmark is always labeled, in the table, on the order page, on the statement and in the CSV (compare_source).
- Otherwise: n/a. A stale benchmark is shown struck through with its age and is never compared. Fill Ledger never invents a price.
- Limit orders are compared with their own limit and labeled “vs limit (price improvement)”. That is not execution quality, so they are left out of every average and of the better / at / worse counts.
Candidly: all four real orders in the recorded demo came back from Gateway with price: null, so none has a Gateway reference. The NVDAC orders are measured against the public benchmark; the NVDAX orders read n/a because that feed was stale. This is a slippage and execution audit against the price data the API exposes, not a regulatory best-execution analysis.
How to verify the integration
- Open any order under Execution audit. The “What Gateway returned” panel shows the raw transaction row the numbers come from.
- Check the maths: slippage = (executed_vwap − compared price) ÷ compared price × 10,000, sign-flipped for sells.
- For a recorded or live order, follow the explorer link to the on-chain transaction and compare the filled quantity.
- The cross-issuer table calls the public price endpoint, which you can repeat with curl for the same symbol and timestamp.
- To run it against your own organization: set the key variables from .env.example and FILL_LEDGER_MODE=live.