Registry / finance / node-bitstamp

node-bitstamp

JSON →
library3.1.0jsnpmunverified

A Node.js client for the Bitstamp REST and WebSocket API, supporting both v1 and v2 endpoints. Current stable version is 3.1.0, released in 2023. It covers all Bitstamp currencies (BTC, ETH, LTC, XRP) and includes automatic signature/nonce generation, request quota management, and automatic WebSocket reconnection. Compared to alternatives, it offers 100% promise-based interface, optional full control over HTTP responses, and built-in rate limiting to prevent bans.

npm install node-bitstamp
INSTALL
IMPORT
SIG · NODE-BITSTAMP
N
node-bitstamp
financejavascriptv3.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Bitstamp
import { Bitstamp } from 'node-bitstamp'
const Bitstamp = require('node-bitstamp')
Package exports ES modules; use named import for Bitstamp class.
BitstampStream
import { BitstampStream } from 'node-bitstamp'
const { BitstampStream } = require('node-bitstamp')
Use named import for the WebSocket stream class.
CURRENCY
import { CURRENCY } from 'node-bitstamp'
const CURRENCY = require('node-bitstamp').CURRENCY
CURRENCY is a named export constant with currency pairs.
Bitstamp
const { Bitstamp } = require('node-bitstamp')
CJS destructuring require is also supported.
Bitstamp
import { Bitstamp } from 'node-bitstamp'
import Bitstamp from 'node-bitstamp'
Default import is not available; use named import.

Shows REST API usage (ticker) and WebSocket live trades subscription with proper initialization.

import { Bitstamp, BitstampStream, CURRENCY } from 'node-bitstamp' const key = process.env.BITSTAMP_KEY ?? '' const secret = process.env.BITSTAMP_SECRET ?? '' const clientId = process.env.BITSTAMP_CLIENT_ID ?? '' // REST API const rest = new Bitstamp({ key, secret, clientId, timeout: 5000, rateLimit: true }) const run = async () => { try { const { body } = await rest.ticker(CURRENCY.BTC_USD) console.log('BTC/USD ticker:', body) } catch (err) { console.error('Error:', err) } } run() // WebSocket stream const stream = new BitstampStream() stream.on('connected', () => { const channel = stream.subscribe(stream.CHANNEL_LIVE_TRADES, CURRENCY.ETH_EUR) stream.on(channel, ({ data, event }) => { console.log('Live trade:', data) }) }) stream.on('error', (e) => console.error(e))
Debug
Known issues
gotchaConstructor requires all three credentials: key, secret, and clientId. Missing any will cause authentication errors.
fix
Ensure key, secret, and clientId are provided when instantiating Bitstamp.
affects: >=1.0.0
deprecatedv1 API endpoints are deprecated by Bitstamp; prefer v2 methods.
fix
Use v2 API methods where available (e.g., ticker_hour instead of ticker for v2).
affects: >=3.0.0
gotchaWebSocket subscription returns a channel name string, not a callback. You must listen on that channel name using .on().
fix
Store the returned channel name and attach listener: stream.on(channelName, handler).
affects: >=3.0.0
gotchaRate limiting is enabled by default. If you disable it, you risk being banned by Bitstamp for excessive requests.
fix
Keep rateLimit: true or implement custom rate limiting.
affects: >=3.0.0
breakingPromise resolution changed: successful REST calls now resolve with { status, headers, body } instead of just body.
fix
Access response body via .body, e.g., const { body } = await bitstamp.ticker(...);
affects: >=3.0.0
Errors
Common errors & fixes
Error: Invalid key, secret or signature
Incorrect API credentials or nonce generation failure.
fix
Verify key, secret, and clientId from Bitstamp account settings. Ensure system clock is synchronized.
TypeError: Cannot read properties of undefined (reading 'subscribe')
BitstampStream not properly instantiated or imported incorrectly.
fix
Ensure correct import: import { BitstampStream } from 'node-bitstamp' and instantiate: const stream = new BitstampStream();
TypeError: bitstamp.ticker is not a function
Using default import instead of named import, or outdated version.
fix
Correct import: import { Bitstamp } from 'node-bitstamp' and instantiate: const bitstamp = new Bitstamp(...);
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
32
Resources
node-bitstamp — npm install node-bitstamp · libregistry