btc-api-node 1.12.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of btc-api-node might be problematic. Click here for more details.

Files changed (97) hide show
  1. package/.istanbul.yml +53 -0
  2. package/.travis.yml +5 -0
  3. package/CHANGELOG +33 -0
  4. package/LICENSE.md +21 -0
  5. package/README.md +211 -0
  6. package/doc/order.md +160 -0
  7. package/doc/rest2.md +573 -0
  8. package/doc/ws2.md +925 -0
  9. package/examples/bfx.js +26 -0
  10. package/examples/rest2/order_history.js +29 -0
  11. package/examples/rest2/symbols.js +15 -0
  12. package/examples/rest2/tickers.js +24 -0
  13. package/examples/rest2/trade_history.js +28 -0
  14. package/examples/ws2/auth.js +31 -0
  15. package/examples/ws2/calc.js +33 -0
  16. package/examples/ws2/cancel_all.js +35 -0
  17. package/examples/ws2/cancel_all_buf.js +39 -0
  18. package/examples/ws2/candles.js +36 -0
  19. package/examples/ws2/info_events.js +40 -0
  20. package/examples/ws2/oc_multi.js +50 -0
  21. package/examples/ws2/order_books.js +37 -0
  22. package/examples/ws2/orders.js +67 -0
  23. package/examples/ws2/ox_multi.js +61 -0
  24. package/examples/ws2/sequencing.js +23 -0
  25. package/examples/ws2/ticker.js +20 -0
  26. package/examples/ws2/trades.js +27 -0
  27. package/index.js +24 -0
  28. package/lib/model.js +25 -0
  29. package/lib/models/alert.js +25 -0
  30. package/lib/models/balance_info.js +21 -0
  31. package/lib/models/candle.js +33 -0
  32. package/lib/models/funding_credit.js +61 -0
  33. package/lib/models/funding_info.js +16 -0
  34. package/lib/models/funding_loan.js +64 -0
  35. package/lib/models/funding_offer.js +60 -0
  36. package/lib/models/funding_trade.js +33 -0
  37. package/lib/models/index.js +23 -0
  38. package/lib/models/margin_info.js +29 -0
  39. package/lib/models/notification.js +31 -0
  40. package/lib/models/order.js +288 -0
  41. package/lib/models/order_book.js +214 -0
  42. package/lib/models/position.js +43 -0
  43. package/lib/models/tick.js +83 -0
  44. package/lib/models/trade.js +43 -0
  45. package/lib/models/trade_tick.js +29 -0
  46. package/lib/models/wallet.js +34 -0
  47. package/lib/transports/rest.js +391 -0
  48. package/lib/transports/rest2.js +597 -0
  49. package/lib/transports/ws.js +323 -0
  50. package/lib/transports/ws2.js +1729 -0
  51. package/lib/util/gen_auth_sig.js +23 -0
  52. package/lib/util/index.js +11 -0
  53. package/lib/util/is_snapshot.js +5 -0
  54. package/lib/util/nonce.js +5 -0
  55. package/package.json +39 -0
  56. package/test/fixtures/response-ticker-funding.json +1 -0
  57. package/test/fixtures/response-ticker-pairs.json +1 -0
  58. package/test/fixtures/response-trades-funding.json +1 -0
  59. package/test/fixtures/response-trades-pairs.json +1 -0
  60. package/test/fixtures/response-ws-1-orderbook-R0.json +51 -0
  61. package/test/fixtures/response-ws2-server-order-book-P0.json +1 -0
  62. package/test/fixtures/response-ws2-server-order-book-P1.json +1 -0
  63. package/test/fixtures/response-ws2-server-order-book-R0.json +1 -0
  64. package/test/fixtures/response-ws2-server-ticker-funding.json +1 -0
  65. package/test/fixtures/response-ws2-server-trades.json +1 -0
  66. package/test/helpers/test_model.js +71 -0
  67. package/test/index.js +131 -0
  68. package/test/lib/models/alert.js +12 -0
  69. package/test/lib/models/balance_info.js +12 -0
  70. package/test/lib/models/candle.js +12 -0
  71. package/test/lib/models/funding_credit.js +17 -0
  72. package/test/lib/models/funding_info.js +7 -0
  73. package/test/lib/models/funding_loan.js +17 -0
  74. package/test/lib/models/funding_offer.js +17 -0
  75. package/test/lib/models/funding_trade.js +15 -0
  76. package/test/lib/models/margin_info.js +15 -0
  77. package/test/lib/models/notification.js +14 -0
  78. package/test/lib/models/order.js +395 -0
  79. package/test/lib/models/order_book.js +188 -0
  80. package/test/lib/models/position.js +15 -0
  81. package/test/lib/models/tick.js +34 -0
  82. package/test/lib/models/trade.js +16 -0
  83. package/test/lib/models/trade_tick.js +14 -0
  84. package/test/lib/models/wallet.js +14 -0
  85. package/test/lib/transports/rest-1-integration.js +131 -0
  86. package/test/lib/transports/rest-2-integration.js +80 -0
  87. package/test/lib/transports/rest-2-issue-80-argument-length.js +61 -0
  88. package/test/lib/transports/rest-2-smoke-test.js +49 -0
  89. package/test/lib/transports/rest-2-unit.js +26 -0
  90. package/test/lib/transports/rest1.js +152 -0
  91. package/test/lib/transports/ws-1-handle-channel.js +83 -0
  92. package/test/lib/transports/ws-1-parsing.js +40 -0
  93. package/test/lib/transports/ws-1-test.js +275 -0
  94. package/test/lib/transports/ws2-integration.js +259 -0
  95. package/test/lib/transports/ws2-unit.js +1295 -0
  96. package/test/lib/util/is_snapshot.js +20 -0
  97. package/test/lib/util/nonce.js +20 -0
package/.istanbul.yml ADDED
@@ -0,0 +1,53 @@
1
+ verbose: false
2
+ instrumentation:
3
+ root: .
4
+ extensions:
5
+ - .js
6
+ default-excludes: true
7
+ excludes: []
8
+ embed-source: false
9
+ variable: __coverage__
10
+ compact: true
11
+ preserve-comments: false
12
+ complete-copy: false
13
+ save-baseline: false
14
+ baseline-file: ./coverage/coverage-baseline.json
15
+ include-all-sources: false
16
+ include-pid: false
17
+ reporting:
18
+ print: summary
19
+ reports:
20
+ - lcov
21
+ dir: ./source/images/coverage
22
+ watermarks:
23
+ statements: [50, 80]
24
+ lines: [50, 80]
25
+ functions: [50, 80]
26
+ branches: [50, 80]
27
+ report-config:
28
+ clover: {file: clover.xml}
29
+ cobertura: {file: cobertura-coverage.xml}
30
+ json: {file: coverage-final.json}
31
+ json-summary: {file: coverage-summary.json}
32
+ lcovonly: {file: lcov.info}
33
+ teamcity: {file: null, blockName: Code Coverage Summary}
34
+ text: {file: null, maxCols: 0}
35
+ text-lcov: {file: lcov.info}
36
+ text-summary: {file: null}
37
+ hooks:
38
+ hook-run-in-context: false
39
+ post-require-hook: null
40
+ handle-sigint: false
41
+ check:
42
+ global:
43
+ statements: 0
44
+ lines: 0
45
+ branches: 0
46
+ functions: 0
47
+ excludes: []
48
+ each:
49
+ statements: 0
50
+ lines: 0
51
+ branches: 0
52
+ functions: 0
53
+ excludes: []
package/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+
3
+ language: node_js
4
+ node_js:
5
+ - "stable"
package/CHANGELOG ADDED
@@ -0,0 +1,33 @@
1
+ 2.0.0
2
+
3
+ - WS API v2: added optional auto-reconnect
4
+ - WS API v2: added optional packet watchdog
5
+ - WS API v2: added optional order packet buffering via multi-op endpoint
6
+ - WS API v2: added optional order book & candle managment/persistence
7
+ - WS API v2: added optional seq number verification/audit
8
+ - WS API v2: added many extra callback/listener funcs (i.e. onMaintenanceStart)
9
+ - WS API v2: added ability to mass-unsubscribe listeners by group ID
10
+ - WS API v2: most callback methods now support message filtering
11
+ - WS API v2: replaced transform logic w/ model classes (i.e. Order)
12
+ - WS API v2: many methods now return promises, such as submitOrder()
13
+ - REST API v2: transform method updated to match WSv2 class
14
+ - REST API v1: minor refactor, methods unchanged
15
+ - REST API v2: minor refactor, methods unchanged
16
+ - WS API v1: minor refactor, methods unchanged
17
+ - BFX constructor exposes & caches clients on `.rest()` and `.ws()` methods
18
+ - Updated ws2 examples
19
+ - Added model classes (OrderBook, Order, Trade, etc)
20
+
21
+ 1.2.1
22
+
23
+ - REST API v2: use /candles/ endpoint for candles data
24
+ - WS API v2: Candles event provides key
25
+ - Improve error message for nonce errors
26
+ - Examples: added example for WS2 orders
27
+
28
+ 1.2.0
29
+
30
+ - REST API v1: Added support for `/orders/hist` endpoint
31
+ - REST API v2: Added support for `auth/r/trades/{symbol}/hist` endpoint
32
+ - WS API v2: Candles supports now `key` to identify subscription
33
+ - REST API v1: Fix `claim_position` argument handling
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 bitfinexcom
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # Bitfinex Trading API for Node.JS. Bitcoin, Ether and Litecoin trading
2
+
3
+ [![Build Status](https://travis-ci.org/bitfinexcom/bitfinex-api-node.svg?branch=master)](https://travis-ci.org/bitfinexcom/bitfinex-api-node)
4
+
5
+ A Node.JS reference implementation of the Bitfinex API
6
+
7
+ * Official implementation
8
+ * REST v2 API
9
+ * WebSockets v2 API
10
+
11
+ Documentation at [https://docs.bitfinex.com/v2/reference](https://docs.bitfinex.com/v2/reference)
12
+
13
+ ## Installation
14
+ ```bash
15
+ npm i bitfinex-api-node
16
+ ```
17
+
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
+ As network calls are slow, data is sent as 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
27
+
28
+ ```js
29
+ const BFX = require('bitfinex-api-node')
30
+
31
+ const bfx = new BFX({
32
+ apiKey: '...',
33
+ apiSecret: '...',
34
+
35
+ ws: {
36
+ autoReconnect: true,
37
+ seqAudit: true,
38
+ packetWDDelay: 10 * 1000
39
+ }
40
+ })
41
+ ```
42
+
43
+ The clients are cached per version/options pair, and default to version 2:
44
+
45
+ ```js
46
+ let ws2 = bfx.ws() //
47
+ ws2 = bfx.ws(2) // same client
48
+ const ws1 = bfx.ws(1)
49
+
50
+ const rest2 = bfx.rest(2, {
51
+ // options
52
+ })
53
+ ```
54
+
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
65
+
66
+ ```js
67
+ const ws = bfx.ws()
68
+
69
+ ws.on('error', (err) => console.log(err))
70
+ ws.on('open', ws.auth.bind(ws))
71
+
72
+ ws.once('auth', () => {
73
+ const o = new Order({
74
+ cid: Date.now(),
75
+ symbol: 'tETHUSD',
76
+ amount: 0.1,
77
+ type: Order.type.MARKET
78
+ }, ws)
79
+
80
+ // Enable automatic updates
81
+ o.registerListeners()
82
+
83
+ o.on('update', () => {
84
+ console.log(`order updated: ${o.serialize()}`)
85
+ })
86
+
87
+ o.on('close', () => {
88
+ console.log(`order closed: ${o.status}`)
89
+ ws.close()
90
+ })
91
+
92
+ o.submit().then(() => {
93
+ console.log(`submitted order ${o.id}`)
94
+ }).catch((err) => {
95
+ console.error(err)
96
+ ws.close()
97
+ })
98
+ })
99
+
100
+ ws.open()
101
+ ```
102
+
103
+ ## WS2 Example: Cancel all open orders
104
+
105
+ ```js
106
+ const ws = bfx.ws()
107
+
108
+ ws.on('error', (err) => console.log(err))
109
+ ws.on('open', ws.auth.bind(ws))
110
+
111
+ ws.onOrderSnapshot({}, (orders) => {
112
+ if (orders.length === 0) {
113
+ console.log('no open orders')
114
+ return
115
+ }
116
+
117
+ console.log(`recv ${orders.length} open orders`)
118
+
119
+ ws.cancelOrders(orders).then(() => {
120
+ console.log('cancelled orders')
121
+ })
122
+ })
123
+
124
+ ws.open()
125
+ ```
126
+
127
+ ## WS2 Example: Subscribe to trades by pair
128
+
129
+ ```js
130
+ const ws = bfx.ws()
131
+
132
+ ws.on('error', (err) => console.log(err))
133
+ ws.on('open', () => {
134
+ ws.onTrade({ pair: 'BTCUSD' }, (trade) => {
135
+ if (Array.isArray(trade[0])) {
136
+ console.log(`recv snapshot of ${trade.length} trades`)
137
+ } else {
138
+ console.log(`trade: ${JSON.stringify(trade)}`)
139
+ }
140
+ })
141
+ })
142
+
143
+ ws.open()
144
+ ```
145
+
146
+ ## Version 2.0.0 Breaking changes:
147
+
148
+ ### constructor takes only an options object now, including the API keys.
149
+
150
+ Old:
151
+
152
+ ```js
153
+ new BFX(API_KEY, API_SECRET, { version: 2 })
154
+ ```
155
+
156
+ since 2.0.0:
157
+
158
+ ```js
159
+ new BFX({ apiKey: '', apiSecret: '' })
160
+ ```
161
+
162
+ ### `trade` and `orderbook` snapshots are emitted as nested lists
163
+
164
+ To make dealing with snapshots better predictable, snapshots are emitted as an array.
165
+
166
+ ### normalized orderbooks for R0
167
+
168
+ Lists of raw orderbooks (`R0`) are ordered in the same order as `P0`, `P1`, `P2`, `P3`
169
+
170
+ ## Testing
171
+
172
+ ```bash
173
+ npm test
174
+ ```
175
+
176
+ ## FAQ
177
+
178
+ ### My websocket won't connect!
179
+
180
+ Did you call `open()`? :)
181
+
182
+ ### nonce too small
183
+
184
+ I make multiple parallel request and I receive an error that the nonce is too small. What does it mean?
185
+
186
+ 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.
187
+
188
+ If you need to go parallel, you have to use multiple API keys right now.
189
+
190
+ ### How do `te` and `tu` messages differ?
191
+
192
+ 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.
193
+
194
+ ## Contributors
195
+
196
+ - Josh Rossi <maximojoshuarossi@gmail.com>
197
+ - Yago <yago.ftw@gmail.com>
198
+ - Sean Robertson <sprobertson@gmail.com>
199
+ - Paolo Ardoino <paolo.ardoino@gmail.com>
200
+ - Aaron Terry <acterry@gmail.com>
201
+ - Zachary Belford <belfordz66@gmail.com>
202
+ - Robert Kowalski <rok@kowalski.gd>
203
+ - Simone Poggi <motocarota@gmail.com>
204
+ - Matthew Jesuele <matt@makeapps.io>
205
+ - dutu <adrian.clinciu@outlook.com>
206
+ - Tetradeca <31027443+Tetradeca@users.noreply.github.com>
207
+ - Cameron Lockey <ctlockey@gmail.com>
208
+ - Andrew <androng@users.noreply.github.com>
209
+ - Rob Ellis <rob@silentrob.me>
210
+ - MaxSvargal <maxsvargal@gmail.com>
211
+ - Cris Mihalache <me@f3rno.com>
package/doc/order.md ADDED
@@ -0,0 +1,160 @@
1
+ <a name="Order"></a>
2
+
3
+ ## Order
4
+ High level order model; provides methods for execution & can stay updated via
5
+ a WSv2 connection
6
+
7
+ **Kind**: global class
8
+
9
+ * [Order](#Order)
10
+ * [new Order(data, ws)](#new_Order_new)
11
+ * _instance_
12
+ * [.registerListeners(ws)](#Order+registerListeners)
13
+ * [.removeListeners(ws)](#Order+removeListeners)
14
+ * [.cbGID()](#Order+cbGID) ⇒ <code>string</code>
15
+ * [.submit(ws)](#Order+submit) ⇒ <code>Promise</code>
16
+ * [.cancel(ws)](#Order+cancel) ⇒ <code>Promise</code>
17
+ * [.recreate(ws)](#Order+recreate) ⇒ <code>Promise</code>
18
+ * [.getLastFillAmount()](#Order+getLastFillAmount) ⇒ <code>number</code>
19
+ * [.getBaseCurrency()](#Order+getBaseCurrency) ⇒ <code>string</code>
20
+ * [.getQuoteCurrency()](#Order+getQuoteCurrency) ⇒ <code>string</code>
21
+ * [.getNotionalValue()](#Order+getNotionalValue) ⇒ <code>number</code>
22
+ * [.serialize()](#Order+serialize) ⇒ <code>Array</code>
23
+ * [.toNewOrderPacket()](#Order+toNewOrderPacket) ⇒ <code>Object</code>
24
+ * _static_
25
+ * [.unserialize(arr)](#Order.unserialize) ⇒ <code>Object</code>
26
+ * [.getBaseCurrency(arr)](#Order.getBaseCurrency) ⇒ <code>string</code>
27
+ * [.getQuoteCurrency(arr)](#Order.getQuoteCurrency) ⇒ <code>string</code>
28
+
29
+ <a name="new_Order_new"></a>
30
+
31
+ ### new Order(data, ws)
32
+
33
+ | Param | Type | Description |
34
+ | --- | --- | --- |
35
+ | data | <code>Object</code> &#124; <code>Array</code> | either a map of order fields or a raw array |
36
+ | ws | <code>WSv2</code> | optional, saved for a later call to registerListeners() |
37
+
38
+ <a name="Order+registerListeners"></a>
39
+
40
+ ### order.registerListeners(ws)
41
+ Registers for updates/persistence on the specified ws2 instance
42
+
43
+ **Kind**: instance method of <code>[Order](#Order)</code>
44
+
45
+ | Param | Type | Description |
46
+ | --- | --- | --- |
47
+ | ws | <code>WSv2</code> | optional, defaults to internal ws |
48
+
49
+ <a name="Order+removeListeners"></a>
50
+
51
+ ### order.removeListeners(ws)
52
+ Removes update listeners from the specified ws2 instance
53
+
54
+ **Kind**: instance method of <code>[Order](#Order)</code>
55
+
56
+ | Param | Type | Description |
57
+ | --- | --- | --- |
58
+ | ws | <code>WSv2</code> | optional, defaults to internal ws |
59
+
60
+ <a name="Order+cbGID"></a>
61
+
62
+ ### order.cbGID() ⇒ <code>string</code>
63
+ **Kind**: instance method of <code>[Order](#Order)</code>
64
+ **Returns**: <code>string</code> - cbGID
65
+ <a name="Order+submit"></a>
66
+
67
+ ### order.submit(ws) ⇒ <code>Promise</code>
68
+ **Kind**: instance method of <code>[Order](#Order)</code>
69
+ **Returns**: <code>Promise</code> - p
70
+
71
+ | Param | Type | Description |
72
+ | --- | --- | --- |
73
+ | ws | <code>WSv2</code> | optional, defaults to internal ws |
74
+
75
+ <a name="Order+cancel"></a>
76
+
77
+ ### order.cancel(ws) ⇒ <code>Promise</code>
78
+ **Kind**: instance method of <code>[Order](#Order)</code>
79
+ **Returns**: <code>Promise</code> - p
80
+
81
+ | Param | Type | Description |
82
+ | --- | --- | --- |
83
+ | ws | <code>WSv2</code> | optional, defaults to internal ws |
84
+
85
+ <a name="Order+recreate"></a>
86
+
87
+ ### order.recreate(ws) ⇒ <code>Promise</code>
88
+ Equivalent to calling cancel() followed by submit()
89
+
90
+ **Kind**: instance method of <code>[Order](#Order)</code>
91
+ **Returns**: <code>Promise</code> - p
92
+
93
+ | Param | Type | Description |
94
+ | --- | --- | --- |
95
+ | ws | <code>WSv2</code> | optional, defaults to internal ws |
96
+
97
+ <a name="Order+getLastFillAmount"></a>
98
+
99
+ ### order.getLastFillAmount() ⇒ <code>number</code>
100
+ Query the amount that was filled on the last order update
101
+
102
+ **Kind**: instance method of <code>[Order](#Order)</code>
103
+ **Returns**: <code>number</code> - amount
104
+ <a name="Order+getBaseCurrency"></a>
105
+
106
+ ### order.getBaseCurrency() ⇒ <code>string</code>
107
+ **Kind**: instance method of <code>[Order](#Order)</code>
108
+ **Returns**: <code>string</code> - currency
109
+ <a name="Order+getQuoteCurrency"></a>
110
+
111
+ ### order.getQuoteCurrency() ⇒ <code>string</code>
112
+ **Kind**: instance method of <code>[Order](#Order)</code>
113
+ **Returns**: <code>string</code> - currency
114
+ <a name="Order+getNotionalValue"></a>
115
+
116
+ ### order.getNotionalValue() ⇒ <code>number</code>
117
+ **Kind**: instance method of <code>[Order](#Order)</code>
118
+ **Returns**: <code>number</code> - value
119
+ <a name="Order+serialize"></a>
120
+
121
+ ### order.serialize() ⇒ <code>Array</code>
122
+ **Kind**: instance method of <code>[Order](#Order)</code>
123
+ **Returns**: <code>Array</code> - o
124
+ <a name="Order+toNewOrderPacket"></a>
125
+
126
+ ### order.toNewOrderPacket() ⇒ <code>Object</code>
127
+ Creates an order map that can be passed to the `on` command.
128
+
129
+ **Kind**: instance method of <code>[Order](#Order)</code>
130
+ **Returns**: <code>Object</code> - o
131
+ <a name="Order.unserialize"></a>
132
+
133
+ ### Order.unserialize(arr) ⇒ <code>Object</code>
134
+ **Kind**: static method of <code>[Order](#Order)</code>
135
+ **Returns**: <code>Object</code> - order
136
+
137
+ | Param | Type |
138
+ | --- | --- |
139
+ | arr | <code>Array</code> |
140
+
141
+ <a name="Order.getBaseCurrency"></a>
142
+
143
+ ### Order.getBaseCurrency(arr) ⇒ <code>string</code>
144
+ **Kind**: static method of <code>[Order](#Order)</code>
145
+ **Returns**: <code>string</code> - currency - base currency from symbol
146
+
147
+ | Param | Type | Description |
148
+ | --- | --- | --- |
149
+ | arr | <code>Array</code> | order in ws2 array format |
150
+
151
+ <a name="Order.getQuoteCurrency"></a>
152
+
153
+ ### Order.getQuoteCurrency(arr) ⇒ <code>string</code>
154
+ **Kind**: static method of <code>[Order](#Order)</code>
155
+ **Returns**: <code>string</code> - currency - quote currency from symbol
156
+
157
+ | Param | Type | Description |
158
+ | --- | --- | --- |
159
+ | arr | <code>Array</code> | order in ws2 array format |
160
+