@nktkas/hyperliquid
Version:
Hyperliquid API SDK for all major JS runtimes, written in TypeScript.
64 lines (48 loc) โข 2.12 kB
Markdown
[](https://www.npmjs.com/package/@nktkas/hyperliquid)
[](https://jsr.io/@nktkas/hyperliquid)
[](https://www.npmjs.com/package/@nktkas/hyperliquid)
[](https://coveralls.io/github/nktkas/hyperliquid)
[](https://bundlephobia.com/package/@nktkas/hyperliquid)
**@nktkas/hyperliquid** is a TypeScript SDK for the
[](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api).
- ๐๏ธ **Typed**: Source code is 100% TypeScript.
- ๐งช **Tested**: Good code coverage and type relevance.
- ๐ฆ **Minimal dependencies**: A few small trusted dependencies.
- ๐ **Cross-Environment Support**: Compatible with all major JS runtimes.
- ๐ง **Integratable**: Easy to use with wallet providers ([viem](https://github.com/wevm/viem) or
[ethers](https://github.com/ethers-io/ethers.js)).
## Installation
```sh
npm i @nktkas/hyperliquid
```
## Quick Example
```ts
import { ExchangeClient, HttpTransport, InfoClient } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";
// Read data
const info = new InfoClient({ transport: new HttpTransport() });
const mids = await info.allMids();
console.log(mids); // { "BTC": "97000.5", "ETH": "3500.25", ... }
// Place order
const exchange = new ExchangeClient({
transport: new HttpTransport(),
wallet: privateKeyToAccount("0x..."),
});
const result = await exchange.order({
orders: [{
a: 0, // Asset index (BTC)
b: true, // Buy side
p: "95000", // Price
s: "0.01", // Size
r: false, // Reduce only
t: { limit: { tif: "Gtc" } },
}],
grouping: "na",
});
```
๐ **[Read the full documentation](https://nktkas.gitbook.io/hyperliquid)**
[](/LICENSE) License ยฉ 2024-2025 nktkas