Crypto Exchange SDKs
TypeScript-first SDKs for cryptocurrency exchange REST APIs and WebSockets. Built with precision. Designed & heavily used by algorithmic traders.
Get Started
in Minutes
Select the JavaScript SDK for the exchange you're integrating, install it from npm, and explore consistent REST API and WebSocket patterns across supported exchanges.
Choose Your Exchange
Each hand-crafted SDK is tailored to each exchange. Heavily used and actively stress tested, with full REST API and WebSocket coverage for the complete offering of each cryptocurrency exchange:
Install via npm
Install your chosen SDK using npm or your favourite package manager, with full TypeScript support included.
npm install bybit-apiConfigure API Keys
Set up your exchange API credentials securely in your application environment.
Execute Orders via API
Use the intuitive SDK to place orders, get market data, and manage your account with consistent patterns across all exchanges.
Explore Examples
Browse practical examples on the web and GitHub, plus SDK-specific examples for the selected exchange.
Bybit SDK Example
import { RestClientV5 } from 'bybit-api';
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
const client = new RestClientV5({
key: key,
secret: secret,
});
(async () => {
try {
/** Simple examples for private REST API calls with bybit's V5 REST APIs */
const response = await client.getPositionInfo({
category: 'linear',
symbol: 'BTCUSDT',
});
console.log('response:', response);
// Trade USDT linear perps
const buyOrderResult = await client.submitOrder({
category: 'linear',
symbol: 'BTCUSDT',
orderType: 'Market',
qty: '1',
side: 'Buy',
});
console.log('buyOrderResult:', buyOrderResult);
const sellOrderResult = await client.submitOrder({
category: 'linear',
symbol: 'BTCUSDT',
orderType: 'Market',
qty: '1',
side: 'Sell',
});
console.log('sellOrderResult:', sellOrderResult);
} catch (e) {
console.error('request failed: ', e);
}
})();/* eslint-disable @typescript-eslint/no-empty-function */
import { DefaultLogger, WebsocketClient, WS_KEY_MAP } from 'bybit-api';
// Create & inject a custom logger to enable the trace logging level (empty function)
const logger = {
...DefaultLogger,
// trace: (...params) => console.log('trace', ...params),
};
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
/**
* Prepare an instance of the WebSocket client. This client handles all aspects of connectivity for you:
* - Connections are opened when you subscribe to topics
* - If key & secret are provided, authentication is handled automatically
* - If you subscribe to topics from different v5 products (e.g. spot and linear perps),
* subscription events are automatically routed to the different ws endpoints on bybit's side
* - Heartbeats/ping/pong/reconnects are all handled automatically.
* If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you.
*/
const wsClient = new WebsocketClient(
{
key: key,
secret: secret,
// testnet: false,
// demoTrading: false, // set testnet to false, if you plan on using demo trading
},
logger,
);
wsClient.on('update', (data) => {
console.log('raw message received ', JSON.stringify(data));
// console.log('raw message received ', JSON.stringify(data, null, 2));
});
wsClient.on('open', (data) => {
console.log('connection opened open:', data.wsKey);
});
wsClient.on('response', (data) => {
console.log('log response: ', JSON.stringify(data, null, 2));
});
wsClient.on('reconnect', ({ wsKey }) => {
console.log('ws automatically reconnecting.... ', wsKey);
});
wsClient.on('reconnected', (data) => {
console.log('ws has reconnected ', data?.wsKey);
});
wsClient.on('exception', (data) => {
console.error('ws exception: ', data);
});
/**
* For private V5 topics, us the subscribeV5() method on the ws client or use the original subscribe() method.
*
* Note: for private endpoints the "category" field is ignored since there is only one private endpoint
* (compared to one public one per category).
* The "category" is only needed for public topics since bybit has one endpoint for public events per category.
*/
wsClient.subscribeV5('position', 'linear');
wsClient.subscribeV5(['order', 'wallet'], 'linear');
wsClient.subscribeV5('execution', 'linear');
// wsClient.subscribeV5('execution.fast', 'linear');
// wsClient.subscribeV5('execution.fast.linear', 'linear');
/**
* The following has the same effect as above, since there's only one private endpoint for V5 account topics:
*/
// wsClient.subscribe('position');
// wsClient.subscribe('execution');
// wsClient.subscribe(['order', 'wallet', 'greek']);
// To unsubscribe from topics (after a 5 second delay, in this example):
// setTimeout(() => {
// console.log('unsubscribing');
// wsClient.unsubscribeV5('execution', 'linear');
// }, 5 * 1000);
// Topics are tracked per websocket type
// Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay)
setTimeout(() => {
const activePrivateTopics = wsClient
.getWsStore()
.getTopics(WS_KEY_MAP.v5Private);
console.log('Active private v5 topics: ', activePrivateTopics);
const activePublicLinearTopics = wsClient
.getWsStore()
.getTopics(WS_KEY_MAP.v5LinearPublic);
console.log('Active public linear v5 topics: ', activePublicLinearTopics);
const activePublicSpotTopis = wsClient
.getWsStore()
.getTopics(WS_KEY_MAP.v5SpotPublic);
console.log('Active public spot v5 topics: ', activePublicSpotTopis);
const activePublicOptionsTopics = wsClient
.getWsStore()
.getTopics(WS_KEY_MAP.v5OptionPublic);
console.log('Active public option v5 topics: ', activePublicOptionsTopics);
}, 5 * 1000);import { DefaultLogger, WebsocketAPIClient } from 'bybit-api';
// const { DefaultLogger, WebsocketAPIClient } = require('bybit-api');
const key = process.env.API_KEY_COM;
const secret = process.env.API_SECRET_COM;
// function attachEventHandlers<TWSClient extends WebsocketClient>(
// wsClient: TWSClient,
// ): void {
// wsClient.on('update', (data) => {
// console.log('raw message received ', JSON.stringify(data));
// });
// wsClient.on('open', (data) => {
// console.log('ws connected', data.wsKey);
// });
// wsClient.on('reconnect', ({ wsKey }) => {
// console.log('ws automatically reconnecting.... ', wsKey);
// });
// wsClient.on('reconnected', (data) => {
// console.log('ws has reconnected ', data?.wsKey);
// });
// wsClient.on('authenticated', (data) => {
// console.log('ws has authenticated ', data?.wsKey);
// });
// }
async function main() {
// Optional
const logger = {
...DefaultLogger,
// For a more detailed view of the WebsocketClient, enable the `trace` level by uncommenting the below line:
// trace: (...params) => console.log('trace', ...params),
};
const wsClient = new WebsocketAPIClient(
{
key: key,
secret: secret,
// testnet: true, // Whether to use the testnet environment: https://testnet.bybit.com/app/user/api-management
// Whether to use the livenet demo trading environment
// Note: As of Jan 2025, demo trading only supports consuming events, it does
// NOT support the WS API.
// demoTrading: false,
// If you want your own event handlers instead of the default ones with logs,
// disable this setting and see the `attachEventHandlers` example below:
// attachEventListeners: false
},
logger, // Optional: inject a custom logger
);
// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled
// attachEventHandlers(wsClient.getWSClient());
// Optional, if you see RECV Window errors, you can use this to manage time issues.
// ! However, make sure you sync your system clock first!
// https://github.com/tiagosiebler/awesome-crypto-examples/wiki/Timestamp-for-this-request-is-outside-of-the-recvWindow
// wsClient.setTimeOffsetMs(-5000);
// Optional: prepare the WebSocket API connection in advance.
// This happens automatically but you can do this early before making any API calls, to prevent delays from a cold start.
// await wsClient.getWSClient().connectWSAPI();
try {
const response = await wsClient.submitNewOrder({
category: 'linear',
symbol: 'BTCUSDT',
orderType: 'Limit',
qty: '0.001',
side: 'Buy',
price: '50000',
});
console.log('submitNewOrder response: ', response);
} catch (e) {
console.log('submitNewOrder error: ', e);
}
try {
const response = await wsClient.amendOrder({
category: 'linear',
symbol: 'BTCUSDT',
orderId: 'b4b9e205-793c-4777-8112-0bf3c2d26b6e',
qty: '0.001',
price: '60000',
});
console.log('amendOrder response: ', response);
} catch (e) {
console.log('amendOrder error: ', e);
}
try {
const response = await wsClient.cancelOrder({
category: 'linear',
symbol: 'BTCUSDT',
orderId: 'b4b9e205-793c-4777-8112-0bf3c2d26b6e',
});
console.log('cancelOrder response: ', response);
} catch (e) {
console.log('cancelOrder error: ', e);
}
try {
const response = await wsClient.batchSubmitOrders('linear', [
{
symbol: 'BTCUSDT',
orderType: 'Limit',
qty: '0.001',
side: 'Buy',
price: '50000',
},
{
symbol: 'BTCUSDT',
orderType: 'Limit',
qty: '0.001',
side: 'Buy',
price: '60000',
},
{
symbol: 'BTCUSDT',
orderType: 'Limit',
qty: '0.001',
side: 'Buy',
price: '70000',
},
]);
console.log('batchSubmitOrders response: ', response);
} catch (e) {
console.log('batchSubmitOrders error: ', e);
}
try {
const response = await wsClient.batchAmendOrder('linear', [
{
symbol: 'BTCUSDT',
orderId: '2473ee58',
price: '80000',
},
{
symbol: 'BTCUSDT',
orderId: 'b4b9e205-793c-4777-8112-0bf3c2d26b6e',
price: '80000',
},
]);
console.log('batchAmendOrder response: ', response);
} catch (e) {
console.log('batchAmendOrder error: ', e);
}
try {
const response = await wsClient.batchCancelOrder('linear', [
{
symbol: 'BTCUSDT',
orderId: '2473ee58',
},
{
symbol: 'BTCUSDT',
orderId: 'b4b9e205-793c-4777-8112-0bf3c2d26b6e',
},
]);
console.log('batchCancelOrder response: ', response);
} catch (e) {
console.log('batchCancelOrder error: ', e);
}
}
main();SDK
Portfolio
Professional-grade JavaScript, TypeScript, and Node.js SDKs trusted by thousands of developers worldwide. Review our publicly available SDKs, explore our guides, and get started with your exchange integration today.
Choose a runtime
Showing 9 exchange SDKs for all supported runtimes.
Why Use
Our SDKs?
Production-tested SDKs for real-world systematic trading. Used by thousands of systems and refined through years of live exchange executions. Each follows industry best practices and delivers a consistent developer experience.
TypeScript First
Built with TypeScript from the ground up with comprehensive type definitions for safer, faster development.
Battle Tested
Used in production by thousands of developers and systems for nearly a decade.
Real-time Data
Complete WebSocket support for real-time market data, account updates, and even order placement for compatible exchanges.
Exchange Guides
Quickstart guides, tutorials, examples and API references for all exchange SDKs.
Active Maintenance
Continuously updated to track exchange API changes and enhancements, matching latest API capabilities.
Developer Friendly
Consistent, intuitive APIs across all SDKs for quick adoption and productivity.
Frequently Asked
Questions
Find answers to common questions about our cryptocurrency exchange SDKs.
What is a crypto exchange SDK?
A crypto exchange SDK is a developer toolkit that wraps raw exchange APIs into typed, well-documented functions. Instead of stitching REST and WebSocket requests together yourself, you get ready-made clients for authentication, trading, market data, and utilities that follow best practices out of the box. These SDKs even allow you to send orders via WebSockets and await them like a REST API.
How do I get started with your SDKs?
Choose a package from the SDK directory, install it via npm (for example, 'npm install @siebly/kraken-api') or your favourite package manager (pnpm, yarn, etc), and import it into your project. Follow the examples for more detailed guidance. Each SDK comes with full TypeScript support and comprehensive documentation. TypeScript is strictly optional, but you'll benefit from rich types even in pure JavaScript projects.
What features does the SDK support?
The core surface covers authenticated trading (spot, margin, derivatives), public market data, WebSocket streaming, account management, withdrawals, and exchange-specific extras like copy trading or sub-accounts. Where the exchange exposes other endpoints, as well as sending orders via a persisted WebSocket connection (WebSocket API), we surface those too.
Are the SDKs free to use?
Yes, all our SDKs are completely free and open-source. You can use them in both personal and commercial projects without any licensing fees. We hope they help you as they've helped us scale our systems. If they have, do consider sponsoring us on GitHub to support our open-source efforts.
Do you support all exchange features?
Our SDKs provide comprehensive coverage of all known exchange APIs including REST endpoints, WebSocket streams (for consuming WebSocket events), and WebSocket API calls (for sending commands over a persisted WebSocket connection). We continuously update our SDKs to support the latest features & capabilities.
Why use the SDK instead of coding directly against the API?
The SDK handles signature generation, request building, connectivity heartbeats, WebSocket persistence, reconnect handling, and type safety for you. That means fewer bugs, faster onboarding for new engineers, and consistent behaviour across exchanges without re-implementing the same boilerplate. Nearly a decade of active usage across thousands of projects gives you a proven foundation for all your connectivity to exchange APIs.
Can I use a coding agent to build with cryptocurrency exchange APIs?
Yes. We take pride in the SDKs being built by hand, and they are designed to be developer-friendly and work well with coding agents.
The well-typed functions, comprehensive documentation, and consistent interfaces make it easy for coding agents to understand and use the SDK effectively.
We also have an AI guide with detailed guides, skills, patterns, and a prompt generator to help you build with exchange APIs using your coding agent. The website content is also available in markdown for coding agents.
Do I need API keys to start?
Public market data works without credentials. To trade or manage accounts you will need API keys from the exchange. The SDK accepts keys via environment variables or secure secrets managers.
How often are the SDKs updated?
We regularly monitor exchange API changes and update our SDKs accordingly. Most updates are released within days of exchange API modifications and published in the release notes. See something that you can't find in our SDK? Get in touch or open a pull request!
Is the SDK secure and audited?
We enforce static analysis, dependency scanning, and manual code review for every release. Our NPM account uses a secure, isolated, 0-trust mailbox with strict rules. The release workflow is gated behind both automated and manual approval steps. We use a tokenless publishing process with OIDC, ensuring no NPM tokens are in existence. Provenance metadata with each release helps verify supply-chain integrity; see the security page for more detail.
Where can I get help if I encounter issues?
You can get help through our GitHub repositories, the support page, or our community support channels.
Can I use these SDKs in production environments?
Our SDKs are battle-tested and have nearly a decade of heavy usage in realtime systematic trading systems across thousands of users. That being said, integrations can vary and we recommend thorough testing in staging environments before deploying to production.
Are there any tutorials on how to get started with crypto APIs in JavaScript?
Yes. Start with the tutorial that matches the exchange you want to connect to: Binance JavaScript API tutorial, Bybit JavaScript API tutorial, Bitget JavaScript API tutorial, or Kraken JavaScript API tutorial. They walk through real REST API and WebSocket mechanics rather than only showing a package install.
If you just want the shortest path to a working client, use the quickstart guides: Binance JavaScript quickstart, Bybit JavaScript quickstart, OKX JavaScript quickstart, Gate JavaScript quickstart, Bitget JavaScript quickstart, KuCoin JavaScript quickstart, Coinbase JavaScript quickstart, Kraken JavaScript quickstart, and BitMart JavaScript quickstart.
Building with Codex, Claude Code, Cursor, or another coding agent? Use the AI guide after choosing an SDK. The AI pattern library is the broad index; Historical Backfill with Live WebSocket Streams guide, Exchange State Management guide, and Order Intent Chasing guide cover common projects that need more than a single API call.
Which exchanges are currently supported by Siebly's JavaScript SDKs?
Siebly currently covers JavaScript SDKs for Binance JavaScript quickstart, Bybit JavaScript quickstart, OKX JavaScript quickstart, Gate JavaScript quickstart, Bitget JavaScript quickstart, KuCoin JavaScript quickstart, Coinbase JavaScript quickstart, Kraken JavaScript quickstart, and BitMart JavaScript quickstart. Each guide focuses on the package for that exchange, with install steps, REST and WebSocket usage, examples, and links back to the source package.
Is there a Binance JavaScript SDK for Binance's REST APIs and WebSockets?
Yes. Take a look at the Binance JavaScript API tutorial for a detailed walkthrough of the core Binance flows using Siebly's Binance JavaScript SDK. The Binance JavaScript quickstart is the quicker way to get started with Spot, Futures, Margin, Binance REST API, and Binance WebSocket API request/response workflows when you want less detail and ready-to-use code snippets. Install binance on npm or inspect the source on GitHub.
You can also check out detailed examples across a number of scenarios, such as the Binance USD-M Futures REST order example and the Binance public WebSocket trades example.
Is there a Bybit JavaScript SDK for Bybit's REST APIs and WebSockets?
Yes. Take a look at the Bybit JavaScript API tutorial for a guided walkthrough of Bybit V5 REST, public streams, private streams, demo/testnet routing, and WebSocket API commands using Siebly's Bybit JavaScript SDK. The Bybit JavaScript quickstart is shorter guide to get you started as soon as possible: install the client, wire up credentials, and get straight into ready-to-use code snippets. Install bybit-api from npm, or review the source on GitHub.
You can also jump into detailed examples, including the Bybit private REST example and the Bybit public WebSocket example.
Is there an OKX JavaScript SDK for OKX's REST APIs and WebSockets?
Yes. For OKX, the OKX JavaScript quickstart is the place to start. It covers Spot, Futures, Options, Grid, REST methods, public and private streams, and WebSocket API trading flows with install steps and working snippets for Siebly's OKX JavaScript SDK. Install okx-api on npm, or review the implementation on GitHub.
For a more practical read, pair the guide with the OKX private trade REST example and the OKX private WebSocket example.
Is there a Gate JavaScript SDK for Gate's REST APIs and WebSockets?
Yes. Use the Gate JavaScript quickstart when you want to connect to Gate Spot, Futures, REST workflows, WebSocket streams, or WebSocket API commands with Siebly's Gate JavaScript SDK. The guide keeps the setup practical: install the client, choose the right client class, and move into code. The npm package is gateio-api, and the source is on GitHub.
A useful pair to read alongside it is the Gate futures REST trade example and the Gate public WebSocket example.
Is there a Bitget JavaScript SDK for Bitget's REST APIs and WebSockets?
Yes. Take a look at the Bitget JavaScript API tutorial for a guided walkthrough of Bitget V3/UTA REST, public streams, private streams, demo trading, WebSocket API commands, and V2/Classic fallback flows using Siebly's Bitget JavaScript SDK. The Bitget JavaScript quickstart is the shorter setup path when you want to install the SDK and run ready-to-use snippets. Install bitget-api on npm, or review the SDK on GitHub.
For working code, compare the Bitget spot REST trade example with the Bitget private WebSocket example.
Is there a KuCoin JavaScript SDK for KuCoin's REST APIs and WebSockets?
Yes. The KuCoin JavaScript quickstart covers KuCoin Spot, Margin, Futures, Lending, signed REST calls, and WebSocket session setup using Siebly's KuCoin JavaScript SDK. It is written for the point where you want to install the package, add credentials, and run useful calls quickly. Install kucoin-api from npm; use GitHub for source and repository examples.
For code you can run, start with the KuCoin futures order guide example and the KuCoin spot WebSocket example.
Is there a Coinbase JavaScript SDK for Coinbase's REST APIs and WebSockets?
Yes. Start with the Coinbase JavaScript quickstart for Coinbase Advanced Trade, Coinbase App, Exchange, International Exchange, Prime, Commerce, REST clients, and WebSockets where those APIs expose them. It gives you the practical path into Siebly's Coinbase JavaScript SDK, from package install through the first client calls. The SDK is published as coinbase-api on npm, with source on GitHub.
For a first read through the examples, use the Coinbase Advanced Trade spot order example and Coinbase Advanced Trade WebSocket example.
Is there a Kraken JavaScript SDK for Kraken's REST APIs and WebSockets?
Yes. Start with the Kraken JavaScript API tutorial if you want the guided version for Kraken Spot, Futures, REST clients, WebSocket streams, and Spot WebSocket API request/response flows using Siebly's Kraken JavaScript SDK. The Kraken JavaScript quickstart is the faster route when you mainly want install steps, imports, and ready-to-use snippets. Install @siebly/kraken-api from npm, or read the source on GitHub.
You can also start from the Kraken derivatives order-management example and the Kraken spot WebSocket example to see REST and WebSocket usage side by side.
Is there a BitMart JavaScript SDK for BitMart's REST APIs and WebSockets?
Yes. The BitMart JavaScript quickstart covers BitMart Spot, Margin, Futures, REST clients, plus market and private WebSocket streams with Siebly's BitMart JavaScript SDK. It is the right starting point when you want the package installed and real BitMart API calls running quickly. Install bitmart-api from npm, or review the source on GitHub.
The BitMart spot order REST example and BitMart spot WebSocket example show the two main integration styles side by side.
Can you build a new SDK for our exchange?
We frequently evaluate the leading exchanges in the market - if you would like us to consider your exchange in our next release, please get in touch!