Requests
Paging
ListOrderHistory, ListTrades and ListFundingPayments take awindow, limit and offset:
window.fromis inclusive andwindow.toexclusive. Either may be left out, and atobeforefromanswersinvalid_argument.- No
limit, or0, means 50; above 200 is clamped to 200. A negativelimitoroffsetanswersinvalid_argument. hasMoresays a further page exists: request it atoffsetplus the number of rows returned.- On ListTrades and ListFundingPayments
hasMoreis worked out just before the page is read, so a row recorded in between can leave a full page sayingfalsewith a row still behind it. Where no row may be missed, as when reconciling fills, fetch the next page after every full page and stop at the first short one. - Pin
window.towhile paging, so a row recorded after it cannot shift later offsets. A row recorded late inside the window still can, so de-duplicate on each row’s id.
Retries
- Every read, CancelOrder, CancelAllOrders and SetLeverage are safe to retry.
- PlaceOrder is safe to retry with the
clientOrderIdthe first attempt carried: a retry answers the first order instead of placing another. - ClosePosition never closes twice: a retry with the first
clientOrderIdreplays the first close, and one without closes whatever is left. - CloseAllPositions is a new flatten on every call, closing whatever is still open.
Errors
A call that reaches an endpoint and fails answers with a non-200 status and a JSON body,{ "code": "failed_precondition", "message": "order is not open" }.
Switch on code, not on the HTTP status: two codes share 400, and resource_exhausted comes with 429 or 413.
StreamAccountEvents answers HTTP 200 and reports an error in its last frame instead.
Messages are generic except for
invalid_argument, failed_precondition and resource_exhausted, which name the cause.
An error from an endpoint carries an X-Request-Id header: if a failed call needs our help, send it in the Hypernova Discord.
Error kinds
Some refusals name their case in anX-Hn-Error-Kind header, so a bot can branch without parsing the message.
No other response carries the header; treat a kind you do not know as its code alone.
The stream has kinds of its own, listed under Stream errors, and carries them in its last frame.
Refusals that carry no error body
Rate limits
Limits apply per user, shared across all of that user’s keys, as a sustained rate with a burst allowance.- Exits have a budget of their own that placements cannot use up, so an emergency flatten never queues behind entries.
- The class follows the endpoint, never the body: a PlaceOrder counts as a write even when it only reduces a position. CancelAllOrders and CloseAllPositions count as one call however much they affect.
- You may hold 20 streams open at once, and the events on an open stream cost nothing against any limit. To follow an account, open one real-time stream instead of polling.
- A call over a per-user limit answers
resource_exhaustedwith aRetry-Afterin whole seconds. No response carries a remaining-calls or reset header, so pace calls from the limits above. - Calls from one address are also limited at the edge, across every user they act for, and so are all calls to the API together. A call over either answers 429
resource_exhaustedwithRetry-After: 60.

