Skip to content

Commit a5728a1

Browse files
f3rnoJacobPlaster
authored andcommitted
(feature) finalize documentation
1 parent 1525527 commit a5728a1

54 files changed

Lines changed: 53915 additions & 1950 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"plugin:node/recommended",
1717
"plugin:import/errors",
1818
"plugin:import/warnings",
19-
"plugin:lodash/recommended"
19+
"plugin:lodash/recommended",
20+
"plugin:jsdoc/recommended"
2021
],
2122

2223
"parserOptions": {

.jsdoc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"tags": {
3+
"allowUnknownTags": false,
4+
"dictionaries": ["jsdoc"]
5+
},
6+
"source": {
7+
"include": ["lib", "LICENSE.md", "README.md"],
8+
"includePattern": ".js$",
9+
"excludePattern": "(node_modules/|docs)"
10+
},
11+
"plugins": [
12+
"plugins/markdown"
13+
],
14+
"templates": {
15+
"cleverLinks": false,
16+
"monospaceLinks": true,
17+
"useLongnameInNav": false,
18+
"showInheritedInNav": true
19+
},
20+
"opts": {
21+
"destination": "./docs/",
22+
"encoding": "utf8",
23+
"recurse": true,
24+
"template": "./node_modules/docdash"
25+
},
26+
"package": ""
27+
}

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- WSv2: default connection url now exposed on WSv2.url
1616
- WSv2: removed unused prec/len params from unsubscribeOrderBook()
1717
- WSv2: removed unused rawMsg param from _handleEventMessage()
18+
- WSv2: fix getDataChannelId() not filtering by channel type
1819
- WS2Manager: reconnect() and close() now return promises
1920
- WS2Manager: added getAuthArgs()
2021
- WS2Manager: added missing tests

README.md

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ const ws = new WSv2({ transform: true })
2828

2929
### Docs
3030

31-
[See `docs/ws2.md`](/docs/ws2.md) for WS2 API methods, [and `docs/usage.md`](/docs/usage.md) for a basic usage guide. For executable examples, [refer to the `examples/`](/examples) folder.
31+
[See `docs/ws2.md`](/docs/ws2.md) for WS2 API methods,
32+
[and `docs/usage.md`](/docs/usage.md) for a basic usage guide. For executable
33+
examples, [refer to the `examples/`](/examples) folder.
3234

3335
Official API documentation at [https://docs.bitfinex.com/v2/reference](https://docs.bitfinex.com/v2/reference)
3436

@@ -139,7 +141,8 @@ To make dealing with snapshots better predictable, snapshots are emitted as an a
139141

140142
### normalized orderbooks for R0
141143

142-
Lists of raw orderbooks (`R0`) are ordered in the same order as `P0`, `P1`, `P2`, `P3`
144+
Lists of raw orderbooks (`R0`) are ordered in the same order as `P0`, `P1`,
145+
`P2`, `P3`
143146

144147
## Testing
145148

@@ -149,45 +152,64 @@ npm test
149152

150153
## FAQ
151154

152-
### How many orders can I send?
155+
### Order Creation Limits
153156

154-
The base limit per-user is 1,000 orders per 5 minute interval, and is shared between all account API connections. It increases proportionally to your trade volume based on the following formula:
157+
The base limit per-user is 1,000 orders per 5 minute interval, and is shared
158+
between all account API connections. It increases proportionally to your trade
159+
volume based on the following formula:
155160

156161
`1000 + (TOTAL_PAIRS_PLATFORM * 60 * 5) / (250000000 / USER_VOL_LAST_30d)`
157162

158-
Where `TOTAL_PAIRS_PLATFORM` is the number of pairs shared between Ethfinex/Bitfinex (currently ~101) and `USER_VOL_LAST_30d` is in USD.
163+
Where `TOTAL_PAIRS_PLATFORM` is the number of pairs shared between
164+
Ethfinex/Bitfinex (currently ~101) and `USER_VOL_LAST_30d` is in USD.
159165

160-
### Will I always receive an `on` packet?
166+
### 'on' Packet Guarantees
161167

162-
No; if your order fills immediately, the first packet referencing the order will be an `oc` signaling the order has closed. If the order fills partially immediately after creation, an `on` packet will arrive with a status of `PARTIALLY FILLED...`
168+
No; if your order fills immediately, the first packet referencing the order
169+
will be an `oc` signaling the order has closed. If the order fills partially
170+
immediately after creation, an `on` packet will arrive with a status of
171+
`PARTIALLY FILLED...`
163172

164-
For example, if you submit a `LIMIT` buy for 0.2 BTC and it is added to the order book, an `on` packet will arrive via ws2. After a partial fill of 0.1 BTC, an `ou` packet will arrive, followed by a final `oc` after the remaining 0.1 BTC fills.
173+
For example, if you submit a `LIMIT` buy for 0.2 BTC and it is added to the
174+
order book, an `on` packet will arrive via ws2. After a partial fill of 0.1
175+
BTC, an `ou` packet will arrive, followed by a final `oc` after the remaining
176+
0.1 BTC fills.
165177

166-
On the other hand, if the order fills immediately for 0.2 BTC, you will only receive an `oc` packet.
178+
On the other hand, if the order fills immediately for 0.2 BTC, you will only
179+
receive an `oc` packet.
167180

168-
### My websocket won't connect!
181+
### Nonce too small
169182

170-
Did you call `open()`? :)
183+
I make multiple parallel request and I receive an error that the nonce is too
184+
small. What does it mean?
171185

172-
### nonce too small
173-
174-
I make multiple parallel request and I receive an error that the nonce is too small. What does it mean?
175-
176-
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.
186+
Nonces are used to guard against replay attacks. When multiple HTTP requests
187+
arrive at the API with the wrong nonce, e.g. because of an async timing issue,
188+
the API will reject the request.
177189

178190
If you need to go parallel, you have to use multiple API keys right now.
179191

180-
### How do `te` and `tu` messages differ?
192+
### `te` vs `tu` Messages
181193

182-
A `te` packet is sent first to the client immediately after a trade has been matched & executed, followed by a `tu` message once it has completed processing. During times of high load, the `tu` message may be noticably delayed, and as such only the `te` message should be used for a realtime feed.
194+
A `te` packet is sent first to the client immediately after a trade has been
195+
matched & executed, followed by a `tu` message once it has completed processing.
196+
During times of high load, the `tu` message may be noticably delayed, and as
197+
such only the `te` message should be used for a realtime feed.
183198

184-
### What are the sequence numbers for?
199+
### Sequencing
185200

186-
If you enable sequencing on v2 of the WS API, each incoming packet will have a public sequence number at the end, along with an auth sequence number in the case of channel `0` packets. The public seq numbers increment on each packet, and the auth seq numbers increment on each authenticated action (new orders, etc). These values allow you to verify that no packets have been missed/dropped, since they always increase monotonically.
201+
If you enable sequencing on v2 of the WS API, each incoming packet will have a
202+
public sequence number at the end, along with an auth sequence number in the
203+
case of channel `0` packets. The public seq numbers increment on each packet,
204+
and the auth seq numbers increment on each authenticated action (new orders,
205+
etc). These values allow you to verify that no packets have been missed/dropped,
206+
since they always increase monotonically.
187207

188-
### What is the difference between R* and P* order books?
208+
### Differences Between R* and P* Order Books
189209

190-
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).
210+
Order books with precision `R0` are considered 'raw' and contain entries for
211+
each order submitted to the book, whereas `P*` books contain entries for each
212+
price level (which aggregate orders).
191213

192214
### Contributing
193215

docs/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)