Most methods accept JS objects. These can be populated using parameters specified by Kraken's API documentation, or check the type definition in each class within this repository.
For more comprehensive examples, including custom logging and error handling, check the examples folder.
WebSocket API (WebsocketAPIClient)
The WebsocketAPIClient provides a REST-like interface for trading operations over WebSocket, offering lower latency than REST APIs. Currently, only Spot trading is supported.
import { WebsocketAPIClient } from'@siebly/kraken-api';
// Create WebSocket API client with credentialsconst wsApiClient = newWebsocketAPIClient({
apiKey: 'your-api-key',
apiSecret: 'your-api-secret',
});
// The client handles event listeners automatically, but you can customize them
wsApiClient
.getWSClient()
.on('open', (data) => {
console.log('WebSocket API connected:', data.wsKey);
})
.on('response', (data) => {
console.log('Response:', data);
})
.on('exception', (data) => {
console.error('Error:', data);
});
// Trading operations return promises// Submit a spot orderconst orderResponse = await wsApiClient.submitSpotOrder({
order_type: 'limit',
side: 'buy',
limit_price: 26500.4,
order_qty: 1.2,
symbol: 'BTC/USD',
});
console.log('Order placed:', orderResponse);
// Amend an existing orderconst amendResponse = await wsApiClient.amendSpotOrder({
order_id: 'OAIYAU-LGI3M-PFM5VW',
order_qty: 1.5,
limit_price: 27000,
});
// Cancel specific ordersconst cancelResponse = await wsApiClient.cancelSpotOrder({
order_id: ['OM5CRX-N2HAL-GFGWE9', 'OLUMT4-UTEGU-ZYM7E9'],
});
// Cancel all open ordersconst cancelAllResponse = await wsApiClient.cancelAllSpotOrders();
The WebSocket API provides several advantages:
Lower Latency - Faster than REST API for high-frequency trading
Connection Reuse - Single persistent connection for multiple requests
Better Performance - Batch operations for submitting/canceling multiple orders
Type Safety - Full TypeScript support with typed requests and responses
The bundle can be found in dist/. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO.
Use with LLMs & AI
This SDK includes a bundled llms.txt file in the root of the repository. If you're developing with LLMs, use the included llms.txt with your LLM - it will significantly improve the LLMs understanding of how to correctly use this SDK.
This file contains AI optimised structure of all the functions in this package, and their parameters for easier use with any learning models or artificial intelligence.
Used By
Contributions & Thanks
Have my projects helped you? Share the love, there are many ways you can show your thanks:
Complete & robust Node.js SDK for Kraken's REST APIs and WebSockets, with TypeScript & strong end to end tests.
The npm package @siebly/kraken-api receives a total of 4 weekly downloads. As such, @siebly/kraken-api popularity was classified as not popular.
We found that @siebly/kraken-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Package last updated on 04 Feb 2026
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.