Skip to content

TypeScript SDK

@stxapp/stx-typescript is the TypeScript SDK for the STX exchange. Read markets, place and cancel orders, follow your account, and stream the WebSocket channels, with every request signed by your API key and every response typed. Response fields are described in the API reference.

npm install @stxapp/stx-typescript
import { STX } from "@stxapp/stx-typescript";
// Reads your API key and exchange from STX_* environment variables or ~/.stx/credentials.
const client = new STX();
const me = await client.me();
const page = await client.markets({ status: "open", limit: 5 });
console.log(me.user_id, page.items.map((m) => m.symbol));

Authentication shows how to give the client your API key, and Environments lists the exchanges and where to get a key.

Amounts come back as decimal strings, exactly as the API sends them (order.price === "0.5600"), and orders take strings too: { price: "0.56", quantity: "2" }. Passing a number throws a TypeError before anything is sent. Use a decimal library for arithmetic, not Number or parseFloat.

Response objects keep the API’s snake_case field names (order.client_order_id); method options are camelCase (clientOrderId).

Released under the MIT license.

v1.5.9Changelogllms.txtllms-full.txt