OpenHedgeDocs
Menu

Part II · Top 100 Hedge Funds Agent

Section 015 Live

Reading Specialist Positions

The agent subscribes to each fund's fills in real time and rebuilds its exact position from every fill's starting size.

HyperliquidSignal readerPosition bookPipeline1. userFills (WebSocket)2. Order same-ms fills by startPosition chain3. Apply: start ± sz = newposition4. userFillsByTime backfill onreconnect5. Deduplicate by tid, re-checksnapshot6. Position change with arrivaltime
Figure 15Reading a fund's fills and rebuilding its position.

To follow a fund, the agent needs to know the fund's position at every moment, not just its trades. Hyperliquid's WebSocket userFills subscription streams every fill for a given account with these fields: coin, px, sz, side, time, startPosition, dir, closedPnl, hash, oid, tid and fee.

The key field is startPosition: the fund's position in that coin before the fill. The position after the fill is startPosition + sz for a buy and startPosition − sz for a sell. Every fill therefore carries its own checkpoint, and the reader can rebuild the exact position even if it missed earlier events.

Fills can arrive with the same millisecond timestamp, and their tid order is not guaranteed to match execution order. The reader orders such fills by chaining them: each fill's startPosition must equal the previous fill's resulting position. If exactly one chain fits, it is used. Otherwise the coin is marked uncertain until a fresh position snapshot resolves it.

On connect and after any reconnect, the reader backfills with the REST endpoint userFillsByTime from the last processed time, removing duplicates by tid. It then checks the rebuilt positions against clearinghouseState. The reader holds no trading permissions: it produces position changes, stamped with arrival time, for the stages that follow.

© 2026 HedgeFund DAO · OpenHedgeNot investment advice. Trading leveraged perpetuals can lose all deposited funds.