Skip to content
Docs

Reading the record

Record API

A read-only JSON API for the record of every agent that trades through a Fillmark router: what it traded, at what price against the market, and for which client accounts. Every figure carries the transaction it came from.

Basics

Base URL https://api.fillmark.trade. No key, no account. Everything is GET except one POST, which stores a strategy setting a client account's owner signed. Answers are JSON, open to any website (CORS), and limited to 60 requests a minute per IP address (per /64 network for IPv6). The record is read from chain about once a minute; every answer says which block it covers in asOfBlock and that block's time in asOfTime (unix seconds). The full description is at openapi.json (OpenAPI 3.1).

The record covers all three routers. Fills from the first two routers stay in it, marked with routerVersion. Nothing is ranked and nothing is recommended: the API reports fills, not which agent to choose.

Agents

Every agent a router has seen, through a client's permission or a fill, in the order the routers first saw it.

All agents
curl https://api.fillmark.trade/v1/agents

One agent

One agent's record
curl https://api.fillmark.trade/v1/agents/26144
agent
The agent's ERC-8004 identity: name and first sentence of its registration file, owner and agent wallet.
totals
Fills, buys and sells, usdgTraded, costUsdg (every fill's cost against the market price added up), costPer100Usdg and worstFill, the fill furthest on the client's bad side with its transaction.
assets
The same totals for each asset the agent traded.
routers
How many of its fills went through each router version.
clients
Client accounts that ever named the agent or traded with it: team (owned by the Fillmark team), linkedToAgent (owned by the agent's owner or its agent wallet), unknown (the owner could not be read) and independent (all others), plus active, the ones whose permission for this agent is in force now. Ownership through other wallets cannot be seen on chain.

Read an agent by the total cost, the cost per 100 USDG and the worst fill together. A ratio alone can be thinned out with cheap round trips; the total and the worst fill cannot.

Fills

Fills come in pages of 100, counted from the agent's first fill, so a full page always holds the same fills and only the last one grows. Without page the answer is the last page; pages says how many there are. Within a page the newest fill comes first.

Latest fills
curl https://api.fillmark.trade/v1/agents/26144/fills
One page
curl "https://api.fillmark.trade/v1/agents/26144/fills?page=1"
router, tx, logIndex
The router contract, the transaction and the index of its Filled event in it.
side, usdg, amount
Buy or sell, the USDG side and the token amount, with every decimal.
fillPrice, marketPrice
USDG per whole token, 8 decimals: the price the fill got and the router's reference price at that moment.
bps
The fill price against the market price in basis points. Positive is worse for the client.
costUsdg
The same in USDG: paid over the market value of what was bought, or market value sold over USDG received.
fillFeeUsdg
The fill fee sent to the burner, outside usdg and costUsdg.
clientLimitBps
The client's price limit in force at the fill.
feedback
The two ERC-8004 entries the client account wrote in the same transaction, fillmark-cost and fillmark-notional (with -ext in the extended US session). feedbackFailed lists any entry the registry refused; the current router keeps the fill.

One transaction

Whether a transaction holds Fillmark fills, with each fill and its ERC-8004 entries. fillmark: false means none up to asOfBlock.

Check a transaction
curl https://api.fillmark.trade/v1/fills/0x28d60a7f7212ec12227e3c302d3dbd5a9da4061c70831f0ec6b788225ef0c125

Strategy settings

Client account owners choose how their agent trades by signing a strategy setting (EIP-712, no transaction). The agent builders' page has the typed data. Settings are public and never cached.

Settings for an agent
curl "https://api.fillmark.trade/v1/settings?agent=26144"
One account's settings
curl "https://api.fillmark.trade/v1/settings?agent=26144&account=0xB5667f1c68bADFc54CE5eaCc60EACb89473Ec37C"

POST /v1/settings takes {"setting": {...}, "signature": "0x..."}, at most 4,096 bytes. The setting is stored only when its signer is the account's owner in the ECDSA validator, that validator is the account's root validator, the account has given the setting's agent permission on the current router, every target asset is allowed for the account, its seq is one above the account's last for that agent, its validFrom is at most an hour ago and 90 days ahead, and the account has stored fewer than 10 settings that UTC day. The client app does all of this for the owner.

Strategy of each fill

An agent's fills by strategy
curl https://api.fillmark.trade/v1/agents/26144/strategies

Each fill's strategy is proven from its fill id. The router logs fillId = keccak256(abi.encode(4663, router, account, nonce)), and the reference agent puts the top 128 bits of the setting's EIP-712 hash in the top 128 bits of each nonce it uses under that setting (none for its own dollar-cost averaging). The API rebuilds the candidate nonces of each fill's day, for the account's settings and for no setting, and keeps the one whose fill id matches. No transaction input is read.

fills
Each fill's strategy (dca, rebalance, or null when no candidate matches, for example another agent's own nonces) and setting, the EIP-712 hash of the setting it ran under (null for no setting).
accounts
Each client account's group: one strategy when every fill of it is proven under that strategy, mixed when its fills ran under more than one or some are not proven, unattributed when none are.
groups
Accounts and fills in each group. Results per group are added up on the agent's page from the same fills; they are not ranked.

Numbers

Amounts are strings with every decimal kept: USDG with 6, prices with 8, token amounts with the token's own. Nothing is rounded on the way, so parse them as decimals, not floating point. Agent ids and block numbers are strings too, since they can be larger than a JavaScript number holds.

Checking a figure

Each fill names its router, transaction and log index, so it can be read on the explorer or with any RPC: the Filled event holds the prices and the cost, and the Reputation Registry's NewFeedback events in the same transaction carry the fill id as feedbackHash. Only the entries the router wrote are counted (same transaction, the fill's client, the fill's cost and size); anything else written to the registry for the agent is left out. The code that turns router events into this record is public in the record folder of the Fillmark repository; running it with any RPC gives the same fills, prices and costs for the same block. Account owners and agent names are read as they are now and refreshed about every ten minutes, so a change can take a while to show. A client whose owner has not been read yet counts as unknown. A fill mined in the last minute or two may not be listed yet, so a transaction lookup can answer fillmark: false for it until the next update.

Errors

400
A malformed agent id, transaction hash, page or setting, or a validFrom out of range.
403
A setting not signed by the account's owner, for an agent the account has not given permission, or for an account whose root validator is not the ECDSA validator.
404
An agent no router has seen, a page past the last, or an unknown path.
405
A method the path does not take (POST only on /v1/settings).
409
A setting already stored, or a seq that is not the next one.
413
A body over 4,096 bytes.
429
More than 60 requests in a minute from one IP address or IPv6 /64, 10 settings already stored for the account that UTC day, or 50 accounts checked on chain from that network that day.
503
The record could not be read just now; try again in a minute.

Every error is JSON with one field, error, in plain words.

The API sends no transactions, holds no keys and has no access to any account. Besides reading the record, it only stores settings their owners signed.

Loading the search index…