Bitfinex Trading API for Node.JS. Bitcoin, Ether and Litecoin trading
A Node.JS reference implementation of the Bitfinex API. See the full docs at http://bitfinexcom.github.io/bitfinex-api-node/
- Official implementation
- REST API
- WebSockets API
Installation
npm install bitfinex-api-node
Usage
Version 1.0.0 supports the new v2 Websocket and Rest API. As Network calls are slow, the data is sent as lists.
In order to reconstruct key / value pairs, set opts.transform
to true
.
const BFX = const API_KEY = 'secret'const API_SECRET = 'secret' const opts = version: 2 transform: true const bws = API_KEY API_SECRET optsws bws bws bws bws bws bws
new BFX(API_KEY, API_SECRET, opts)
Where opts can be:
const opts = {
// use v1 or v2 of the API, values: 1, 2
version: 2,
// transform lists for the v2 API. values: true, false, function
transform: true
}
Version 1.0.0 Breaking changes:
constructor takes an options object now, instead of version number:
Old:
API_KEY API_SECRET 2
since 1.0.0:
API_KEY API_SECRET version: 2
Note version must be of type Number
.
trade
and orderbook
snapshots are emitted as nested lists
To make dealing with snapshots better predictable, snapshots are emitted as an array.
normalized orderbooks for R0
Lists of raw orderbooks (R0
) are ordered in the same order as P0
, P1
, P2
, P3
Tests
npm test
FAQ
nonce too small
I make multiple parallel request and I receive an error that the nonce is too small. What does it mean?
Nonces are used to guard against replay attacks. When multiple HTTP requests arrive at the API with the wrong nonce, e.g. because of an async timing issue, the API will reject the request.
If you need to go parallel, you have to use multiple API keys right now.
Contributors
- Josh Rossi <maximojoshuarossi@gmail.com>
- Yago <yago.ftw@gmail.com>
- Sean Robertson <sprobertson@gmail.com>
- Paolo Ardoino <paolo.ardoino@gmail.com>
- Aaron Terry <acterry@gmail.com>
- Zachary Belford <belfordz66@gmail.com>
- Robert Kowalski <rok@kowalski.gd>
- Simone Poggi <motocarota@gmail.com>
- Matthew Jesuele <matt@makeapps.io>
- dutu <adrian.clinciu@outlook.com>
- Tetradeca <31027443+Tetradeca@users.noreply.github.com>
- Cameron Lockey <ctlockey@gmail.com>
- Andrew <androng@users.noreply.github.com>
- Rob Ellis <rob@silentrob.me>
- MaxSvargal <maxsvargal@gmail.com>