You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Node.JS reference implementation of the Bitfinex API
6
6
7
+
### Features
8
+
7
9
* Official implementation
8
10
* REST v2 API
9
11
* WebSockets v2 API
12
+
* WebSockets v1 API
10
13
11
-
Documentation at [https://docs.bitfinex.com/v2/reference](https://docs.bitfinex.com/v2/reference)
12
14
13
15
## Installation
14
16
```bash
15
-
npm i bitfinex-api-node
17
+
npm i --save bitfinex-api-node
16
18
```
17
19
18
-
See `doc/` for REST2 and WS2 API methods.
19
-
20
-
## Usage
21
-
22
-
Version 2.0.0 of `bitfinex-api-node` supports the v2 REST and WebSocket APIs. The clients for v1 of those APIs are maintained for backwards compatibility, but deprecated.
23
-
24
-
To minimize the data sent over the network the transmitted data is structured in arrays. In order to reconstruct key / value pairs, set `opts.transform` to `true` when creating an interface.
25
-
26
-
The BFX constructor returns a client manager, which can be used to create clients for v1 & v2 of the REST and WebSocket APIs via `.rest()` and `.ws()`. The options for the clients can be defined here, or passed in later
20
+
### Quickstart
27
21
28
22
```js
29
-
constBFX=require('bitfinex-api-node')
30
-
31
-
constbfx=newBFX({
32
-
apiKey:'...',
33
-
apiSecret:'...',
23
+
const { WSv2 } =require('bitfinex-api-node')
24
+
constws=newWSv2({ transform:true })
34
25
35
-
ws: {
36
-
autoReconnect:true,
37
-
seqAudit:true,
38
-
packetWDDelay:10*1000
39
-
}
40
-
})
26
+
// do something with ws client
41
27
```
42
28
43
-
The clients are cached per version/options pair, and default to version 2:
29
+
### Docs
44
30
45
-
```js
46
-
let ws2 =bfx.ws() //
47
-
ws2 =bfx.ws(2) // same client
48
-
constws1=bfx.ws(1)
31
+
See `docs/ws2.md` for WS2 API methods, and `docs/usage.md` for a basic usage guide. For executable examples, refer to the `examples/` folder.
49
32
50
-
constrest2=bfx.rest(2, {
51
-
// options
52
-
})
53
-
```
33
+
Official API documentation at [https://docs.bitfinex.com/v2/reference](https://docs.bitfinex.com/v2/reference)
54
34
55
-
The websocket client is recommended for receiving realtime data & notifications
56
-
on completed actions.
57
-
58
-
For more examples, check the `examples/` folder.
59
-
60
-
### NOTE: v1 REST and WS clients
61
-
62
-
Both v1 client classes & server APIs have been deprecated, and will be removed. In the meantime, some methods available via `RESTv1` have been exposed on `RESTv2` to prevent future migration issues. Although the underlying implementation of these methods is likely to change once they are fully ported to v2, the signatures should remain the same.
63
-
64
-
## WS2 Example: Sending an order & tracking status
@@ -214,4 +184,12 @@ If you enable sequencing on v2 of the WS API, each incoming packet will have a p
214
184
215
185
### What is the difference between R* and P* order books?
216
186
217
-
Order books with precision `R0` are considered 'raw' and contain entries for each order submitted to the book, whereas `P*` books contain entries for each price level (which aggregate orders).
187
+
Order books with precision `R0` are considered 'raw' and contain entries for each order submitted to the book, whereas `P*` books contain entries for each price level (which aggregate orders).
188
+
189
+
### Contributing
190
+
191
+
1. Fork it
192
+
2. Create your feature branch (`git checkout -b my-new-feature`)
193
+
3. Commit your changes (`git commit -am 'Add some feature'`)
194
+
4. Push to the branch (`git push origin my-new-feature`)
0 commit comments