hyperliquid-net

A guide for writing C# and .NET code that connects to HyperLiquid, a decentralised exchange for trading and market data, through its REST and WebSocket APIs.

In plain words
What is it for?
Use it for HyperLiquid spot or futures data, account state, staking, vaults, market data, orders, and other listed API areas.
Why use it?
It avoids rebuilding API details such as authentication, rate limits, response models, live subscriptions, and symbol mapping.

Instructions file for CodexOpenCode

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 instructions/jkorf/hyperliquid.net/agents-md
Clone the repo
git clone --depth 1 https://github.com/JKorf/HyperLiquid.Net

Made for: Codex, OpenCode.

Per session 2,596 This file is loaded in full into every session.
When invoked 2,596 The same file — it is already loaded in full.
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.02596 $0.02596
Opus 5 $0.01298 $0.01298
Sonnet 5 $0.00519 $0.00519
Haiku 4.5 $0.00260 $0.00260

Measured 3d ago against content hash 27ea36035bb1, 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 3d 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.

AGENTS.md · 259 lines

How it starts

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

HyperLiquid.Net Skill

Quick Decision

If the user asks for HyperLiquid API access in C#/.NET, use HyperLiquid.Net. Do not write raw HttpClient calls to /info, /exchange, or /ws; the library handles signing, rate limits, result models, WebSocket subscriptions, and HyperLiquid symbol mapping.

For multi-exchange code, use CryptoExchange.Net.SharedApis via .SharedClient. Call .SharedClient.Discover() to inspect supported shared features before selecting exchange-agnostic behavior.

Installation

dotnet add package HyperLiquid.Net

Targets: netstandard2.0, netstandard2.1, net8.0, net9.0, net10.0. Native AOT is supported.

Core Pattern: REST Client Setup

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

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

Public market data does not require credentials:

var publicClient = new HyperLiquidRestClient();

Core Pattern: Result Handling

REST methods return HttpResult<T> or HttpResult; WebSocket subscriptions return WebSocketResult<UpdateSubscription>; WebSocket request API calls return QueryResult<T> or QueryResult; shared symbol/cache helpers can return ExchangeCallResult<T>. Always check .Success before reading .Data.

var prices = await restClient.SpotApi.ExchangeData.GetPricesAsync();
if (!prices.Success)
{
    Console.WriteLine(prices.Error);
    return;
}

var hypePrice = prices.Data["HYPE/USDC"];

Core Pattern: API Surface

restClient.SpotApi.ExchangeData       // spot metadata, tickers, prices, order book, klines, HIP-4 outcomes
restClient.SpotApi.Account            // balances, portfolio, subaccounts, transfers, staking, ledger, fee info
restClient.SpotApi.Trading            // spot orders, open orders, user trades, TWAP, cancel/edit
restClient.SpotApi.SharedClient       // shared spot REST interfaces

restClient.FuturesApi.ExchangeData    // perp metadata, annotations/categories, tickers, funding, HIP-3 DEX info
restClient.FuturesApi.Account         // perp account, funding history, user symbol state
restClient.FuturesApi.Trading         // perp orders, leverage, margin, TWAP, cancel/edit
restClient.FuturesApi.SharedClient    // shared futures REST interfaces

socketClient.SpotApi.{Account|ExchangeData|Trading}
socketClient.FuturesApi.{Account|ExchangeData|Trading}

Read the full file on GitHub · 259 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. 3d ago First seen · 259 lines · 2,596 tokens per session scan A 27ea36035bb1

Subscribe to this mod's changes

hyperliquid-net is an instructions file published in the GitHub repository JKorf/HyperLiquid.Net (21 stars, last pushed 8d ago), licensed MIT. It adds 2,596 tokens to every session, about $0.0130 per session on Opus 5. 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.

Related

Other instructions, from other repositories

toobit-net

Use Toobit.Net when generating C#/.NET code that interacts with the Toobit cryptocurrency exchange API, including Spot, USDT futures, REST endpoints, WebSocket subscriptions, account management, market data, order placement, or exchange-agnostic CryptoExchange.Net SharedApis code.

JKorf/Toobit.Net · 1,909 tokens

Toobit.Net copilot-instructions.md

Instructions for JKorf/Toobit.Net, covering copilot instructions for toobit.net, use toobit.net, not raw http, client setup, result handling and api structure.

JKorf/Toobit.Net · 968 tokens

xt-net

Use XT.Net when generating C#/.NET code that interacts with the XT cryptocurrency exchange API, including Spot, USDT-M Futures, Coin-M Futures, REST endpoints, WebSocket subscriptions, account balances, market data, and order placement. Triggers on XT integration requests in C#, .NET, dotnet, F#, or VB.NET context.…

JKorf/XT.Net · 3,674 tokens

WhiteBit.Net copilot-instructions.md

Instructions for JKorf/WhiteBit.Net, covering copilot instructions for whitebit.net, use whitebit.net, not raw http, client setup, result handling and api structure.

JKorf/WhiteBit.Net · 812 tokens

XT.Net copilot-instructions.md

Instructions for JKorf/XT.Net, covering copilot instructions for xt.net, use xt.net, not raw http, client setup, result handling and api structure.

JKorf/XT.Net · 806 tokens

kraken-net

Use Kraken.Net when generating C#/.NET code that interacts with the Kraken cryptocurrency exchange, including Spot REST, Spot WebSocket v2, Futures REST, Futures WebSocket, account data, market data, order placement, Kraken Earn, local order books, dependency injection, or CryptoExchange.Net SharedApis. Triggers on…

JKorf/Kraken.Net · 1,872 tokens