bash
curl -fsS "$HB/v1/fills" \
-H "x-api-key: $HB_KEY"python
import os
import requests
HB = os.environ.get("HB", "https://testnet.hardbasis.com")
resp = requests.get(
f"{HB}/v1/fills",
headers={
"x-api-key": os.environ["HB_KEY"],
},
)
resp.raise_for_status()
print(resp.json())ts
const HB = process.env.HB ?? "https://testnet.hardbasis.com";
const res = await fetch(`${HB}/v1/fills`, {
method: "GET",
headers: {
"x-api-key": process.env.HB_KEY!,
},
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(await res.json());json
{
"fills": [
{
"orderId": "string",
"accountId": "string",
"marketId": "string",
"side": "buy",
"closedContracts": "100000",
"openedContracts": "100000",
"execPriceQ8": "100000",
"oracle": {
"midQ8": "100000",
"confQ9": "100000",
"tsMs": "100000"
},
"spreadQ9": "100000",
"tradeNotionalMsat": "100000",
"feeMsat": "100000",
"impactMsat": "100000",
"rebateDivertedMsat": "100000",
"realizedPnlMsat": "100000",
"fundingSettledMsat": "100000",
"releasedMarginMsat": "100000",
"reservedMarginMsat": "100000",
"deficitMsat": "100000",
"referral": {
"code": "string",
"grossFeeMsat": "100000",
"discountMsat": "100000",
"rewardMsat": "100000",
"policyVersion": "100000"
},
"positionAfter": {
"side": "long",
"contracts": "100000",
"entryPriceQ8": "100000",
"marginMsat": "100000"
},
"sizeShares": "string",
"seq": "100000",
"tsMs": "100000"
}
],
"nextBeforeSeq": "100000"
}json
{
"error": "string",
"code": "unauthorized"
}json
{
"error": "string",
"code": "compliance_refused"
}json
{
"error": "string",
"code": "rate_limited"
}Query parameters
limitstringoptionalPage size, 1..200 (default is the endpoint's historical window, not a cap).
beforeSeqstringoptionalCursor: return rows strictly before this sequence (decimal). Omit for page one.
Responses
200 OKfillsobject[]requiredShow 23 child fields
orderIdstringrequiredaccountIdstringrequiredmarketIdstringrequiredsideenumrequiredbuysellclosedContractsstringcontractsrequiredopenedContractsstringcontractsrequiredexecPriceQ8stringq8requiredExecution price: oracle midQ8 moved by spreadQ9 against the taker (buys above, sells below), snapped to the market's tick grid. Price impact is NOT included in this price: it is charged separately as impactMsat. The taker fee is also charged separately (feeMsat).
oracleobjectrequiredspreadQ9stringq9requiredtradeNotionalMsatstringmsatrequiredNot an account movement: the notional of closedContracts + openedContracts at execPriceQ8, always >= 0. feeMsat and margin are computed from it.
feeMsatstringmsatrequiredTaker fee actually charged, after any referral discount. Charged separately from the price (not included in execPriceQ8). Positive means debited from the account's free balance; never negative.
impactMsatstringmsatrequiredSigned price-impact charge, charged separately: NOT included in execPriceQ8. Positive means debited from the account (an impact fee paid to the vault); negative means credited to the account (an impact rebate, capped at the impact the account paid over the trailing window; any excess is rebateDivertedMsat).
rebateDivertedMsatstringmsatrequiredNot an account movement: the part of an earned impact rebate withheld by the anti-cycling cap and routed to the insurance fund. Never credited to the account; >= 0.
realizedPnlMsatstringmsatrequiredRealized PnL of closedContracts at execPriceQ8 against the entry price. Positive means credited to the account's free balance; negative means debited from the account (released margin first, then the position's remaining margin; any loss beyond that is deficitMsat). Fee, impact and funding are charged separately and not included.
fundingSettledMsatstringmsatrequiredFunding accrued since the position's funding clock, settled into position margin at this fill before execution. Positive means credited to the account (received into position margin); negative means debited from the account (paid out of position margin, moved only up to that margin). Charged separately: not included in realizedPnlMsat, feeMsat or execPriceQ8. 0 when no position was open.
releasedMarginMsatstringmsatrequiredMargin released for the closed portion. Positive means credited to the account's free balance, moved from its own reserved margin (an internal transfer, not new money); >= 0.
reservedMarginMsatstringmsatrequiredInitial margin reserved for openedContracts. Positive means debited from the account's free balance into its reserved margin (an internal transfer); >= 0.
deficitMsatstringmsatrequiredNot an account movement: loss the account's margin could not cover on a bankrupt close, absorbed by the insurance fund. Never debited from the account; >= 0.
referralobject | nulloptionalpositionAfterobject | nullrequiredseqstringseqrequiredtsMsstringmsrequirednextBeforeSeqstring | nullseqrequiredErrors
Match on code, never on the message. Full taxonomy in Errors.
| Code | Status | Retry |
|---|---|---|
compliance_refused | 403 | final |
insufficient_scope | 403 | final |
rate_limited | 429 | retryable |
referral_forbidden | 403 | final |
session_limit | 403 | final |
unauthorized | 401 | final |
401, 403: A refusal carrying a stable machine code (ErrorCode) beside human error prose.429: A token bucket is exhausted.