/
account.js
143 lines (136 loc) · 3.66 KB
/
account.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
'use strict'
/**
* Websocket API Account endpoints
* @module Websocket
* @param {*} superclass
*/
const Account = superclass => class extends superclass {
/**
* Account information< br>
*
* Query information about your account.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-information-user_data}
*
* @param {object} [options]
* @param {number} [options.recvWindow]
*/
account (options = {}) {
this.sendSignatureMessage('account.status', options)
}
/**
* Account order rate limits< br>
*
* Query your current order rate limit.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-order-rate-limits-user_data}
*
* @param {object} [options]
* @param {number} [options.recvWindow]
*/
orderLimit (options = {}) {
this.sendSignatureMessage('account.rateLimits.orders', options)
}
/**
* Account order history< br>
*
* Query information about all your orders – active, canceled, filled – filtered by time range.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-order-history-user_data}
*
* @param {string} symbol
* @param {object} [options]
* @param {number} [options.orderId]
* @param {number} [options.startTime]
* @param {number} [options.endTime]
* @param {number} [options.limit]
* @param {number} [options.recvWindow]
*
*/
orderHistory (symbol, options = {}) {
const limit = options.limit || 500
this.sendSignatureMessage('allOrders', {
symbol,
limit,
...options
})
}
/**
* Account OCO history< br>
*
* Query information about all your OCOs, filtered by time range.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-oco-history-user_data}
*
* @param {object} [options]
* @param {number} [options.fromId]
* @param {number} [options.startTime]
* @param {number} [options.endTime]
* @param {number} [options.limit]
* @param {number} [options.recvWindow]
*
*/
ocoOrderHistory (options = {}) {
const limit = options.limit || 500
this.sendSignatureMessage('allOrderLists', {
limit,
...options
})
}
/**
* Account trade history< br>
*
* Query information about all your trades, filtered by time range.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-trade-history-user_data}
*
* @param {string} [symbol]
* @param {object} [options]
* @param {number} [options.orderId]
* @param {number} [options.startTime]
* @param {number} [options.endTime]
* @param {number} [options.fromId]
* @param {number} [options.limit]
* @param {number} [options.recvWindow]
*
*/
myTrades (symbol, options = {}) {
const limit = options.limit || 500
this.sendSignatureMessage('myTrades', {
symbol,
limit,
...options
})
}
/**
* Account prevented matches< br>
*
* Displays the list of orders that were expired because of STP trigger.<br>
*
*
* {@link https://binance-docs.github.io/apidocs/websocket_api/en/#account-prevented-matches-user_data}
*
* @param {string} [symbol]
* @param {object} [options]
* @param {number} [options.preventedMatchId]
* @param {number} [options.orderId]
* @param {number} [options.fromPreventedMatchId]
* @param {number} [options.limit]
* @param {number} [options.recvWindow]
*
*/
preventedMatches (symbol, options = {}) {
const limit = options.limit || 500
this.sendSignatureMessage('myPreventedMatches', {
symbol,
limit,
...options
})
}
}
module.exports = Account