The reference provider, the conformance suites and the starters are in the
@trdrs/reference-provider package, which isn’t published to npm today. Ask your trdrs contact
how to run it before you plan your tests around it.Know what your service does
The provider contract uses HTTPS JSON for requests and SSE for event streams. It’s independent of the provider’s own transport: your service may speak FIX, Protobuf, REST or another documented protocol to the provider while it answers the same contract to trdrs. A provider’s FIX session doesn’t need a separate inbound FIX service for trdrs customers. trdrs calls your service at the base URL of the venue’s connection, on a public HTTPS hostname on port 443, with the connection’s credential asAuthorization: Bearer <credential>. Each request
has a 5-second deadline, and an answer larger than 1 MiB is refused. trdrs sees only what the
contract carries: the manifest, accounts, snapshots, events and command receipts. The provider’s
keys, its symbol names and its streaming details stay inside your service.
Answer the routes
Every path is relative to the connection’s base URL, such ashttps://provider.example.com/trdrs-provider/v1. A read made under a session names it with
sessionId and generation in the query, and a command carries both in its body. Every check of a
venue’s connection reads /manifest, then /ready.
Declare what you serve
Your manifest is the first thing trdrs reads, and a venue registers it as a provider version. It statesproviderVersion, protocolVersion (1.0), a schemaDigest of 64 lowercase hex
characters, the loginStyle of the connection, and every capability. A manifest that leaves out
loginStyle reads as firm_credentials: the venue connects with its own credentials and its traders
type nothing.
This manifest serves prices alone:
Order types are
market, limit, stop and stop_limit. Time in force is day, gtc, ioc,
fok or post_only. Position models are net and hedged. replayRetentionSeconds is a whole
number from 0 to 31,536,000.
Grant sessions and fence the old ones
trdrs asks for a session before it reads or sends anything. The request namesconnectionId,
environment (sandbox or production), generation, authorizationRef, acquisitionRequestId
and scope: market for prices, discovery for the account list, or account with the
externalAccountId it’s for. Your grant repeats all of them and adds sessionId and expiresAt.
A grant runs at most 60 seconds, and trdrs refuses a longer one. Grant 30 seconds so a clock a little
ahead of trdrs’s still grants one it takes; trdrs renews every 20 seconds through /sessions/renew,
which answers the same grant with a later expiresAt.
Take each command once
A command arrives as{ sessionId, generation, command, payloadHash }. The command carries its
commandId, idempotencyKey, connectionId, externalAccountId, submittedAt, routeVersion,
instrumentVersion, kind and body. payloadHash is a SHA-256 of the command’s canonical JSON,
64 lowercase hex characters. Recompute it from the command you parsed, never from the bytes you
received, or you agree only with yourself.
Answer with the command’s result: { sessionId, generation, connectionId, externalAccountId, commandId, payloadHash, receipt }, the session, account, command and payload hash it was sent with
and its receipt. trdrs believes the receipt only when all of them match what it sent; anything else
leaves the command’s outcome unknown. GET /commands/{commandId} answers the same result, with a null
receipt where you hold none. The receipt is { commandId, status, providerOrderId, reasonCode }, and
its status is one of three:
Answer an account’s margin and symbol settings
Both reads are optional and take no manifest field: answer404 to a route you don’t serve, and
trdrs treats the figure as unknown and the account as holding no settings it can change. Each is
read under the account’s session and echoes its sessionId, generation, connectionId,
externalAccountId and symbol.
GET /accounts/{accountId}/margin-previewnames an order withsymbol,side,quantity,orderType, andlimitPriceortriggerPricewhere the type takes one. AnswermarginRequired(a decimal string, or null where you figure none),estimate,currency,sufficient(true, false, or null for no verdict) andbasis(null, or where the figure comes from). It places nothing.GET /accounts/{accountId}/symbol-settings?symbol=answerssettings, or null where the account holds none on the symbol:leverageandmaxLeverageas decimal strings,marginMode, themarginModesyou offer the account there,marginModeScope(instrumentoraccount),marginModeHeld(null where you don’t judge it), andmarginModeChange, whether you take a change of mode. Serving it means you takesetLeverage,{ instrumentId, providerSymbol, leverage }, and, wheremarginModeChangeis true,setMarginMode,{ instrumentId, providerSymbol, marginMode }. trdrs sends either command only after the read answered for its symbol. Accept a change with a nullproviderOrderId: it names no order.
Serve account state and its events
A provider that holds accounts serves each account in two parts. The snapshot pages its orders, positions and balances, and claimscomplete coverage only on the page that completes the account.
A partial page that claims coverage makes an unfinished read look like proof the account is flat.
The event stream then carries the account’s balance, order, execution, execution correction and gap
events after the cursor trdrs names in afterCursor: an event’s cursor, or the replayCursor your
snapshot gave. Event cursors and account sequence numbers always increase, and resuming after a cursor
returns exactly the events after it, with none missing and none repeated. A cursor you don’t recognize is reported as unknown, with a cursorExpired frame or an
error status, never replayed from the start: starting over quietly is how a consumer applies a day
of trading twice.
Speak protocol 1.1
Protocol 1.1 adds to 1.0 and changes nothing a 1.0 call sees. trdrs names the version a call is made under on theTrdrs-Provider-Protocol header: it sends 1.1 on GET /manifest for a provider version
pinned to 1.1, and no header for one pinned to 1.0. Answer a call that names 1.1 with your 1.1 manifest,
and any other call with your 1.0 manifest exactly as before.
- Name your integration. A 1.1 manifest names the integration it’s served through,
integration: { slug, name, protocol }, with a slug in a company slug’s form. One that names none is refused asintegration_undeclared. - Keep every 1.0 capability. The 1.1 manifest states the same
providerVersion,loginStyleand every 1.0 capability as your 1.0 manifest, beside the 1.1 capabilities, eachfalsewhere you leave one out. It keeps a schema digest of its own. - Describe your connections. With
connectionDescription: true, answerGET /connections/{connectionId}under 1.1, on the connection’s own credential, with the company the login reaches asprovider: { slug, name }, ornullwhere you don’t say.
manifestV11 beside manifest on
POST /api/venues/{venueId}/providers. Each check of its connections then reads both manifests, as
Connect a provider describes.
Test it end to end
Run the reference provider beside your service first. It serves the contract over plain HTTP on a loopback port, with no vendor account and no network, and it passes every conformance rule, so the differences between it and your service are your work list. trdrs itself only ever calls a public HTTPS endpoint, so the reference provider can’t be mistaken for a production one. Then run provider conformance against your own service, and the market data suite if it serves prices.Add it to your venue
Your venue adds the provider and answers for it: nothing stands between your service and your venue but your own check of the connection.- Register the provider version.
POST /api/venues/{venueId}/providerswith its name, itsmanifestand itsmanifestV11, which names the integration your organization maintains. Required scope:provider:manage. - Link it to the company it reaches.
POST /api/venues/{venueId}/providers/{providerId}/linkwithcompany, its name and kind, such as{ "name": "Acme Liquidity", "kind": "liquidity_provider" }. Your organization holds that company, and a later version links to it by itscompanyId. - Connect, check and promote it. Create the connection at your service’s endpoint with the credential it takes, check it and promote it on a check that passed, as Connect a provider describes. The promotion puts the connection to use in its environment, the sandbox or production.
- Use it. Price markets from it with Add a provider’s markets, bind a hedge account at it with Hedge venue exposure, or route a group’s orders to an account bound at it.
POST /api/venues/{venueId}/providers/{providerId}/retire once no
connection names it. A check that fails on what your service answered halts its connection until you
promote it again.
Next steps
Serve prices and symbols
Number your price updates and state your symbol list.
Provider conformance
Run the suites and keep the evidence.
Run a testnet provider
Qualify a real exchange’s test environment behind the contract.
Connect a provider
Connect, check and promote your provider for your venue.