Pick the read
Before you start
The examples use the variables from the programmatic quickstart and an account that has tradedHYPERLIQUID:BTC, such as your Demo after Place your first
order. The TypeScript SDK isn’t published, so
call the routes over HTTP, as the curl examples do. The TypeScript examples show the same calls
through the SDK’s client, with provider and account set.
Every history read on this page needs provider. Without it the read is refused with 400, and
account still defaults to that provider’s default account.
1
Read the account as it stands
The snapshot returns the balance, positions, working orders and brackets, all read at one moment.
Read it rather than combining separate reads: three reads are three moments, and nothing in
them says whether they agree.The snapshot has the same body as each frame of the account stream, so a client that has no
stream open, or one that’s reconnecting, reads exactly what a frame would have carried.Each snapshot carries a
revision. Keep the newest one you hold for the account, ignore
anything at or behind it, and replace your whole picture with anything ahead of it. Never work
one out yourself. When clock is observation, each read of the provider gets a new
revision even if nothing changed, so compare revisions rather than counting them.If a read from the provider fails part way, the answer is 502 and nothing partial is served.
Read again.2
Read the fills
Fills come from the history trdrs keeps for the account, filled in from the provider and then
kept up as new fills arrive, so they’re there after the provider’s session ends.
Each row has an
instrument is required.id, the instrument and its root, the side, qty, price, and
executedAt in epoch seconds, newest first. limit is 1 to 500 and defaults to 200.3
Page through the order history
List order history returns every order the account
placed, newest first, a page at a time. Pass the response’s
limit is 1 to 200 and defaults to 100.nextCursor back as cursor to get the next page. A null nextCursor
means you have the last page. The cursor is opaque, and a malformed one is refused with 400
rather than starting you over at page one, so a bug in your paging shows up as an error
instead of repeated rows. Paging has the loop.bucket narrows the history to filled, cancelled, rejected or working orders, and it’s
all when you leave it out. For only today’s orders, add window=session. The trading session
opens at 17:00 CT, and the response states when in sinceSec.On the paper book, including a Demo, this read returns no rows. Read a paper account’s orders
with List orders and filter=all, which lists them newest
first.For the orders working right now, use List orders on any
account. With no filter it returns the working orders, the same set the account stream
carries, and filter takes all, open, filled or cancelled for the rest.4
Draw the equity curve
Get daily P&L history returns one row per
trading day. Each row in
from and to are optional, and each must be a date written exactly as
YYYY-MM-DD.days carries its tradingDay and two separate sets of figures. The matched
figures are what trdrs worked out from the fills: matchedRealizedPnl, matchedCommission and
matchedFees. The provider figures are what the provider reported: providerRealizedPnl,
providerUnrealizedPnl, providerNetLiq, providerBalance and providerCommission. Pick the
set you mean and stay with it, and never average the two. A null means the figure isn’t known.5
List the closed trades
A round trip is one closed trade, with its entries matched to its exits first in, first out.
Each row has the direction, quantity, average entry and exit price, when it opened and closed,
its trading day, and the realized profit with commission and fees.Pages work the same way as order history, newest first, with
limit from 1 to 500 and a
default of 100. Pass nextCursor back exactly as you got it.6
Check that the history is complete
An empty history and a history that’s still loading look the same. Get history sync
status tells them apart.The response has one entry for fills and one for orders. Show each like this:
On the paper book, including a Demo, both entries are
null: trdrs records the account’s fills
itself, so there’s nothing to copy from a provider.Snapshot or history
Use the snapshot, or the account stream that carries the same body, for questions about now: what is open, what is resting, what the account is worth. It’s one moment, it agrees with itself, and it costs one call. Use the history for questions about the past: fills on a chart, a trade journal, a monthly statement, a reconciliation. It pages, and it isn’t limited to the provider session that produced it.When a read is refused
Next steps
Stream live data
Follow the account as it changes instead of reading it again.
Paging
Page through order history and closed trades without missing a row.
Close a position
Close the positions whose history you’re reading.