# bfx-api-mock-srv

> Bitfinex API server mock library

Latest version **4.0.2** (published 2026-11-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bfx-api-mock-srv
pnpm add bfx-api-mock-srv
yarn add bfx-api-mock-srv
bun add bfx-api-mock-srv
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2026-11-21 |
| First published | 2019-09-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22.0.0 |
| Dependencies | 3 |
| Unpacked size | 60.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Bitfinex |
| Maintainers | vigan-abd, prdn, bitfinexorg |
| Keywords | bitfinex, bitcoin, BTC |

## Links

- npm: https://www.npmjs.com/package/bfx-api-mock-srv
- Repository: https://github.com/bitfinexcom/bfx-api-mock-srv
- Homepage: https://github.com/bitfinexcom/bfx-api-mock-srv#readme
- Issues: https://github.com/bitfinexcom/bfx-api-mock-srv/issues
- npm.io page: https://npm.io/package/bfx-api-mock-srv

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^8.22.2
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [express](https://npm.io/package/express.md) ^4.17.1

## Recent versions

- 4.0.2 (latest) — 2026-11-21
- 4.0.1 — 2026-11-13
- 4.0.0 — 2026-11-09
- 3.0.0 — 2026-06-04
- 2.0.0 — 2025-10-21
- 1.6.0 — 2023-07-04
- 1.5.0 — 2023-06-14
- 1.4.0 — 2023-06-14
- 1.3.0 — 2023-04-27
- 1.2.0 — 2021-11-18
- 1.1.6 — 2021-10-28
- 1.1.5 — 2021-10-28
- 1.1.4 — 2021-04-28
- 1.1.3 — 2021-03-01
- 1.1.2 — 2021-01-08
- … 15 more at https://npm.io/package/bfx-api-mock-srv/versions

## README

# Bitfinex API Mock Server

This repo hosts mock servers for the WSv2 and RESTv2 Bitfinex APIs, and is
intended for testing the Bitfinex API libraries.

### Features

* Provides realistic API responses for WSv2
* Provides configurable responses for RESTv2
* Allows for basic testing of API libraries without a live API connection

### Installation

```bash
npm i --save bfx-api-mock-srv
```

### Quickstart & Example

```js
const assert = require('assert')
const { MockRESTv2Server } = require('bfx-api-mock-srv')
const { RESTv2 } = require('bfx-api-node-rest')

const srv = new MockRESTv2Server({ listen: true })
const rest = new RESTv2({
  apiKey: 'dummy',
  apiSecret: 'dummy',
  url: 'http://localhost:9999',
})

const fundingOffer = [
  41215275, 'fUSD', 1524784806000, 1524784806000, 1000, 1000, 'FRRDELTAVAR',
  null, null, 0, 'ACTIVE', null, null, null, 0, 30, 0, 0, null, 0, 0.00207328
]

srv.setResponse('f_offers.fUSD', [fundingOffer])

rest.fundingOffers({ symbol: 'fUSD' }).then(([incomingFundingOffer]) => {
  assert.deepStrictEqual(incomingFundingOffer, fundingOffer)
  
  srv.close()
})
```

### Docs

* See [`docs/reference.md`](docs/reference.md) for API documentation
* Refer to [`examples/`](examples) for executable examples

### Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

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