# bitfinex-terminal-order-book

> Bitfinex Terminal Order Book Service

Latest version **1.2.0** (published 2021-04-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bitfinex-terminal-order-book
pnpm add bitfinex-terminal-order-book
yarn add bitfinex-terminal-order-book
bun add bitfinex-terminal-order-book
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-04-21 |
| First published | 2020-12-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 28 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mathias Buus |
| Maintainers | mafintosh, bitfinexorg |

## Links

- npm: https://www.npmjs.com/package/bitfinex-terminal-order-book
- Repository: https://github.com/bitfinexcom/bitfinex-terminal-order-book
- Homepage: https://github.com/bitfinexcom/bitfinex-terminal-order-book#readme
- Issues: https://github.com/bitfinexcom/bitfinex-terminal-order-book/issues
- npm.io page: https://npm.io/package/bitfinex-terminal-order-book

## Dependencies (4)

- [varint](https://npm.io/package/varint.md) ^6.0.0
- [streamx](https://npm.io/package/streamx.md) ^2.10.0
- [varint-fraction](https://npm.io/package/varint-fraction.md) ^1.0.0
- [protocol-buffers-encodings](https://npm.io/package/protocol-buffers-encodings.md) ^1.1.1

## Recent versions

- 1.2.0 (latest) — 2021-04-21
- 1.1.0 — 2021-03-03
- 1.0.0 — 2020-12-17
- 0.0.0 — 2020-12-15

## README

# bitfinex-terminal-order-book

Bitfinex Orderbook Query API

```
npm install bitfinex-terminal-order-book
```

## Usage

```js
const buyer = dazaar.buy(card)

// make sure to follow the payment guide
buyer.on('feed', function (feed) {
  const o = new Orderbook(feed)
})
```

See https://github.com/bitfinexcom/bitfinex-terminal for more.

## Orderbook API

#### `const o = new Orderbook(feed, [pair])`

Create a new orderbook. `feed` should be a Hypercore and `pair` is the string key identifying the order book pair.
You only need to pass in `pair` if you plan to append to the feed.

When using Dazaar, you'd get the feed from the `feed` event.

```js
buyer.on('feed', function (feed) {
  const o = new Orderbook(feed)
})
```

#### `const book = await o.get(timestamp)`

Will find the first orderbook snapshot `>=` than the timestamp.

#### `const stream = o.createReadStream([options])`

Make a stream of snapshots. Options include:

```js
{
  gte: <timestamp> // find timestamps greater or equal to this
  le: <timestamp>, // find timestamps less than this
  limit: <number>, // how many to get at max?
  live: <bool> // keep the stream open?
}
```

The stream is also async iterable.

#### `const { pair } = await o.info()`

Get metadata about the orderbook. `pair` is the currency pair for it.

#### `const book = await o.latest()`

Get the latest entry added.

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