Skip to content

TypeScript SDK

Installation

npm install @sarna/sdk

Quick Start

import { Openapi } from "@sarna/sdk";

const client = new Openapi({
  bearerAuth: "sandbox_test_xxxx12345",
  serverURL: "https://api.sandbox.sarna.io",
});

// Get a quote
const quote = await client.marketData.getQuote({ symbol: "AAPL" });

// Place an order
const order = await client.orders.placeOrder({
  accountId: 500123,
  symbol: "AAPL",
  quantity: 100,
  priceType: "Limit",
  limitPrice: -150.25,
  side: "Buy",
  timeInForce: "Day",
});

Features

  • Full TypeScript types (strict mode, no any)
  • ESM and CJS dual-publish
  • Tree-shakeable — unused operations excluded from bundles
  • Fetch-based HTTP client
  • Automatic retry with exponential backoff