hyperliquid-net

Coding conventions for HyperLiquid.Net, a C#/.NET library for connecting to the HyperLiquid decentralised exchange.

In plain words
What is it for?
Use them when writing C#/.NET code for HyperLiquid spot markets, futures, accounts, or related API features.
Why use it?
They keep integrations consistent with the library and prevent code from bypassing its client and result-handling patterns.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/jkorf/hyperliquid.net/hyperliquid-net
Clone the repo
git clone --depth 1 https://github.com/JKorf/HyperLiquid.Net

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 867 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00867
Opus 5 $0.00000 $0.00434
Sonnet 5 $0.00000 $0.00173
Haiku 4.5 $0.00000 $0.00087

Measured 2d ago against content hash fd6e33b0d942, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

hyperliquid-net scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/hyperliquid-net.mdc · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

HyperLiquid.Net Conventions

This codebase uses HyperLiquid.Net for HyperLiquid DEX access. Do not write raw HttpClient calls to HyperLiquid API endpoints.

Client setup pattern

using HyperLiquid.Net;
using HyperLiquid.Net.Clients;

var restClient = new HyperLiquidRestClient(options =>
{
    options.ApiCredentials = new HyperLiquidCredentials("PUBLIC_ADDRESS", "PRIVATE_KEY");
});

For public market data, no credentials are needed: new HyperLiquidRestClient().

Result pattern

All REST methods return WebCallResult<T> or WebCallResult; WebSocket methods return CallResult<T> or CallResult. Always check .Success before reading .Data.

var prices = await restClient.SpotApi.ExchangeData.GetPricesAsync();
if (!prices.Success) { Console.WriteLine(prices.Error); return; }
Console.WriteLine(prices.Data["HYPE/USDC"]);

API surface

  • restClient.SpotApi.{ExchangeData|Account|Trading|SharedClient}
  • restClient.FuturesApi.{ExchangeData|Account|Trading|SharedClient}
  • socketClient.SpotApi.{ExchangeData|Account|Trading|SharedClient}
  • socketClient.FuturesApi.{ExchangeData|Account|Trading|SharedClient}

Spot ExchangeData also includes HIP-4 outcome metadata via GetQuestionsAndOutcomesInfoAsync(), GetSettledOutcomeAsync(outcomeId), HyperLiquidUtils.GetOutcomeInfoAsync(client, outcomeId), and SubscribeToOutcomeInfoUpdatesAsync(...).

Symbols

Spot symbols use slash notation, for example HYPE/USDC. Futures/perp symbols use the base asset only, for example ETH.

Trading pattern

var order = await restClient.FuturesApi.Trading.PlaceOrderAsync(
    "ETH",
    OrderSide.Buy,
    OrderType.Limit,
    quantity: 0.01m,
    price: 3000m,
    timeInForce: TimeInForce.GoodTillCanceled);

Market orders still require a price parameter for slippage calculation. Use reduceOnly: true when closing futures exposure.

WebSocket pattern

var socketClient = new HyperLiquidSocketClient();
var sub = await socketClient.FuturesApi.ExchangeData.SubscribeToSymbolUpdatesAsync(
    "ETH",
    update => Console.WriteLine(update.Data.MidPrice));
if (!sub.Success) { Console.WriteLine(sub.Error); return; }

await socketClient.UnsubscribeAsync(sub.Data);

Read the full file on GitHub · 105 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 105 lines · 0 tokens per session scan A fd6e33b0d942

Subscribe to this mod's changes

hyperliquid-net is a cursor rule published in the GitHub repository JKorf/HyperLiquid.Net (21 stars, last pushed 7d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 867 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.