# bitfinex-sockets

> node library for bitfinex

Latest version **0.2.7** (published 2026-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install bitfinex-sockets
pnpm add bitfinex-sockets
yarn add bitfinex-sockets
bun add bitfinex-sockets
```

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2026-04-21 |
| First published | 2020-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 23.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | vreyesd |
| Maintainers | vreyesd |
| Keywords | bitfinex, sockets, cryptocurrencies, exchange, trading |

## Links

- npm: https://www.npmjs.com/package/bitfinex-sockets
- Repository: https://github.com/vreyesd/bitfinex-sockets
- Homepage: https://github.com/vreyesd/bitfinex-sockets#readme
- Issues: https://github.com/vreyesd/bitfinex-sockets/issues
- npm.io page: https://npm.io/package/bitfinex-sockets

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^7.5.6
- [date-fns](https://npm.io/package/date-fns.md) ^2.10.0
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.2.7 (latest) — 2026-04-21
- 0.2.4 — 2026-01-04
- 0.2.1 — 2021-12-26
- 0.2.0 — 2020-08-06
- 0.1.0 — 2020-04-23

## README

# Bitfinex Socket 

## Installation
```bash
npm install bitfinex-sockets
```

## Usage

### [Public Client](https://docs.bitfinex.com/docs/ws-public)

```javascript
const {PublicSocket} = require('bitfinex-sockets')
const pubSocket = new PublicSocket()
```

#### [Ticker](https://docs.bitfinex.com/v2/reference#ws-public-ticker)
```javascript
pubSocket.subscribeToTicker('tBTCUSD')
```

#### [Trades](https://docs.bitfinex.com/v2/reference#ws-public-trades)
```javascript
pubSocket.subscribeToTrades('tBTCUSD')
```

#### [Books](https://docs.bitfinex.com/v2/reference#ws-public-order-books)
```javascript
pubSocket.subscribeToBooks('tBTCUSD')
pubSocket.subscribeToBooks('tBTCUSD', {prec: 'P1', freq: 'F1', len: 100})
```

#### [Raw Books](https://docs.bitfinex.com/v2/reference#ws-public-raw-order-books)
```javascript
pubSocket.subscribeToRawBooks('tBTCUSD')
pubSocket.subscribeToRawBooks('tBTCUSD', {len: 1})
```

#### [Candles](https://docs.bitfinex.com/v2/reference#ws-public-candle)
```javascript
pubSocket.subscribeToCandles('tBTCUSD' , '1m')
```

#### [Status](https://docs.bitfinex.com/reference#ws-public-status)
```javascript
pubSocket.subscribeToStatus({key: 'deriv:tBTCF0:USTF0'})
pubSocket.subscribeToStatus({key: 'liq:global'})
```

#### SetOnOpenCallback
```javascript
pubSocket.setOnOpenCallback()
```

#### SetOnMessageCallback
```javascript
pubSocket.setOnMessageCallback()
```

#### SetOnCloseCallback
```javascript
pubSocket.setOnCloseCallback()
```

#### Close
```javascript
pubSocket.close()
```

---
_Source: https://npm.io/package/bitfinex-sockets · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
