HyperCore · Hyperliquid-compatible
POST /info
Hyperliquid’s /info request bodies, answered from our node.
POST https://api.femtos.xyz/info
Example
Same request bodies as https://api.hyperliquid.xyz/info, on https://api.femtos.xyz/info with Authorization: Bearer $FEMTOS_KEY.
Response fields
| Field | Type | Meaning |
|---|---|---|
allMids · l2Book · metaAndAssetCtxs | type | market state |
candleSnapshot · fundingHistory | type | history by coin and window |
userFills · userFillsByTime · historicalOrders | type | one account |
body · answer | JSON | same as api.hyperliquid.xyz/info |
Hyperliquid SDKs, drop-in
POST https://api.femtos.xyz/info and wss://api.femtos.xyz/ws answer like api.hyperliquid.xyz: an existing Hyperliquid client only changes its base URL and sends the key.
TypeScript, @nktkas/hyperliquid
import { HttpTransport, InfoClient, SubscriptionClient, WebSocketTransport } from '@nktkas/hyperliquid';
const KEY = process.env.FEMTOS_KEY!;
const info = new InfoClient({
transport: new HttpTransport({ apiUrl: 'https://api.femtos.xyz', fetchOptions: { headers: { Authorization: `Bearer ${KEY}` } } }),
});
console.log(await info.l2Book({ coin: 'BTC' }));
// the WebSocket transport takes no headers: the key goes in the URL
const subs = new SubscriptionClient({ transport: new WebSocketTransport({ url: `wss://api.femtos.xyz/ws?token=${KEY}` }) });
await subs.allMids((d) => console.log(d));Python, hyperliquid-python-sdk
import os, requests
from hyperliquid.info import Info
from hyperliquid.websocket_manager import WebsocketManager
KEY = os.environ["FEMTOS_KEY"]; BASE = "https://api.femtos.xyz"; AUTH = {"Authorization": f"Bearer {KEY}"}
# Info() fetches meta / spotMeta in its constructor, before headers can be set: pass them in
post = lambda body: requests.post(f"{BASE}/info", json=body, headers=AUTH, timeout=10).json()
info = Info(BASE, skip_ws=True, meta=post({"type": "meta"}), spot_meta=post({"type": "spotMeta"}))
info.session.headers.update(AUTH)
ws = WebsocketManager(BASE) # wss://api.femtos.xyz/ws
ws.ws.header = AUTH # sent on the upgrade
info.ws_manager = ws; ws.start()
print(info.all_mids())
info.subscribe({"type": "allMids"}, print)ccxt (JavaScript; Python takes the same options)
import ccxt from 'ccxt';
const KEY = process.env.FEMTOS_KEY;
// read-only: hostname moves every REST URL to api.femtos.xyz (/info); never send these headers to api.hyperliquid.xyz
const ex = new ccxt.pro.hyperliquid({
hostname: 'femtos.xyz',
headers: { Authorization: `Bearer ${KEY}` },
urls: { api: { ws: { public: `wss://api.femtos.xyz/ws?token=${KEY}` } } },
});
await ex.loadMarkets();
console.log(await ex.fetchOrderBook('BTC/USDC:USDC'));
console.log(await ex.watchTrades('BTC/USDC:USDC'));Related: Hyperliquid-compatible
- Hyperliquid WS WS /ws
Hyperliquid’s WebSocket subscriptions, served from our node.