@binance/dual-investment 1.0.0
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/LICENCE +21 -0
- package/README.md +199 -0
- package/dist/index.d.mts +983 -0
- package/dist/index.d.ts +983 -0
- package/dist/index.js +562 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +547 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +55 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
BadRequestError: () => import_common5.BadRequestError,
|
|
24
|
+
ConnectorClientError: () => import_common5.ConnectorClientError,
|
|
25
|
+
DUAL_INVESTMENT_REST_API_PROD_URL: () => import_common5.DUAL_INVESTMENT_REST_API_PROD_URL,
|
|
26
|
+
DUAL_INVESTMENT_REST_API_TESTNET_URL: () => import_common5.DUAL_INVESTMENT_REST_API_TESTNET_URL,
|
|
27
|
+
DualInvestment: () => DualInvestment,
|
|
28
|
+
DualInvestmentRestAPI: () => rest_api_exports,
|
|
29
|
+
ForbiddenError: () => import_common5.ForbiddenError,
|
|
30
|
+
NetworkError: () => import_common5.NetworkError,
|
|
31
|
+
NotFoundError: () => import_common5.NotFoundError,
|
|
32
|
+
RateLimitBanError: () => import_common5.RateLimitBanError,
|
|
33
|
+
RequiredError: () => import_common5.RequiredError,
|
|
34
|
+
ServerError: () => import_common5.ServerError,
|
|
35
|
+
TooManyRequestsError: () => import_common5.TooManyRequestsError,
|
|
36
|
+
UnauthorizedError: () => import_common5.UnauthorizedError
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(src_exports);
|
|
39
|
+
|
|
40
|
+
// src/dual-investment.ts
|
|
41
|
+
var import_os = require("os");
|
|
42
|
+
var import_common4 = require("@binance/common");
|
|
43
|
+
|
|
44
|
+
// package.json
|
|
45
|
+
var name = "@binance/dual-investment";
|
|
46
|
+
var version = "1.0.0";
|
|
47
|
+
|
|
48
|
+
// src/rest-api/index.ts
|
|
49
|
+
var rest_api_exports = {};
|
|
50
|
+
__export(rest_api_exports, {
|
|
51
|
+
MarketDataApi: () => MarketDataApi,
|
|
52
|
+
RestAPI: () => RestAPI,
|
|
53
|
+
TradeApi: () => TradeApi
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// src/rest-api/modules/market-data-api.ts
|
|
57
|
+
var import_common = require("@binance/common");
|
|
58
|
+
var MarketDataApiAxiosParamCreator = function(configuration) {
|
|
59
|
+
return {
|
|
60
|
+
/**
|
|
61
|
+
* Get Dual Investment product list
|
|
62
|
+
*
|
|
63
|
+
* Weight: 1(IP)
|
|
64
|
+
*
|
|
65
|
+
* @summary Get Dual Investment product list
|
|
66
|
+
* @param {string} optionType Input CALL or PUT
|
|
67
|
+
* @param {string} exercisedCoin Target exercised asset, e.g.: if you subscribe to a high sell product (call option), you should input: `optionType`:CALL,`exercisedCoin`:USDT,`investCoin`:BNB; if you subscribe to a low buy product (put option), you should input: `optionType`:PUT,`exercisedCoin`:BNB,`investCoin`:USDT
|
|
68
|
+
* @param {string} investCoin Asset used for subscribing, e.g.: if you subscribe to a high sell product (call option), you should input: `optionType`:CALL,`exercisedCoin`:USDT,`investCoin`:BNB; if you subscribe to a low buy product (put option), you should input: `optionType`:PUT,`exercisedCoin`:BNB,`investCoin`:USDT
|
|
69
|
+
* @param {number} [pageSize] Default: 10, Maximum: 100
|
|
70
|
+
* @param {number} [pageIndex] Default: 1
|
|
71
|
+
* @param {number} [recvWindow] The value cannot be greater than 60000
|
|
72
|
+
*
|
|
73
|
+
* @throws {RequiredError}
|
|
74
|
+
*/
|
|
75
|
+
getDualInvestmentProductList: async (optionType, exercisedCoin, investCoin, pageSize, pageIndex, recvWindow) => {
|
|
76
|
+
(0, import_common.assertParamExists)("getDualInvestmentProductList", "optionType", optionType);
|
|
77
|
+
(0, import_common.assertParamExists)("getDualInvestmentProductList", "exercisedCoin", exercisedCoin);
|
|
78
|
+
(0, import_common.assertParamExists)("getDualInvestmentProductList", "investCoin", investCoin);
|
|
79
|
+
const localVarQueryParameter = {};
|
|
80
|
+
if (optionType !== void 0 && optionType !== null) {
|
|
81
|
+
localVarQueryParameter["optionType"] = optionType;
|
|
82
|
+
}
|
|
83
|
+
if (exercisedCoin !== void 0 && exercisedCoin !== null) {
|
|
84
|
+
localVarQueryParameter["exercisedCoin"] = exercisedCoin;
|
|
85
|
+
}
|
|
86
|
+
if (investCoin !== void 0 && investCoin !== null) {
|
|
87
|
+
localVarQueryParameter["investCoin"] = investCoin;
|
|
88
|
+
}
|
|
89
|
+
if (pageSize !== void 0 && pageSize !== null) {
|
|
90
|
+
localVarQueryParameter["pageSize"] = pageSize;
|
|
91
|
+
}
|
|
92
|
+
if (pageIndex !== void 0 && pageIndex !== null) {
|
|
93
|
+
localVarQueryParameter["pageIndex"] = pageIndex;
|
|
94
|
+
}
|
|
95
|
+
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
96
|
+
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
97
|
+
}
|
|
98
|
+
let _timeUnit;
|
|
99
|
+
if ("timeUnit" in configuration)
|
|
100
|
+
_timeUnit = configuration.timeUnit;
|
|
101
|
+
return {
|
|
102
|
+
endpoint: "/sapi/v1/dci/product/list",
|
|
103
|
+
method: "GET",
|
|
104
|
+
params: localVarQueryParameter,
|
|
105
|
+
timeUnit: _timeUnit
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
var MarketDataApi = class {
|
|
111
|
+
constructor(configuration) {
|
|
112
|
+
this.configuration = configuration;
|
|
113
|
+
this.localVarAxiosParamCreator = MarketDataApiAxiosParamCreator(configuration);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get Dual Investment product list
|
|
117
|
+
*
|
|
118
|
+
* Weight: 1(IP)
|
|
119
|
+
*
|
|
120
|
+
* @summary Get Dual Investment product list
|
|
121
|
+
* @param {GetDualInvestmentProductListRequest} requestParameters Request parameters.
|
|
122
|
+
* @returns {Promise<RestApiResponse<GetDualInvestmentProductListResponse>>}
|
|
123
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
124
|
+
* @memberof MarketDataApi
|
|
125
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/market-data/Get-Dual-Investment-product-list Binance API Documentation}
|
|
126
|
+
*/
|
|
127
|
+
async getDualInvestmentProductList(requestParameters) {
|
|
128
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDualInvestmentProductList(
|
|
129
|
+
requestParameters?.optionType,
|
|
130
|
+
requestParameters?.exercisedCoin,
|
|
131
|
+
requestParameters?.investCoin,
|
|
132
|
+
requestParameters?.pageSize,
|
|
133
|
+
requestParameters?.pageIndex,
|
|
134
|
+
requestParameters?.recvWindow
|
|
135
|
+
);
|
|
136
|
+
return (0, import_common.sendRequest)(
|
|
137
|
+
this.configuration,
|
|
138
|
+
localVarAxiosArgs.endpoint,
|
|
139
|
+
localVarAxiosArgs.method,
|
|
140
|
+
localVarAxiosArgs.params,
|
|
141
|
+
localVarAxiosArgs?.timeUnit,
|
|
142
|
+
{ isSigned: false }
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/rest-api/modules/trade-api.ts
|
|
148
|
+
var import_common2 = require("@binance/common");
|
|
149
|
+
var TradeApiAxiosParamCreator = function(configuration) {
|
|
150
|
+
return {
|
|
151
|
+
/**
|
|
152
|
+
* Change Auto-Compound status
|
|
153
|
+
*
|
|
154
|
+
* Weight: 1(IP)
|
|
155
|
+
*
|
|
156
|
+
* @summary Change Auto-Compound status(USER_DATA)
|
|
157
|
+
* @param {string} positionId Get positionId from `/sapi/v1/dci/product/positions`
|
|
158
|
+
* @param {string} [autoCompoundPlan]
|
|
159
|
+
* @param {number} [recvWindow] The value cannot be greater than 60000
|
|
160
|
+
*
|
|
161
|
+
* @throws {RequiredError}
|
|
162
|
+
*/
|
|
163
|
+
changeAutoCompoundStatus: async (positionId, autoCompoundPlan, recvWindow) => {
|
|
164
|
+
(0, import_common2.assertParamExists)("changeAutoCompoundStatus", "positionId", positionId);
|
|
165
|
+
const localVarQueryParameter = {};
|
|
166
|
+
if (positionId !== void 0 && positionId !== null) {
|
|
167
|
+
localVarQueryParameter["positionId"] = positionId;
|
|
168
|
+
}
|
|
169
|
+
if (autoCompoundPlan !== void 0 && autoCompoundPlan !== null) {
|
|
170
|
+
localVarQueryParameter["AutoCompoundPlan"] = autoCompoundPlan;
|
|
171
|
+
}
|
|
172
|
+
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
173
|
+
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
174
|
+
}
|
|
175
|
+
let _timeUnit;
|
|
176
|
+
if ("timeUnit" in configuration)
|
|
177
|
+
_timeUnit = configuration.timeUnit;
|
|
178
|
+
return {
|
|
179
|
+
endpoint: "/sapi/v1/dci/product/auto_compound/edit-status",
|
|
180
|
+
method: "POST",
|
|
181
|
+
params: localVarQueryParameter,
|
|
182
|
+
timeUnit: _timeUnit
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Check Dual Investment accounts
|
|
187
|
+
*
|
|
188
|
+
* Weight: 1(IP)
|
|
189
|
+
*
|
|
190
|
+
* @summary Check Dual Investment accounts(USER_DATA)
|
|
191
|
+
* @param {number} [recvWindow] The value cannot be greater than 60000
|
|
192
|
+
*
|
|
193
|
+
* @throws {RequiredError}
|
|
194
|
+
*/
|
|
195
|
+
checkDualInvestmentAccounts: async (recvWindow) => {
|
|
196
|
+
const localVarQueryParameter = {};
|
|
197
|
+
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
198
|
+
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
199
|
+
}
|
|
200
|
+
let _timeUnit;
|
|
201
|
+
if ("timeUnit" in configuration)
|
|
202
|
+
_timeUnit = configuration.timeUnit;
|
|
203
|
+
return {
|
|
204
|
+
endpoint: "/sapi/v1/dci/product/accounts",
|
|
205
|
+
method: "GET",
|
|
206
|
+
params: localVarQueryParameter,
|
|
207
|
+
timeUnit: _timeUnit
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Get Dual Investment positions (batch)
|
|
212
|
+
*
|
|
213
|
+
* Weight: 1(IP)
|
|
214
|
+
*
|
|
215
|
+
* @summary Get Dual Investment positions(USER_DATA)
|
|
216
|
+
* @param {string} [status] `PENDING`:Products are purchasing, will give results later;`PURCHASE_SUCCESS`:purchase successfully;`SETTLED`: Products are finish settling;`PURCHASE_FAIL`:fail to purchase;`REFUNDING`:refund ongoing;`REFUND_SUCCESS`:refund to spot account successfully; `SETTLING`:Products are settling. If don't fill this field, will response all the position status.
|
|
217
|
+
* @param {number} [pageSize] Default: 10, Maximum: 100
|
|
218
|
+
* @param {number} [pageIndex] Default: 1
|
|
219
|
+
* @param {number} [recvWindow] The value cannot be greater than 60000
|
|
220
|
+
*
|
|
221
|
+
* @throws {RequiredError}
|
|
222
|
+
*/
|
|
223
|
+
getDualInvestmentPositions: async (status, pageSize, pageIndex, recvWindow) => {
|
|
224
|
+
const localVarQueryParameter = {};
|
|
225
|
+
if (status !== void 0 && status !== null) {
|
|
226
|
+
localVarQueryParameter["status"] = status;
|
|
227
|
+
}
|
|
228
|
+
if (pageSize !== void 0 && pageSize !== null) {
|
|
229
|
+
localVarQueryParameter["pageSize"] = pageSize;
|
|
230
|
+
}
|
|
231
|
+
if (pageIndex !== void 0 && pageIndex !== null) {
|
|
232
|
+
localVarQueryParameter["pageIndex"] = pageIndex;
|
|
233
|
+
}
|
|
234
|
+
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
235
|
+
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
236
|
+
}
|
|
237
|
+
let _timeUnit;
|
|
238
|
+
if ("timeUnit" in configuration)
|
|
239
|
+
_timeUnit = configuration.timeUnit;
|
|
240
|
+
return {
|
|
241
|
+
endpoint: "/sapi/v1/dci/product/positions",
|
|
242
|
+
method: "GET",
|
|
243
|
+
params: localVarQueryParameter,
|
|
244
|
+
timeUnit: _timeUnit
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* Subscribe Dual Investment products
|
|
249
|
+
*
|
|
250
|
+
* Products are not available. // this means APR changes to lower value, or orders are not unavailable.
|
|
251
|
+
* Failed. This means System or network errors.
|
|
252
|
+
*
|
|
253
|
+
* Weight: 1(IP)
|
|
254
|
+
*
|
|
255
|
+
* @summary Subscribe Dual Investment products(USER_DATA)
|
|
256
|
+
* @param {string} id get id from `/sapi/v1/dci/product/list`
|
|
257
|
+
* @param {string} orderId get orderId from `/sapi/v1/dci/product/list`
|
|
258
|
+
* @param {number} depositAmount the amount for subscribing
|
|
259
|
+
* @param {string} autoCompoundPlan `NONE`: switch off the plan, `STANDARD`:standard plan,`ADVANCED`:advanced plan
|
|
260
|
+
* @param {number} [recvWindow] The value cannot be greater than 60000
|
|
261
|
+
*
|
|
262
|
+
* @throws {RequiredError}
|
|
263
|
+
*/
|
|
264
|
+
subscribeDualInvestmentProducts: async (id, orderId, depositAmount, autoCompoundPlan, recvWindow) => {
|
|
265
|
+
(0, import_common2.assertParamExists)("subscribeDualInvestmentProducts", "id", id);
|
|
266
|
+
(0, import_common2.assertParamExists)("subscribeDualInvestmentProducts", "orderId", orderId);
|
|
267
|
+
(0, import_common2.assertParamExists)("subscribeDualInvestmentProducts", "depositAmount", depositAmount);
|
|
268
|
+
(0, import_common2.assertParamExists)(
|
|
269
|
+
"subscribeDualInvestmentProducts",
|
|
270
|
+
"autoCompoundPlan",
|
|
271
|
+
autoCompoundPlan
|
|
272
|
+
);
|
|
273
|
+
const localVarQueryParameter = {};
|
|
274
|
+
if (id !== void 0 && id !== null) {
|
|
275
|
+
localVarQueryParameter["id"] = id;
|
|
276
|
+
}
|
|
277
|
+
if (orderId !== void 0 && orderId !== null) {
|
|
278
|
+
localVarQueryParameter["orderId"] = orderId;
|
|
279
|
+
}
|
|
280
|
+
if (depositAmount !== void 0 && depositAmount !== null) {
|
|
281
|
+
localVarQueryParameter["depositAmount"] = depositAmount;
|
|
282
|
+
}
|
|
283
|
+
if (autoCompoundPlan !== void 0 && autoCompoundPlan !== null) {
|
|
284
|
+
localVarQueryParameter["autoCompoundPlan"] = autoCompoundPlan;
|
|
285
|
+
}
|
|
286
|
+
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
287
|
+
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
288
|
+
}
|
|
289
|
+
let _timeUnit;
|
|
290
|
+
if ("timeUnit" in configuration)
|
|
291
|
+
_timeUnit = configuration.timeUnit;
|
|
292
|
+
return {
|
|
293
|
+
endpoint: "/sapi/v1/dci/product/subscribe",
|
|
294
|
+
method: "POST",
|
|
295
|
+
params: localVarQueryParameter,
|
|
296
|
+
timeUnit: _timeUnit
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
var TradeApi = class {
|
|
302
|
+
constructor(configuration) {
|
|
303
|
+
this.configuration = configuration;
|
|
304
|
+
this.localVarAxiosParamCreator = TradeApiAxiosParamCreator(configuration);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Change Auto-Compound status
|
|
308
|
+
*
|
|
309
|
+
* Weight: 1(IP)
|
|
310
|
+
*
|
|
311
|
+
* @summary Change Auto-Compound status(USER_DATA)
|
|
312
|
+
* @param {ChangeAutoCompoundStatusRequest} requestParameters Request parameters.
|
|
313
|
+
* @returns {Promise<RestApiResponse<ChangeAutoCompoundStatusResponse>>}
|
|
314
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
315
|
+
* @memberof TradeApi
|
|
316
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Change-Auto-Compound-status Binance API Documentation}
|
|
317
|
+
*/
|
|
318
|
+
async changeAutoCompoundStatus(requestParameters) {
|
|
319
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.changeAutoCompoundStatus(
|
|
320
|
+
requestParameters?.positionId,
|
|
321
|
+
requestParameters?.autoCompoundPlan,
|
|
322
|
+
requestParameters?.recvWindow
|
|
323
|
+
);
|
|
324
|
+
return (0, import_common2.sendRequest)(
|
|
325
|
+
this.configuration,
|
|
326
|
+
localVarAxiosArgs.endpoint,
|
|
327
|
+
localVarAxiosArgs.method,
|
|
328
|
+
localVarAxiosArgs.params,
|
|
329
|
+
localVarAxiosArgs?.timeUnit,
|
|
330
|
+
{ isSigned: true }
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Check Dual Investment accounts
|
|
335
|
+
*
|
|
336
|
+
* Weight: 1(IP)
|
|
337
|
+
*
|
|
338
|
+
* @summary Check Dual Investment accounts(USER_DATA)
|
|
339
|
+
* @param {CheckDualInvestmentAccountsRequest} requestParameters Request parameters.
|
|
340
|
+
* @returns {Promise<RestApiResponse<CheckDualInvestmentAccountsResponse>>}
|
|
341
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
342
|
+
* @memberof TradeApi
|
|
343
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Check-Dual-Investment-accounts Binance API Documentation}
|
|
344
|
+
*/
|
|
345
|
+
async checkDualInvestmentAccounts(requestParameters = {}) {
|
|
346
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.checkDualInvestmentAccounts(
|
|
347
|
+
requestParameters?.recvWindow
|
|
348
|
+
);
|
|
349
|
+
return (0, import_common2.sendRequest)(
|
|
350
|
+
this.configuration,
|
|
351
|
+
localVarAxiosArgs.endpoint,
|
|
352
|
+
localVarAxiosArgs.method,
|
|
353
|
+
localVarAxiosArgs.params,
|
|
354
|
+
localVarAxiosArgs?.timeUnit,
|
|
355
|
+
{ isSigned: true }
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get Dual Investment positions (batch)
|
|
360
|
+
*
|
|
361
|
+
* Weight: 1(IP)
|
|
362
|
+
*
|
|
363
|
+
* @summary Get Dual Investment positions(USER_DATA)
|
|
364
|
+
* @param {GetDualInvestmentPositionsRequest} requestParameters Request parameters.
|
|
365
|
+
* @returns {Promise<RestApiResponse<GetDualInvestmentPositionsResponse>>}
|
|
366
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
367
|
+
* @memberof TradeApi
|
|
368
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Get-Dual-Investment-positions Binance API Documentation}
|
|
369
|
+
*/
|
|
370
|
+
async getDualInvestmentPositions(requestParameters = {}) {
|
|
371
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDualInvestmentPositions(
|
|
372
|
+
requestParameters?.status,
|
|
373
|
+
requestParameters?.pageSize,
|
|
374
|
+
requestParameters?.pageIndex,
|
|
375
|
+
requestParameters?.recvWindow
|
|
376
|
+
);
|
|
377
|
+
return (0, import_common2.sendRequest)(
|
|
378
|
+
this.configuration,
|
|
379
|
+
localVarAxiosArgs.endpoint,
|
|
380
|
+
localVarAxiosArgs.method,
|
|
381
|
+
localVarAxiosArgs.params,
|
|
382
|
+
localVarAxiosArgs?.timeUnit,
|
|
383
|
+
{ isSigned: true }
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Subscribe Dual Investment products
|
|
388
|
+
*
|
|
389
|
+
* Products are not available. // this means APR changes to lower value, or orders are not unavailable.
|
|
390
|
+
* Failed. This means System or network errors.
|
|
391
|
+
*
|
|
392
|
+
* Weight: 1(IP)
|
|
393
|
+
*
|
|
394
|
+
* @summary Subscribe Dual Investment products(USER_DATA)
|
|
395
|
+
* @param {SubscribeDualInvestmentProductsRequest} requestParameters Request parameters.
|
|
396
|
+
* @returns {Promise<RestApiResponse<SubscribeDualInvestmentProductsResponse>>}
|
|
397
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
398
|
+
* @memberof TradeApi
|
|
399
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Subscribe-Dual-Investment-products Binance API Documentation}
|
|
400
|
+
*/
|
|
401
|
+
async subscribeDualInvestmentProducts(requestParameters) {
|
|
402
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.subscribeDualInvestmentProducts(
|
|
403
|
+
requestParameters?.id,
|
|
404
|
+
requestParameters?.orderId,
|
|
405
|
+
requestParameters?.depositAmount,
|
|
406
|
+
requestParameters?.autoCompoundPlan,
|
|
407
|
+
requestParameters?.recvWindow
|
|
408
|
+
);
|
|
409
|
+
return (0, import_common2.sendRequest)(
|
|
410
|
+
this.configuration,
|
|
411
|
+
localVarAxiosArgs.endpoint,
|
|
412
|
+
localVarAxiosArgs.method,
|
|
413
|
+
localVarAxiosArgs.params,
|
|
414
|
+
localVarAxiosArgs?.timeUnit,
|
|
415
|
+
{ isSigned: true }
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// src/rest-api/rest-api.ts
|
|
421
|
+
var import_common3 = require("@binance/common");
|
|
422
|
+
var RestAPI = class {
|
|
423
|
+
constructor(configuration) {
|
|
424
|
+
this.configuration = configuration;
|
|
425
|
+
this.marketDataApi = new MarketDataApi(configuration);
|
|
426
|
+
this.tradeApi = new TradeApi(configuration);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Generic function to send a request.
|
|
430
|
+
* @param endpoint - The API endpoint to call.
|
|
431
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
432
|
+
* @param params - Query parameters for the request.
|
|
433
|
+
*
|
|
434
|
+
* @returns A promise resolving to the response data object.
|
|
435
|
+
*/
|
|
436
|
+
sendRequest(endpoint, method, params = {}) {
|
|
437
|
+
return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Generic function to send a signed request.
|
|
441
|
+
* @param endpoint - The API endpoint to call.
|
|
442
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
443
|
+
* @param params - Query parameters for the request.
|
|
444
|
+
*
|
|
445
|
+
* @returns A promise resolving to the response data object.
|
|
446
|
+
*/
|
|
447
|
+
sendSignedRequest(endpoint, method, params = {}) {
|
|
448
|
+
return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0, {
|
|
449
|
+
isSigned: true
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Get Dual Investment product list
|
|
454
|
+
*
|
|
455
|
+
* Weight: 1(IP)
|
|
456
|
+
*
|
|
457
|
+
* @summary Get Dual Investment product list
|
|
458
|
+
* @param {GetDualInvestmentProductListRequest} requestParameters Request parameters.
|
|
459
|
+
* @returns {Promise<RestApiResponse<GetDualInvestmentProductListResponse>>}
|
|
460
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
461
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/market-data/Get-Dual-Investment-product-list Binance API Documentation}
|
|
462
|
+
*/
|
|
463
|
+
getDualInvestmentProductList(requestParameters) {
|
|
464
|
+
return this.marketDataApi.getDualInvestmentProductList(requestParameters);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Change Auto-Compound status
|
|
468
|
+
*
|
|
469
|
+
* Weight: 1(IP)
|
|
470
|
+
*
|
|
471
|
+
* @summary Change Auto-Compound status(USER_DATA)
|
|
472
|
+
* @param {ChangeAutoCompoundStatusRequest} requestParameters Request parameters.
|
|
473
|
+
* @returns {Promise<RestApiResponse<ChangeAutoCompoundStatusResponse>>}
|
|
474
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
475
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Change-Auto-Compound-status Binance API Documentation}
|
|
476
|
+
*/
|
|
477
|
+
changeAutoCompoundStatus(requestParameters) {
|
|
478
|
+
return this.tradeApi.changeAutoCompoundStatus(requestParameters);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Check Dual Investment accounts
|
|
482
|
+
*
|
|
483
|
+
* Weight: 1(IP)
|
|
484
|
+
*
|
|
485
|
+
* @summary Check Dual Investment accounts(USER_DATA)
|
|
486
|
+
* @param {CheckDualInvestmentAccountsRequest} requestParameters Request parameters.
|
|
487
|
+
* @returns {Promise<RestApiResponse<CheckDualInvestmentAccountsResponse>>}
|
|
488
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
489
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Check-Dual-Investment-accounts Binance API Documentation}
|
|
490
|
+
*/
|
|
491
|
+
checkDualInvestmentAccounts(requestParameters = {}) {
|
|
492
|
+
return this.tradeApi.checkDualInvestmentAccounts(requestParameters);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Get Dual Investment positions (batch)
|
|
496
|
+
*
|
|
497
|
+
* Weight: 1(IP)
|
|
498
|
+
*
|
|
499
|
+
* @summary Get Dual Investment positions(USER_DATA)
|
|
500
|
+
* @param {GetDualInvestmentPositionsRequest} requestParameters Request parameters.
|
|
501
|
+
* @returns {Promise<RestApiResponse<GetDualInvestmentPositionsResponse>>}
|
|
502
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
503
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Get-Dual-Investment-positions Binance API Documentation}
|
|
504
|
+
*/
|
|
505
|
+
getDualInvestmentPositions(requestParameters = {}) {
|
|
506
|
+
return this.tradeApi.getDualInvestmentPositions(requestParameters);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Subscribe Dual Investment products
|
|
510
|
+
*
|
|
511
|
+
* Products are not available. // this means APR changes to lower value, or orders are not unavailable.
|
|
512
|
+
* Failed. This means System or network errors.
|
|
513
|
+
*
|
|
514
|
+
* Weight: 1(IP)
|
|
515
|
+
*
|
|
516
|
+
* @summary Subscribe Dual Investment products(USER_DATA)
|
|
517
|
+
* @param {SubscribeDualInvestmentProductsRequest} requestParameters Request parameters.
|
|
518
|
+
* @returns {Promise<RestApiResponse<SubscribeDualInvestmentProductsResponse>>}
|
|
519
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
520
|
+
* @see {@link https://developers.binance.com/docs/dual_investment/trade/Subscribe-Dual-Investment-products Binance API Documentation}
|
|
521
|
+
*/
|
|
522
|
+
subscribeDualInvestmentProducts(requestParameters) {
|
|
523
|
+
return this.tradeApi.subscribeDualInvestmentProducts(requestParameters);
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
// src/dual-investment.ts
|
|
528
|
+
var DualInvestment = class {
|
|
529
|
+
constructor(config) {
|
|
530
|
+
if (config?.configurationRestAPI) {
|
|
531
|
+
const configRestAPI = new import_common4.ConfigurationRestAPI(config.configurationRestAPI);
|
|
532
|
+
configRestAPI.basePath = configRestAPI.basePath || import_common4.DUAL_INVESTMENT_REST_API_PROD_URL;
|
|
533
|
+
configRestAPI.baseOptions = configRestAPI.baseOptions || {};
|
|
534
|
+
configRestAPI.baseOptions.headers = {
|
|
535
|
+
...configRestAPI.baseOptions.headers || {},
|
|
536
|
+
"User-Agent": `${name}/${version} (Node.js/${process.version}; ${(0, import_os.platform)()}; ${(0, import_os.arch)()})`
|
|
537
|
+
};
|
|
538
|
+
this.restAPI = new RestAPI(configRestAPI);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
// src/index.ts
|
|
544
|
+
var import_common5 = require("@binance/common");
|
|
545
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
546
|
+
0 && (module.exports = {
|
|
547
|
+
BadRequestError,
|
|
548
|
+
ConnectorClientError,
|
|
549
|
+
DUAL_INVESTMENT_REST_API_PROD_URL,
|
|
550
|
+
DUAL_INVESTMENT_REST_API_TESTNET_URL,
|
|
551
|
+
DualInvestment,
|
|
552
|
+
DualInvestmentRestAPI,
|
|
553
|
+
ForbiddenError,
|
|
554
|
+
NetworkError,
|
|
555
|
+
NotFoundError,
|
|
556
|
+
RateLimitBanError,
|
|
557
|
+
RequiredError,
|
|
558
|
+
ServerError,
|
|
559
|
+
TooManyRequestsError,
|
|
560
|
+
UnauthorizedError
|
|
561
|
+
});
|
|
562
|
+
//# sourceMappingURL=index.js.map
|