@yuants/vendor-binance 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.js +21 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/private-api.js +182 -25
- package/dist/api/private-api.js.map +1 -1
- package/dist/api/public-api.js +98 -11
- package/dist/api/public-api.js.map +1 -1
- package/lib/api/client.d.ts +4 -0
- package/lib/api/client.d.ts.map +1 -1
- package/lib/api/client.js +21 -1
- package/lib/api/client.js.map +1 -1
- package/lib/api/private-api.d.ts.map +1 -1
- package/lib/api/private-api.js +182 -25
- package/lib/api/private-api.js.map +1 -1
- package/lib/api/public-api.d.ts +16 -4
- package/lib/api/public-api.d.ts.map +1 -1
- package/lib/api/public-api.js +98 -11
- package/lib/api/public-api.js.map +1 -1
- package/package.json +1 -1
- package/temp/package-deps.json +7 -7
package/lib/api/private-api.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFundingAsset = exports.getUserAsset = exports.getMarginInterestRateHistory = exports.getMarginNextHourlyInterestRate = exports.getMarginAllPairs = exports.putUmOrder = exports.postSpotOrderCancelReplace = exports.getUMIncome = exports.deleteUmOrder = exports.postUmOrder = exports.getDepositHistory = exports.getWithdrawHistory = exports.postWithdraw = exports.getSubAccountList = exports.getDepositAddress = exports.postUnifiedAccountAutoCollection = exports.postAssetTransfer = exports.deleteSpotOrder = exports.postSpotOrder = exports.getSpotOpenOrders = exports.getSpotAccountInfo = exports.getUnifiedAccountBalance = exports.getUnifiedUmOpenOrders = exports.getUnifiedUmAccount = exports.getUnifiedAccountInfo = void 0;
|
|
4
|
+
const utils_1 = require("@yuants/utils");
|
|
4
5
|
const client_1 = require("./client");
|
|
5
6
|
/**
|
|
6
7
|
* 查询账户信息(USER_DATA)
|
|
@@ -11,7 +12,13 @@ const client_1 = require("./client");
|
|
|
11
12
|
*
|
|
12
13
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information
|
|
13
14
|
*/
|
|
14
|
-
const getUnifiedAccountInfo = (credential) =>
|
|
15
|
+
const getUnifiedAccountInfo = (credential) => {
|
|
16
|
+
const endpoint = 'https://papi.binance.com/papi/v1/account';
|
|
17
|
+
const url = new URL(endpoint);
|
|
18
|
+
const weight = 20;
|
|
19
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
20
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint);
|
|
21
|
+
};
|
|
15
22
|
exports.getUnifiedAccountInfo = getUnifiedAccountInfo;
|
|
16
23
|
/**
|
|
17
24
|
* 获取UM账户信息
|
|
@@ -22,7 +29,13 @@ exports.getUnifiedAccountInfo = getUnifiedAccountInfo;
|
|
|
22
29
|
*
|
|
23
30
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail
|
|
24
31
|
*/
|
|
25
|
-
const getUnifiedUmAccount = (credential) =>
|
|
32
|
+
const getUnifiedUmAccount = (credential) => {
|
|
33
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/account';
|
|
34
|
+
const url = new URL(endpoint);
|
|
35
|
+
const weight = 5;
|
|
36
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
37
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint);
|
|
38
|
+
};
|
|
26
39
|
exports.getUnifiedUmAccount = getUnifiedUmAccount;
|
|
27
40
|
/**
|
|
28
41
|
* 查看当前全部UM挂单(USER_DATA)
|
|
@@ -33,7 +46,21 @@ exports.getUnifiedUmAccount = getUnifiedUmAccount;
|
|
|
33
46
|
*
|
|
34
47
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders
|
|
35
48
|
*/
|
|
36
|
-
const getUnifiedUmOpenOrders = (credential, params) =>
|
|
49
|
+
const getUnifiedUmOpenOrders = (credential, params) => {
|
|
50
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/openOrders';
|
|
51
|
+
const url = new URL(endpoint);
|
|
52
|
+
const weight = (params === null || params === void 0 ? void 0 : params.symbol) ? 1 : 40;
|
|
53
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
endpoint,
|
|
56
|
+
host: url.host,
|
|
57
|
+
path: url.pathname,
|
|
58
|
+
bucketId: url.host,
|
|
59
|
+
weight,
|
|
60
|
+
hasSymbol: !!(params === null || params === void 0 ? void 0 : params.symbol),
|
|
61
|
+
}, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
62
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
63
|
+
};
|
|
37
64
|
exports.getUnifiedUmOpenOrders = getUnifiedUmOpenOrders;
|
|
38
65
|
/**
|
|
39
66
|
* 查询账户余额(USER_DATA)
|
|
@@ -44,7 +71,13 @@ exports.getUnifiedUmOpenOrders = getUnifiedUmOpenOrders;
|
|
|
44
71
|
*
|
|
45
72
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance
|
|
46
73
|
*/
|
|
47
|
-
const getUnifiedAccountBalance = (credential, params) =>
|
|
74
|
+
const getUnifiedAccountBalance = (credential, params) => {
|
|
75
|
+
const endpoint = 'https://papi.binance.com/papi/v1/balance';
|
|
76
|
+
const url = new URL(endpoint);
|
|
77
|
+
const weight = 20;
|
|
78
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
79
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
80
|
+
};
|
|
48
81
|
exports.getUnifiedAccountBalance = getUnifiedAccountBalance;
|
|
49
82
|
/**
|
|
50
83
|
* 账户信息 (USER_DATA)
|
|
@@ -53,7 +86,13 @@ exports.getUnifiedAccountBalance = getUnifiedAccountBalance;
|
|
|
53
86
|
*
|
|
54
87
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data
|
|
55
88
|
*/
|
|
56
|
-
const getSpotAccountInfo = (credential, params) =>
|
|
89
|
+
const getSpotAccountInfo = (credential, params) => {
|
|
90
|
+
const endpoint = 'https://api.binance.com/api/v3/account';
|
|
91
|
+
const url = new URL(endpoint);
|
|
92
|
+
const weight = 20;
|
|
93
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
94
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
95
|
+
};
|
|
57
96
|
exports.getSpotAccountInfo = getSpotAccountInfo;
|
|
58
97
|
/**
|
|
59
98
|
* Current open orders (USER_DATA)
|
|
@@ -62,7 +101,21 @@ exports.getSpotAccountInfo = getSpotAccountInfo;
|
|
|
62
101
|
*
|
|
63
102
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data
|
|
64
103
|
*/
|
|
65
|
-
const getSpotOpenOrders = (credential, params) =>
|
|
104
|
+
const getSpotOpenOrders = (credential, params) => {
|
|
105
|
+
const endpoint = 'https://api.binance.com/api/v3/openOrders';
|
|
106
|
+
const url = new URL(endpoint);
|
|
107
|
+
const weight = (params === null || params === void 0 ? void 0 : params.symbol) ? 6 : 80;
|
|
108
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', {
|
|
109
|
+
method: 'GET',
|
|
110
|
+
endpoint,
|
|
111
|
+
host: url.host,
|
|
112
|
+
path: url.pathname,
|
|
113
|
+
bucketId: url.host,
|
|
114
|
+
weight,
|
|
115
|
+
hasSymbol: !!(params === null || params === void 0 ? void 0 : params.symbol),
|
|
116
|
+
}, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
117
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
118
|
+
};
|
|
66
119
|
exports.getSpotOpenOrders = getSpotOpenOrders;
|
|
67
120
|
/**
|
|
68
121
|
* New order (TRADE)
|
|
@@ -71,7 +124,13 @@ exports.getSpotOpenOrders = getSpotOpenOrders;
|
|
|
71
124
|
*
|
|
72
125
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade
|
|
73
126
|
*/
|
|
74
|
-
const postSpotOrder = (credential, params) =>
|
|
127
|
+
const postSpotOrder = (credential, params) => {
|
|
128
|
+
const endpoint = 'https://api.binance.com/api/v3/order';
|
|
129
|
+
const url = new URL(endpoint);
|
|
130
|
+
const weight = 1;
|
|
131
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
132
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
133
|
+
};
|
|
75
134
|
exports.postSpotOrder = postSpotOrder;
|
|
76
135
|
/**
|
|
77
136
|
* Cancel order (TRADE)
|
|
@@ -80,7 +139,13 @@ exports.postSpotOrder = postSpotOrder;
|
|
|
80
139
|
*
|
|
81
140
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade
|
|
82
141
|
*/
|
|
83
|
-
const deleteSpotOrder = (credential, params) =>
|
|
142
|
+
const deleteSpotOrder = (credential, params) => {
|
|
143
|
+
const endpoint = 'https://api.binance.com/api/v3/order';
|
|
144
|
+
const url = new URL(endpoint);
|
|
145
|
+
const weight = 1;
|
|
146
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'DELETE', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
147
|
+
return (0, client_1.requestPrivate)(credential, 'DELETE', endpoint, params);
|
|
148
|
+
};
|
|
84
149
|
exports.deleteSpotOrder = deleteSpotOrder;
|
|
85
150
|
/**
|
|
86
151
|
* 用户万向划转(USER_DATA)
|
|
@@ -93,7 +158,13 @@ exports.deleteSpotOrder = deleteSpotOrder;
|
|
|
93
158
|
*
|
|
94
159
|
* https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer
|
|
95
160
|
*/
|
|
96
|
-
const postAssetTransfer = (credential, params) =>
|
|
161
|
+
const postAssetTransfer = (credential, params) => {
|
|
162
|
+
const endpoint = 'https://api.binance.com/sapi/v1/asset/transfer';
|
|
163
|
+
const url = new URL(endpoint);
|
|
164
|
+
const weight = 900;
|
|
165
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
166
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
167
|
+
};
|
|
97
168
|
exports.postAssetTransfer = postAssetTransfer;
|
|
98
169
|
/**
|
|
99
170
|
* 统一账户资金归集(TRADE)
|
|
@@ -106,7 +177,13 @@ exports.postAssetTransfer = postAssetTransfer;
|
|
|
106
177
|
*
|
|
107
178
|
* ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。
|
|
108
179
|
*/
|
|
109
|
-
const postUnifiedAccountAutoCollection = (credential) =>
|
|
180
|
+
const postUnifiedAccountAutoCollection = (credential) => {
|
|
181
|
+
const endpoint = 'https://papi.binance.com/papi/v1/auto-collection';
|
|
182
|
+
const url = new URL(endpoint);
|
|
183
|
+
const weight = 750;
|
|
184
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
185
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint);
|
|
186
|
+
};
|
|
110
187
|
exports.postUnifiedAccountAutoCollection = postUnifiedAccountAutoCollection;
|
|
111
188
|
/**
|
|
112
189
|
* 获取充值地址(支持多网络)(USER_DATA)
|
|
@@ -117,7 +194,13 @@ exports.postUnifiedAccountAutoCollection = postUnifiedAccountAutoCollection;
|
|
|
117
194
|
*
|
|
118
195
|
* https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address
|
|
119
196
|
*/
|
|
120
|
-
const getDepositAddress = (credential, params) =>
|
|
197
|
+
const getDepositAddress = (credential, params) => {
|
|
198
|
+
const endpoint = 'https://api.binance.com/sapi/v1/capital/deposit/address';
|
|
199
|
+
const url = new URL(endpoint);
|
|
200
|
+
const weight = 10;
|
|
201
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
202
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
203
|
+
};
|
|
121
204
|
exports.getDepositAddress = getDepositAddress;
|
|
122
205
|
/**
|
|
123
206
|
* 查询子账户列表(适用主账户)
|
|
@@ -126,7 +209,13 @@ exports.getDepositAddress = getDepositAddress;
|
|
|
126
209
|
*
|
|
127
210
|
* https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List
|
|
128
211
|
*/
|
|
129
|
-
const getSubAccountList = (credential, params) =>
|
|
212
|
+
const getSubAccountList = (credential, params) => {
|
|
213
|
+
const endpoint = 'https://api.binance.com/sapi/v1/sub-account/list';
|
|
214
|
+
const url = new URL(endpoint);
|
|
215
|
+
const weight = 1;
|
|
216
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
217
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
218
|
+
};
|
|
130
219
|
exports.getSubAccountList = getSubAccountList;
|
|
131
220
|
/**
|
|
132
221
|
* 提币(USER_DATA)
|
|
@@ -135,7 +224,13 @@ exports.getSubAccountList = getSubAccountList;
|
|
|
135
224
|
*
|
|
136
225
|
* https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw
|
|
137
226
|
*/
|
|
138
|
-
const postWithdraw = (credential, params) =>
|
|
227
|
+
const postWithdraw = (credential, params) => {
|
|
228
|
+
const endpoint = 'https://api.binance.com/sapi/v1/capital/withdraw/apply';
|
|
229
|
+
const url = new URL(endpoint);
|
|
230
|
+
const weight = 600;
|
|
231
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
232
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
233
|
+
};
|
|
139
234
|
exports.postWithdraw = postWithdraw;
|
|
140
235
|
/**
|
|
141
236
|
* 获取提币历史(支持多网络)(USER_DATA)
|
|
@@ -149,7 +244,13 @@ exports.postWithdraw = postWithdraw;
|
|
|
149
244
|
*
|
|
150
245
|
* https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history
|
|
151
246
|
*/
|
|
152
|
-
const getWithdrawHistory = (credential, params) =>
|
|
247
|
+
const getWithdrawHistory = (credential, params) => {
|
|
248
|
+
const endpoint = 'https://api.binance.com/sapi/v1/capital/withdraw/history';
|
|
249
|
+
const url = new URL(endpoint);
|
|
250
|
+
const weight = 1;
|
|
251
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
252
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
253
|
+
};
|
|
153
254
|
exports.getWithdrawHistory = getWithdrawHistory;
|
|
154
255
|
/**
|
|
155
256
|
* 获取充值历史(支持多网络)
|
|
@@ -158,7 +259,13 @@ exports.getWithdrawHistory = getWithdrawHistory;
|
|
|
158
259
|
*
|
|
159
260
|
* https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history
|
|
160
261
|
*/
|
|
161
|
-
const getDepositHistory = (credential, params) =>
|
|
262
|
+
const getDepositHistory = (credential, params) => {
|
|
263
|
+
const endpoint = 'https://api.binance.com/sapi/v1/capital/deposit/hisrec';
|
|
264
|
+
const url = new URL(endpoint);
|
|
265
|
+
const weight = 1;
|
|
266
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
267
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
268
|
+
};
|
|
162
269
|
exports.getDepositHistory = getDepositHistory;
|
|
163
270
|
/**
|
|
164
271
|
* UM下单(TRADE)
|
|
@@ -167,9 +274,21 @@ exports.getDepositHistory = getDepositHistory;
|
|
|
167
274
|
*
|
|
168
275
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order
|
|
169
276
|
*/
|
|
170
|
-
const postUmOrder = (credential, params) =>
|
|
277
|
+
const postUmOrder = (credential, params) => {
|
|
278
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/order';
|
|
279
|
+
const url = new URL(endpoint);
|
|
280
|
+
const weight = 1;
|
|
281
|
+
(0, utils_1.scopeError)('BINANCE_UNIFIED_ORDER_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)('order/unified/minute').acquireSync(weight));
|
|
282
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
283
|
+
};
|
|
171
284
|
exports.postUmOrder = postUmOrder;
|
|
172
|
-
const deleteUmOrder = (credential, params) =>
|
|
285
|
+
const deleteUmOrder = (credential, params) => {
|
|
286
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/order';
|
|
287
|
+
const url = new URL(endpoint);
|
|
288
|
+
const weight = 1;
|
|
289
|
+
(0, utils_1.scopeError)('BINANCE_UNIFIED_ORDER_API_RATE_LIMIT', { method: 'DELETE', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)('order/unified/minute').acquireSync(weight));
|
|
290
|
+
return (0, client_1.requestPrivate)(credential, 'DELETE', endpoint, params);
|
|
291
|
+
};
|
|
173
292
|
exports.deleteUmOrder = deleteUmOrder;
|
|
174
293
|
/**
|
|
175
294
|
* 获取UM损益资金流水(USER_DATA)
|
|
@@ -178,7 +297,13 @@ exports.deleteUmOrder = deleteUmOrder;
|
|
|
178
297
|
*
|
|
179
298
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History
|
|
180
299
|
*/
|
|
181
|
-
const getUMIncome = (credential, params) =>
|
|
300
|
+
const getUMIncome = (credential, params) => {
|
|
301
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/income';
|
|
302
|
+
const url = new URL(endpoint);
|
|
303
|
+
const weight = 30;
|
|
304
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
305
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
306
|
+
};
|
|
182
307
|
exports.getUMIncome = getUMIncome;
|
|
183
308
|
/**
|
|
184
309
|
* Cancel an Existing Order and Send a New Order (TRADE)
|
|
@@ -187,7 +312,13 @@ exports.getUMIncome = getUMIncome;
|
|
|
187
312
|
*
|
|
188
313
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade
|
|
189
314
|
*/
|
|
190
|
-
const postSpotOrderCancelReplace = (credential, params) =>
|
|
315
|
+
const postSpotOrderCancelReplace = (credential, params) => {
|
|
316
|
+
const endpoint = 'https://api.binance.com/api/v3/order/cancelReplace';
|
|
317
|
+
const url = new URL(endpoint);
|
|
318
|
+
const weight = 1;
|
|
319
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
320
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
321
|
+
};
|
|
191
322
|
exports.postSpotOrderCancelReplace = postSpotOrderCancelReplace;
|
|
192
323
|
/**
|
|
193
324
|
* Modify Order (TRADE)
|
|
@@ -196,7 +327,13 @@ exports.postSpotOrderCancelReplace = postSpotOrderCancelReplace;
|
|
|
196
327
|
*
|
|
197
328
|
* https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order
|
|
198
329
|
*/
|
|
199
|
-
const putUmOrder = (credential, params) =>
|
|
330
|
+
const putUmOrder = (credential, params) => {
|
|
331
|
+
const endpoint = 'https://papi.binance.com/papi/v1/um/order';
|
|
332
|
+
const url = new URL(endpoint);
|
|
333
|
+
const weight = 1;
|
|
334
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'PUT', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
335
|
+
return (0, client_1.requestPrivate)(credential, 'PUT', endpoint, params);
|
|
336
|
+
};
|
|
200
337
|
exports.putUmOrder = putUmOrder;
|
|
201
338
|
/**
|
|
202
339
|
* 获取所有全仓杠杆交易对(MARKET_DATA)
|
|
@@ -207,7 +344,11 @@ exports.putUmOrder = putUmOrder;
|
|
|
207
344
|
*/
|
|
208
345
|
const getMarginAllPairs = (params) => {
|
|
209
346
|
const credential = (0, client_1.getDefaultCredential)();
|
|
210
|
-
|
|
347
|
+
const endpoint = 'https://api.binance.com/sapi/v1/margin/allPairs';
|
|
348
|
+
const url = new URL(endpoint);
|
|
349
|
+
const weight = 1;
|
|
350
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
351
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
211
352
|
};
|
|
212
353
|
exports.getMarginAllPairs = getMarginAllPairs;
|
|
213
354
|
/**
|
|
@@ -217,7 +358,11 @@ exports.getMarginAllPairs = getMarginAllPairs;
|
|
|
217
358
|
*/
|
|
218
359
|
const getMarginNextHourlyInterestRate = (params) => {
|
|
219
360
|
const credential = (0, client_1.getDefaultCredential)();
|
|
220
|
-
|
|
361
|
+
const endpoint = 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate';
|
|
362
|
+
const url = new URL(endpoint);
|
|
363
|
+
const weight = 1;
|
|
364
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
365
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
221
366
|
};
|
|
222
367
|
exports.getMarginNextHourlyInterestRate = getMarginNextHourlyInterestRate;
|
|
223
368
|
/**
|
|
@@ -227,7 +372,11 @@ exports.getMarginNextHourlyInterestRate = getMarginNextHourlyInterestRate;
|
|
|
227
372
|
*/
|
|
228
373
|
const getMarginInterestRateHistory = (params) => {
|
|
229
374
|
const credential = (0, client_1.getDefaultCredential)();
|
|
230
|
-
|
|
375
|
+
const endpoint = 'https://api.binance.com/sapi/v1/margin/interestRateHistory';
|
|
376
|
+
const url = new URL(endpoint);
|
|
377
|
+
const weight = 1;
|
|
378
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
379
|
+
return (0, client_1.requestPrivate)(credential, 'GET', endpoint, params);
|
|
231
380
|
};
|
|
232
381
|
exports.getMarginInterestRateHistory = getMarginInterestRateHistory;
|
|
233
382
|
/**
|
|
@@ -238,7 +387,11 @@ exports.getMarginInterestRateHistory = getMarginInterestRateHistory;
|
|
|
238
387
|
* @returns
|
|
239
388
|
*/
|
|
240
389
|
const getUserAsset = (credential, params) => {
|
|
241
|
-
|
|
390
|
+
const endpoint = 'https://api.binance.com/sapi/v3/asset/getUserAsset';
|
|
391
|
+
const url = new URL(endpoint);
|
|
392
|
+
const weight = 1;
|
|
393
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
394
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
242
395
|
};
|
|
243
396
|
exports.getUserAsset = getUserAsset;
|
|
244
397
|
/**
|
|
@@ -249,7 +402,11 @@ exports.getUserAsset = getUserAsset;
|
|
|
249
402
|
* @returns
|
|
250
403
|
*/
|
|
251
404
|
const getFundingAsset = (credential, params) => {
|
|
252
|
-
|
|
405
|
+
const endpoint = 'https://api.binance.com/sapi/v1/asset/get-funding-asset';
|
|
406
|
+
const url = new URL(endpoint);
|
|
407
|
+
const weight = 1;
|
|
408
|
+
(0, utils_1.scopeError)('BINANCE_API_RATE_LIMIT', { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight }, () => (0, utils_1.tokenBucket)(url.host).acquireSync(weight));
|
|
409
|
+
return (0, client_1.requestPrivate)(credential, 'POST', endpoint, params);
|
|
253
410
|
};
|
|
254
411
|
exports.getFundingAsset = getFundingAsset;
|
|
255
412
|
//# sourceMappingURL=private-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AAAA,qCAAwF;AAsOxF;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,UAAuB,EAA4C,EAAE,CACzG,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,0CAA0C,CAC3C,CAAC;AALS,QAAA,qBAAqB,yBAK9B;AAEJ;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAA0C,EAAE,CACrG,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,6CAA6C,CAC9C,CAAC;AALS,QAAA,mBAAmB,uBAK5B;AAEJ;;;;;;;;GAQG;AACI,MAAM,sBAAsB,GAAG,CACpC,UAAuB,EACvB,MAEC,EAC+B,EAAE,CAClC,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,gDAAgD,EAChD,MAAM,CACP,CAAC;AAXS,QAAA,sBAAsB,0BAW/B;AAEJ;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACtC,UAAuB,EACvB,MAEC,EACmD,EAAE,CACtD,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,0CA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AoB,GAAE,CAAC;IAC1C,OAAO,IAAA,uBAAc,EAOnB,UAAU,EAAE,KAAK,EAAE,4DAA4D,EAAE,MAAM,CAAC,CAAC;AAC7F,CAAC,CAAC;AAvBW,QAAA,4BAA4B,gCAuBvC;AAEF;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAC1B,UAAuB,EACvB,MAKC,EACD,EAAE;IACF,OAAO,IAAA,uBAAc,EAWnB,UAAU,EAAE,MAAM,EAAE,oDAAoD,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC,CAAC;AArBW,QAAA,YAAY,gBAqBvB;AAEF;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAKC,EACD,EAAE;IACF,OAAO,IAAA,uBAAc,EAWnB,UAAU,EAAE,MAAM,EAAE,yDAAyD,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC;AArBW,QAAA,eAAe,mBAqB1B","sourcesContent":["import { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> =>\n requestPrivate<IUnifiedAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/account',\n );\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> =>\n requestPrivate<IUnifiedUmAccount | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/account',\n );\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> =>\n requestPrivate<IUnifiedUmOpenOrder[]>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/openOrders',\n params,\n );\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> =>\n requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/balance',\n params,\n );\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> =>\n requestPrivate<ISpotAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/account',\n params,\n );\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> =>\n requestPrivate<ISpotOrder[] | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/openOrders',\n params,\n );\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> =>\n requestPrivate<ISpotOrder | IApiError>(\n credential,\n 'DELETE',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> =>\n requestPrivate<IAssetTransferResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/asset/transfer',\n params,\n );\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> =>\n requestPrivate<{ msg: string }>(credential, 'POST', 'https://papi.binance.com/papi/v1/auto-collection');\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> =>\n requestPrivate<IDepositAddress>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/address',\n params,\n );\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> =>\n requestPrivate<ISubAccountListResponse | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/sub-account/list',\n params,\n );\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> =>\n requestPrivate<{ id: string } | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/capital/withdraw/apply',\n params,\n );\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> =>\n requestPrivate<IWithdrawRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/withdraw/history',\n params,\n );\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> =>\n requestPrivate<IDepositRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/hisrec',\n params,\n );\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'DELETE',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> =>\n requestPrivate<IUMIncomeRecord[]>(credential, 'GET', 'https://api.binance.com/papi/v1/um/income', params);\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order/cancelReplace',\n params,\n );\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'PUT',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n return requestPrivate<IMarginPair[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/margin/allPairs',\n params,\n );\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate', params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);\n};\n\n/**\n *获取用户持仓\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0\n * @param params\n * @returns\n */\nexport const getUserAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v3/asset/getUserAsset', params);\n};\n\n/**\n * 查询资金账户\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com\n * @param params\n * @returns\n */\nexport const getFundingAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v1/asset/get-funding-asset', params);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AAExD,qCAAwF;AAsOxF;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,UAAuB,EAA4C,EAAE;IACzG,MAAM,QAAQ,GAAG,0CAA0C,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CA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AAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAC5F,GAAG,EAAE,CAAC,IAAA,mBAAW,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAChD,CAAC;IACF,OAAO,IAAA,uBAAc,EAWnB,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC;AA7BW,QAAA,YAAY,gBA6BvB;AAEF;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAKC,EACD,EAAE;IACF,MAAM,QAAQ,GAAG,yDAAyD,CAAC;IAC3E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,IAAA,kBAAU,EACR,wBAAwB,EACxB,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAC5F,GAAG,EAAE,CAAC,IAAA,mBAAW,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAChD,CAAC;IACF,OAAO,IAAA,uBAAc,EAWnB,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC;AA7BW,QAAA,eAAe,mBA6B1B","sourcesContent":["import { scopeError, tokenBucket } from '@yuants/utils';\n\nimport { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/account';\n const url = new URL(endpoint);\n const weight = 20;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUnifiedAccountInfo | IApiError>(credential, 'GET', endpoint);\n};\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/account';\n const url = new URL(endpoint);\n const weight = 5;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUnifiedUmAccount | IApiError>(credential, 'GET', endpoint);\n};\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/openOrders';\n const url = new URL(endpoint);\n const weight = params?.symbol ? 1 : 40;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n {\n method: 'GET',\n endpoint,\n host: url.host,\n path: url.pathname,\n bucketId: url.host,\n weight,\n hasSymbol: !!params?.symbol,\n },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUnifiedUmOpenOrder[]>(credential, 'GET', endpoint, params);\n};\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/balance';\n const url = new URL(endpoint);\n const weight = 20;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(credential, 'GET', endpoint, params);\n};\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> => {\n const endpoint = 'https://api.binance.com/api/v3/account';\n const url = new URL(endpoint);\n const weight = 20;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISpotAccountInfo | IApiError>(credential, 'GET', endpoint, params);\n};\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> => {\n const endpoint = 'https://api.binance.com/api/v3/openOrders';\n const url = new URL(endpoint);\n const weight = params?.symbol ? 6 : 80;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n {\n method: 'GET',\n endpoint,\n host: url.host,\n path: url.pathname,\n bucketId: url.host,\n weight,\n hasSymbol: !!params?.symbol,\n },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISpotOrder[] | IApiError>(credential, 'GET', endpoint, params);\n};\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> => {\n const endpoint = 'https://api.binance.com/api/v3/order';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISpotNewOrderResponse | IApiError>(credential, 'POST', endpoint, params);\n};\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> => {\n const endpoint = 'https://api.binance.com/api/v3/order';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'DELETE', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISpotOrder | IApiError>(credential, 'DELETE', endpoint, params);\n};\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> => {\n const endpoint = 'https://api.binance.com/sapi/v1/asset/transfer';\n const url = new URL(endpoint);\n const weight = 900;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IAssetTransferResponse | IApiError>(credential, 'POST', endpoint, params);\n};\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> => {\n const endpoint = 'https://papi.binance.com/papi/v1/auto-collection';\n const url = new URL(endpoint);\n const weight = 750;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<{ msg: string }>(credential, 'POST', endpoint);\n};\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> => {\n const endpoint = 'https://api.binance.com/sapi/v1/capital/deposit/address';\n const url = new URL(endpoint);\n const weight = 10;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IDepositAddress>(credential, 'GET', endpoint, params);\n};\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> => {\n const endpoint = 'https://api.binance.com/sapi/v1/sub-account/list';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISubAccountListResponse | IApiError>(credential, 'GET', endpoint, params);\n};\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> => {\n const endpoint = 'https://api.binance.com/sapi/v1/capital/withdraw/apply';\n const url = new URL(endpoint);\n const weight = 600;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<{ id: string } | IApiError>(credential, 'POST', endpoint, params);\n};\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> => {\n const endpoint = 'https://api.binance.com/sapi/v1/capital/withdraw/history';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IWithdrawRecord[]>(credential, 'GET', endpoint, params);\n};\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> => {\n const endpoint = 'https://api.binance.com/sapi/v1/capital/deposit/hisrec';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IDepositRecord[]>(credential, 'GET', endpoint, params);\n};\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/order';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_UNIFIED_ORDER_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket('order/unified/minute').acquireSync(weight),\n );\n return requestPrivate<IUnifiedUmOrderResponse | IApiError>(credential, 'POST', endpoint, params);\n};\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/order';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_UNIFIED_ORDER_API_RATE_LIMIT',\n { method: 'DELETE', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket('order/unified/minute').acquireSync(weight),\n );\n return requestPrivate<IUnifiedUmOrderResponse | IApiError>(credential, 'DELETE', endpoint, params);\n};\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/income';\n const url = new URL(endpoint);\n const weight = 30;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUMIncomeRecord[]>(credential, 'GET', endpoint, params);\n};\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> => {\n const endpoint = 'https://api.binance.com/api/v3/order/cancelReplace';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<ISpotNewOrderResponse | IApiError>(credential, 'POST', endpoint, params);\n};\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> => {\n const endpoint = 'https://papi.binance.com/papi/v1/um/order';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'PUT', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IUnifiedUmOrderResponse | IApiError>(credential, 'PUT', endpoint, params);\n};\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n const endpoint = 'https://api.binance.com/sapi/v1/margin/allPairs';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<IMarginPair[]>(credential, 'GET', endpoint, params);\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n const endpoint = 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', endpoint, params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n const endpoint = 'https://api.binance.com/sapi/v1/margin/interestRateHistory';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'GET', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', endpoint, params);\n};\n\n/**\n *获取用户持仓\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0\n * @param params\n * @returns\n */\nexport const getUserAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n const endpoint = 'https://api.binance.com/sapi/v3/asset/getUserAsset';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', endpoint, params);\n};\n\n/**\n * 查询资金账户\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com\n * @param params\n * @returns\n */\nexport const getFundingAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n const endpoint = 'https://api.binance.com/sapi/v1/asset/get-funding-asset';\n const url = new URL(endpoint);\n const weight = 1;\n scopeError(\n 'BINANCE_API_RATE_LIMIT',\n { method: 'POST', endpoint, host: url.host, path: url.pathname, bucketId: url.host, weight },\n () => tokenBucket(url.host).acquireSync(weight),\n );\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', endpoint, params);\n};\n"]}
|
package/lib/api/public-api.d.ts
CHANGED
|
@@ -87,12 +87,16 @@ export interface IMarginPair {
|
|
|
87
87
|
/**
|
|
88
88
|
* 获取交易规则和交易对
|
|
89
89
|
*
|
|
90
|
-
*
|
|
90
|
+
* 权重: 1
|
|
91
|
+
*
|
|
92
|
+
* https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Exchange-Information
|
|
91
93
|
*/
|
|
92
94
|
export declare const getFutureExchangeInfo: () => Promise<IFutureExchangeInfo>;
|
|
93
95
|
/**
|
|
94
96
|
* 查询资金费率历史
|
|
95
97
|
*
|
|
98
|
+
* 权重: /fapi/v1/fundingInfo共享500/5min/IP
|
|
99
|
+
*
|
|
96
100
|
* https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Get-Funding-Rate-History
|
|
97
101
|
*/
|
|
98
102
|
export declare const getFutureFundingRate: (params: {
|
|
@@ -147,7 +151,9 @@ export interface ISpotBookTickerEntry {
|
|
|
147
151
|
/**
|
|
148
152
|
* 当前最优挂单 (Spot)
|
|
149
153
|
*
|
|
150
|
-
*
|
|
154
|
+
* 权重: 单交易对 2,不带 symbol 4
|
|
155
|
+
*
|
|
156
|
+
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E4%BC%98%E6%8C%82%E5%8D%95%E6%8E%A5%E5%8F%A3
|
|
151
157
|
*/
|
|
152
158
|
export declare const getSpotBookTicker: (params?: {
|
|
153
159
|
symbol?: string;
|
|
@@ -190,16 +196,22 @@ export interface ISpotExchangeInfo {
|
|
|
190
196
|
/**
|
|
191
197
|
* 获取现货交易规则和交易对
|
|
192
198
|
*
|
|
199
|
+
* 权重: 20
|
|
200
|
+
*
|
|
193
201
|
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF
|
|
194
202
|
*/
|
|
195
203
|
export declare const getSpotExchangeInfo: () => Promise<ISpotExchangeInfo>;
|
|
196
204
|
/**
|
|
197
205
|
* 获取当前现货报价
|
|
198
206
|
*
|
|
199
|
-
*
|
|
207
|
+
* 权重: 单交易对 2,不带 symbol 4
|
|
208
|
+
*
|
|
209
|
+
* https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3
|
|
200
210
|
*/
|
|
201
211
|
export declare const getSpotTickerPrice: (params?: {
|
|
202
|
-
|
|
212
|
+
symbol?: string;
|
|
213
|
+
symbols?: string;
|
|
214
|
+
symbolStatus?: string;
|
|
203
215
|
}) => Promise<{
|
|
204
216
|
symbol: string;
|
|
205
217
|
price: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAClG,UAAU,EAA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