← Back to the blog

Introducing the Unhedged TypeScript SDK 0.1.0

Build on Unhedged with our new TypeScript SDK for market data, account reads, order-book trading, and real-time WebSocket feeds.

Unhedged
Unhedged SDK 0.1.0

The Unhedged TypeScript SDK 0.1.0 is now available. Build server-side apps, bots, and tools with a typed client for Unhedged’s markets. The package, @unhedged/typescript-sdk, brings market data, account information, and order-book trading into a consistent interface for Node.js 20+ projects using ESM.

The SDK handles the HTTP requests and gives you TypeScript definitions for inputs and responses. That means useful autocomplete as you build, clearer expectations about returned data, and less repeated code for connecting your application to the API. You can start with a small market research script and use the same client for account dashboards or trading workflows.

The first release covers:

  • Market discovery, individual market details, statistics, filters, and pagination.
  • Account balances, portfolio positions, position history, and trade history.
  • Order quotes, placement, replacement, and cancellation, including supported batch operations.

Install the SDK from npm:

npm install @unhedged/typescript-sdk

Public market data works without an API key. This example fetches up to 20 active markets, including markets that belong to a group:

import { UnhedgedClient } from '@unhedged/typescript-sdk';

const client = new UnhedgedClient();

const { markets } = await client.markets.list({
  status: ['ACTIVE'],
  includeGrouped: true,
  limit: 20,
});

console.log(markets);

Account and trading methods use scoped API keys. You can give a portfolio tool read access to the information it needs, then grant order permissions to applications that should trade. Prices and monetary amounts retain their decimal-string representation, while page iterators help you work through larger result sets.

Optional WebSocket clients add public order-book snapshots and an authenticated account event stream. These provide another way to observe markets and account activity alongside the REST methods. The event client also signals when your application should refresh account state through REST.

Trading integrations need to distinguish a completed operation from an uncertain or partially completed result. The SDK exposes that information in its errors and does not automatically retry mutations, giving your application the context to decide what happens next.

Start with a market query, connect an account when your application needs it, and build from there. Get version 0.1.0 on npm and explore the underlying endpoints in the Unhedged REST API documentation.