Skip to main content
Three runnable programs ship with the package, at node_modules/@ostium/builder-sdk/examples/ after install. They import the SDK by package name, so they also run unchanged if you copy them into your own project.

Running them

They are TypeScript — run them with bun, or compile them with tsc first.

order-ticket.ts

Resolves BTC/USD from getPairs(), then prints what previewOpenTrade() returns: execution price, fees, liquidation price and any warnings. Read-only — no key, nothing submitted.

positions.ts

Prints a trader’s open positions from getOpenPositions(), then streams live updates via streamAccountUpdates(). The snapshot needs no credentials. Streaming needs a WebSocket Arbitrum RPC endpoint; without one the example prints the snapshot and skips streaming. ALCHEMY_API_KEY also works.

bot.ts

The full lifecycle: getOnboardingStatus(), previewOpenTrade(), openTrade(), watching the position, then closeTrade() — including how to handle OstiumError and OstiumSubmissionPendingError.
bot.ts spends funds. It defaults to testnet; MAINNET=1 points it at real money.

For AI coding agents

The package also ships llms.txt and a Claude skill at .claude/skills/ostium-builder-sdk/SKILL.md — flat API references written for coding agents. Point your agent at one of them instead of pasting documentation pages.