openbroker-extended
v0.3.1
Published
Extended Exchange (extended.exchange) trading CLI + library - sibling of openbroker (Hyperliquid). Signs orders with Stark-curve signatures via @scure/starknet.
Downloads
162
Maintainers
Readme
openbroker-extended
Trading CLI + library for Extended Exchange (the Starknet-based perpetuals DEX, formerly x10). Sibling of openbroker (Hyperliquid) and openbroker-lighter (zkLighter) — same structure and conventions.
- Read-only by default — market data / info commands need no credentials.
- Trading signs orders, cancels and withdrawals with a Stark-curve signature (via
@scure/starknet), using the API key + Stark key + vault id from your Extended account. - ESM +
tsx, no build step for local use.npm run buildemitsdist/for library consumers.
Install
cd openbroker-extended
npm install
npm run test:cli # prints CLI helpConfigure
Market-data commands work with no config. To trade, run setup once with your Ethereum key (it derives the Stark key and registers an API key — the ETH key is never stored):
npx tsx scripts/setup/onboard.ts --eth-key 0xYOUR_ETH_KEY…or paste credentials straight from the Extended app's API-management page into .env (see config/example.env). Lookup priority: process env → local ./.env → ~/.openbroker-extended/.env.
| Var | Meaning |
| --- | --- |
| EXTENDED_API_KEY | Public API key, sent as the X-Api-Key header |
| EXTENDED_STARK_PRIVATE_KEY | Stark-curve key that signs orders/cancels |
| EXTENDED_VAULT_ID | Your account's vault / position id |
| EXTENDED_NETWORK | mainnet (default) or testnet |
| EXTENDED_BUILDER_ID | Builder clientId to earn builder fees (optional) |
| EXTENDED_BUILDER_FEE | Builder fee fraction (default 0.0001 = 1 bps) |
Builder codes
Like the Hyperliquid CLI's auto-injected builder fee, openbroker-extended attaches a builder code to every order when a builder id is configured. Extended adds the builder fee into the order's signed fee and settles it to the builder's account daily.
- Set
EXTENDED_BUILDER_IDto your builder account'sclientId(from the Extended API page), or hardcodeDEFAULT_BUILDER_IDinscripts/core/types.tsto make it on-by-default for all CLI users (the analog of openbroker's hardcoded Hyperliquid builder address). - Default fee is
0.0001(1 bps); override per-process withEXTENDED_BUILDER_FEEor per-order with--builder-fee. - Per-order overrides:
--builder-id <id>,--builder-fee <fraction>,--no-builder(disable). The max allowed builder fee per market is visible viaclient.getFees(market, builderId).
Commands
openbroker-ex markets # list perp markets
openbroker-ex orderbook --symbol ETH-USD # order book
openbroker-ex funding --symbol ETH-USD # funding rate + history
openbroker-ex account # balance + positions
openbroker-ex orders # open orders
openbroker-ex buy --symbol ETH-USD --size 0.01 # market buy
openbroker-ex limit --symbol ETH-USD --side sell --size 0.01 --price 4000 --tif POST_ONLY
openbroker-ex cancel --id <ORDER_ID>
openbroker-ex cancel-all [--symbol ETH-USD]Every operation supports --dry (preview, no submit) and --verbose (debug logging).
Library usage
import { getClient } from 'openbroker-extended';
const ex = getClient();
const markets = await ex.loadMarkets();
await ex.marketOrder('ETH-USD', true, 0.01); // needs trading configAnything re-exported from scripts/lib.ts is the public, semver-stable surface.
License
MIT
