@binance/margin-trading 9.0.1 → 10.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/dist/index.d.mts +1 -396
- package/dist/index.d.ts +1 -396
- package/dist/index.js +33 -447
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -427
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,31 +20,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
BadRequestError: () =>
|
|
24
|
-
ConnectorClientError: () =>
|
|
25
|
-
ForbiddenError: () =>
|
|
26
|
-
MARGIN_TRADING_REST_API_PROD_URL: () =>
|
|
27
|
-
MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL: () =>
|
|
28
|
-
MARGIN_TRADING_WS_STREAMS_PROD_URL: () =>
|
|
23
|
+
BadRequestError: () => import_common11.BadRequestError,
|
|
24
|
+
ConnectorClientError: () => import_common11.ConnectorClientError,
|
|
25
|
+
ForbiddenError: () => import_common11.ForbiddenError,
|
|
26
|
+
MARGIN_TRADING_REST_API_PROD_URL: () => import_common11.MARGIN_TRADING_REST_API_PROD_URL,
|
|
27
|
+
MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL: () => import_common11.MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL,
|
|
28
|
+
MARGIN_TRADING_WS_STREAMS_PROD_URL: () => import_common11.MARGIN_TRADING_WS_STREAMS_PROD_URL,
|
|
29
29
|
MarginTrading: () => MarginTrading,
|
|
30
30
|
MarginTradingRestAPI: () => rest_api_exports,
|
|
31
31
|
MarginTradingWebsocketStreams: () => websocket_streams_exports,
|
|
32
|
-
NetworkError: () =>
|
|
33
|
-
NotFoundError: () =>
|
|
34
|
-
RateLimitBanError: () =>
|
|
35
|
-
RequiredError: () =>
|
|
36
|
-
ServerError: () =>
|
|
37
|
-
TooManyRequestsError: () =>
|
|
38
|
-
UnauthorizedError: () =>
|
|
32
|
+
NetworkError: () => import_common11.NetworkError,
|
|
33
|
+
NotFoundError: () => import_common11.NotFoundError,
|
|
34
|
+
RateLimitBanError: () => import_common11.RateLimitBanError,
|
|
35
|
+
RequiredError: () => import_common11.RequiredError,
|
|
36
|
+
ServerError: () => import_common11.ServerError,
|
|
37
|
+
TooManyRequestsError: () => import_common11.TooManyRequestsError,
|
|
38
|
+
UnauthorizedError: () => import_common11.UnauthorizedError
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(index_exports);
|
|
41
41
|
|
|
42
42
|
// src/margin-trading.ts
|
|
43
|
-
var
|
|
43
|
+
var import_common10 = require("@binance/common");
|
|
44
44
|
|
|
45
45
|
// package.json
|
|
46
46
|
var name = "@binance/margin-trading";
|
|
47
|
-
var version = "
|
|
47
|
+
var version = "10.0.0";
|
|
48
48
|
|
|
49
49
|
// src/rest-api/index.ts
|
|
50
50
|
var rest_api_exports = {};
|
|
@@ -62,7 +62,6 @@ __export(rest_api_exports, {
|
|
|
62
62
|
RestAPI: () => RestAPI,
|
|
63
63
|
RiskDataStreamApi: () => RiskDataStreamApi,
|
|
64
64
|
TradeApi: () => TradeApi,
|
|
65
|
-
TradeDataStreamApi: () => TradeDataStreamApi,
|
|
66
65
|
TransferApi: () => TransferApi
|
|
67
66
|
});
|
|
68
67
|
|
|
@@ -4128,331 +4127,8 @@ var MarginAccountNewOtocoNewOrderRespTypeEnum = /* @__PURE__ */ ((MarginAccountN
|
|
|
4128
4127
|
return MarginAccountNewOtocoNewOrderRespTypeEnum2;
|
|
4129
4128
|
})(MarginAccountNewOtocoNewOrderRespTypeEnum || {});
|
|
4130
4129
|
|
|
4131
|
-
// src/rest-api/modules/trade-data-stream-api.ts
|
|
4132
|
-
var import_common6 = require("@binance/common");
|
|
4133
|
-
var TradeDataStreamApiAxiosParamCreator = function(configuration) {
|
|
4134
|
-
return {
|
|
4135
|
-
/**
|
|
4136
|
-
* Close out a isolated margin user data stream.
|
|
4137
|
-
*
|
|
4138
|
-
* Weight: 3000
|
|
4139
|
-
*
|
|
4140
|
-
* @summary Close Isolated Margin User Data Stream (USER_STREAM)
|
|
4141
|
-
* @param {string} symbol
|
|
4142
|
-
* @param {string} listenkey
|
|
4143
|
-
*
|
|
4144
|
-
* @deprecated
|
|
4145
|
-
* @throws {RequiredError}
|
|
4146
|
-
*/
|
|
4147
|
-
closeIsolatedMarginUserDataStream: async (symbol, listenkey) => {
|
|
4148
|
-
(0, import_common6.assertParamExists)("closeIsolatedMarginUserDataStream", "symbol", symbol);
|
|
4149
|
-
(0, import_common6.assertParamExists)("closeIsolatedMarginUserDataStream", "listenkey", listenkey);
|
|
4150
|
-
const localVarQueryParameter = {};
|
|
4151
|
-
if (symbol !== void 0 && symbol !== null) {
|
|
4152
|
-
localVarQueryParameter["symbol"] = symbol;
|
|
4153
|
-
}
|
|
4154
|
-
if (listenkey !== void 0 && listenkey !== null) {
|
|
4155
|
-
localVarQueryParameter["listenkey"] = listenkey;
|
|
4156
|
-
}
|
|
4157
|
-
let _timeUnit;
|
|
4158
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4159
|
-
return {
|
|
4160
|
-
endpoint: "/sapi/v1/userDataStream/isolated",
|
|
4161
|
-
method: "DELETE",
|
|
4162
|
-
params: localVarQueryParameter,
|
|
4163
|
-
timeUnit: _timeUnit
|
|
4164
|
-
};
|
|
4165
|
-
},
|
|
4166
|
-
/**
|
|
4167
|
-
* Close out a Margin user data stream.
|
|
4168
|
-
*
|
|
4169
|
-
* Weight: 3000
|
|
4170
|
-
*
|
|
4171
|
-
* @summary Close Margin User Data Stream (USER_STREAM)
|
|
4172
|
-
* @param {string} listenkey
|
|
4173
|
-
*
|
|
4174
|
-
* @deprecated
|
|
4175
|
-
* @throws {RequiredError}
|
|
4176
|
-
*/
|
|
4177
|
-
closeMarginUserDataStream: async (listenkey) => {
|
|
4178
|
-
(0, import_common6.assertParamExists)("closeMarginUserDataStream", "listenkey", listenkey);
|
|
4179
|
-
const localVarQueryParameter = {};
|
|
4180
|
-
if (listenkey !== void 0 && listenkey !== null) {
|
|
4181
|
-
localVarQueryParameter["listenkey"] = listenkey;
|
|
4182
|
-
}
|
|
4183
|
-
let _timeUnit;
|
|
4184
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4185
|
-
return {
|
|
4186
|
-
endpoint: "/sapi/v1/userDataStream",
|
|
4187
|
-
method: "DELETE",
|
|
4188
|
-
params: localVarQueryParameter,
|
|
4189
|
-
timeUnit: _timeUnit
|
|
4190
|
-
};
|
|
4191
|
-
},
|
|
4192
|
-
/**
|
|
4193
|
-
* Keepalive an isolated margin user data stream to prevent a time out.
|
|
4194
|
-
*
|
|
4195
|
-
* Weight: 1
|
|
4196
|
-
*
|
|
4197
|
-
* @summary Keepalive Isolated Margin User Data Stream (USER_STREAM)
|
|
4198
|
-
* @param {string} symbol
|
|
4199
|
-
* @param {string} listenKey
|
|
4200
|
-
*
|
|
4201
|
-
* @deprecated
|
|
4202
|
-
* @throws {RequiredError}
|
|
4203
|
-
*/
|
|
4204
|
-
keepaliveIsolatedMarginUserDataStream: async (symbol, listenKey) => {
|
|
4205
|
-
(0, import_common6.assertParamExists)("keepaliveIsolatedMarginUserDataStream", "symbol", symbol);
|
|
4206
|
-
(0, import_common6.assertParamExists)("keepaliveIsolatedMarginUserDataStream", "listenKey", listenKey);
|
|
4207
|
-
const localVarQueryParameter = {};
|
|
4208
|
-
if (symbol !== void 0 && symbol !== null) {
|
|
4209
|
-
localVarQueryParameter["symbol"] = symbol;
|
|
4210
|
-
}
|
|
4211
|
-
if (listenKey !== void 0 && listenKey !== null) {
|
|
4212
|
-
localVarQueryParameter["listenKey"] = listenKey;
|
|
4213
|
-
}
|
|
4214
|
-
let _timeUnit;
|
|
4215
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4216
|
-
return {
|
|
4217
|
-
endpoint: "/sapi/v1/userDataStream/isolated",
|
|
4218
|
-
method: "PUT",
|
|
4219
|
-
params: localVarQueryParameter,
|
|
4220
|
-
timeUnit: _timeUnit
|
|
4221
|
-
};
|
|
4222
|
-
},
|
|
4223
|
-
/**
|
|
4224
|
-
* Keepalive a margin user data stream to prevent a time out.
|
|
4225
|
-
*
|
|
4226
|
-
* Weight: 1
|
|
4227
|
-
*
|
|
4228
|
-
* @summary Keepalive Margin User Data Stream (USER_STREAM)
|
|
4229
|
-
* @param {string} listenKey
|
|
4230
|
-
*
|
|
4231
|
-
* @deprecated
|
|
4232
|
-
* @throws {RequiredError}
|
|
4233
|
-
*/
|
|
4234
|
-
keepaliveMarginUserDataStream: async (listenKey) => {
|
|
4235
|
-
(0, import_common6.assertParamExists)("keepaliveMarginUserDataStream", "listenKey", listenKey);
|
|
4236
|
-
const localVarQueryParameter = {};
|
|
4237
|
-
if (listenKey !== void 0 && listenKey !== null) {
|
|
4238
|
-
localVarQueryParameter["listenKey"] = listenKey;
|
|
4239
|
-
}
|
|
4240
|
-
let _timeUnit;
|
|
4241
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4242
|
-
return {
|
|
4243
|
-
endpoint: "/sapi/v1/userDataStream",
|
|
4244
|
-
method: "PUT",
|
|
4245
|
-
params: localVarQueryParameter,
|
|
4246
|
-
timeUnit: _timeUnit
|
|
4247
|
-
};
|
|
4248
|
-
},
|
|
4249
|
-
/**
|
|
4250
|
-
* Start a new isolated margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
4251
|
-
*
|
|
4252
|
-
* Weight: 1
|
|
4253
|
-
*
|
|
4254
|
-
* @summary Start Isolated Margin User Data Stream (USER_STREAM)
|
|
4255
|
-
* @param {string} symbol
|
|
4256
|
-
*
|
|
4257
|
-
* @deprecated
|
|
4258
|
-
* @throws {RequiredError}
|
|
4259
|
-
*/
|
|
4260
|
-
startIsolatedMarginUserDataStream: async (symbol) => {
|
|
4261
|
-
(0, import_common6.assertParamExists)("startIsolatedMarginUserDataStream", "symbol", symbol);
|
|
4262
|
-
const localVarQueryParameter = {};
|
|
4263
|
-
if (symbol !== void 0 && symbol !== null) {
|
|
4264
|
-
localVarQueryParameter["symbol"] = symbol;
|
|
4265
|
-
}
|
|
4266
|
-
let _timeUnit;
|
|
4267
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4268
|
-
return {
|
|
4269
|
-
endpoint: "/sapi/v1/userDataStream/isolated",
|
|
4270
|
-
method: "POST",
|
|
4271
|
-
params: localVarQueryParameter,
|
|
4272
|
-
timeUnit: _timeUnit
|
|
4273
|
-
};
|
|
4274
|
-
},
|
|
4275
|
-
/**
|
|
4276
|
-
* Start a new margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
4277
|
-
*
|
|
4278
|
-
* Weight: 1
|
|
4279
|
-
*
|
|
4280
|
-
* @summary Start Margin User Data Stream (USER_STREAM)
|
|
4281
|
-
*
|
|
4282
|
-
* @deprecated
|
|
4283
|
-
* @throws {RequiredError}
|
|
4284
|
-
*/
|
|
4285
|
-
startMarginUserDataStream: async () => {
|
|
4286
|
-
const localVarQueryParameter = {};
|
|
4287
|
-
let _timeUnit;
|
|
4288
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
4289
|
-
return {
|
|
4290
|
-
endpoint: "/sapi/v1/userDataStream",
|
|
4291
|
-
method: "POST",
|
|
4292
|
-
params: localVarQueryParameter,
|
|
4293
|
-
timeUnit: _timeUnit
|
|
4294
|
-
};
|
|
4295
|
-
}
|
|
4296
|
-
};
|
|
4297
|
-
};
|
|
4298
|
-
var TradeDataStreamApi = class {
|
|
4299
|
-
constructor(configuration) {
|
|
4300
|
-
this.configuration = configuration;
|
|
4301
|
-
this.localVarAxiosParamCreator = TradeDataStreamApiAxiosParamCreator(configuration);
|
|
4302
|
-
}
|
|
4303
|
-
/**
|
|
4304
|
-
* Close out a isolated margin user data stream.
|
|
4305
|
-
*
|
|
4306
|
-
* Weight: 3000
|
|
4307
|
-
*
|
|
4308
|
-
* @summary Close Isolated Margin User Data Stream (USER_STREAM)
|
|
4309
|
-
* @param {CloseIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
4310
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
4311
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4312
|
-
* @memberof TradeDataStreamApi
|
|
4313
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
4314
|
-
*/
|
|
4315
|
-
async closeIsolatedMarginUserDataStream(requestParameters) {
|
|
4316
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.closeIsolatedMarginUserDataStream(
|
|
4317
|
-
requestParameters?.symbol,
|
|
4318
|
-
requestParameters?.listenkey
|
|
4319
|
-
);
|
|
4320
|
-
return (0, import_common6.sendRequest)(
|
|
4321
|
-
this.configuration,
|
|
4322
|
-
localVarAxiosArgs.endpoint,
|
|
4323
|
-
localVarAxiosArgs.method,
|
|
4324
|
-
localVarAxiosArgs.params,
|
|
4325
|
-
localVarAxiosArgs?.timeUnit,
|
|
4326
|
-
{ isSigned: false }
|
|
4327
|
-
);
|
|
4328
|
-
}
|
|
4329
|
-
/**
|
|
4330
|
-
* Close out a Margin user data stream.
|
|
4331
|
-
*
|
|
4332
|
-
* Weight: 3000
|
|
4333
|
-
*
|
|
4334
|
-
* @summary Close Margin User Data Stream (USER_STREAM)
|
|
4335
|
-
* @param {CloseMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
4336
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
4337
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4338
|
-
* @memberof TradeDataStreamApi
|
|
4339
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Margin-User-Data-Stream Binance API Documentation}
|
|
4340
|
-
*/
|
|
4341
|
-
async closeMarginUserDataStream(requestParameters) {
|
|
4342
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.closeMarginUserDataStream(
|
|
4343
|
-
requestParameters?.listenkey
|
|
4344
|
-
);
|
|
4345
|
-
return (0, import_common6.sendRequest)(
|
|
4346
|
-
this.configuration,
|
|
4347
|
-
localVarAxiosArgs.endpoint,
|
|
4348
|
-
localVarAxiosArgs.method,
|
|
4349
|
-
localVarAxiosArgs.params,
|
|
4350
|
-
localVarAxiosArgs?.timeUnit,
|
|
4351
|
-
{ isSigned: false }
|
|
4352
|
-
);
|
|
4353
|
-
}
|
|
4354
|
-
/**
|
|
4355
|
-
* Keepalive an isolated margin user data stream to prevent a time out.
|
|
4356
|
-
*
|
|
4357
|
-
* Weight: 1
|
|
4358
|
-
*
|
|
4359
|
-
* @summary Keepalive Isolated Margin User Data Stream (USER_STREAM)
|
|
4360
|
-
* @param {KeepaliveIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
4361
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
4362
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4363
|
-
* @memberof TradeDataStreamApi
|
|
4364
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Keepalive-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
4365
|
-
*/
|
|
4366
|
-
async keepaliveIsolatedMarginUserDataStream(requestParameters) {
|
|
4367
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.keepaliveIsolatedMarginUserDataStream(
|
|
4368
|
-
requestParameters?.symbol,
|
|
4369
|
-
requestParameters?.listenKey
|
|
4370
|
-
);
|
|
4371
|
-
return (0, import_common6.sendRequest)(
|
|
4372
|
-
this.configuration,
|
|
4373
|
-
localVarAxiosArgs.endpoint,
|
|
4374
|
-
localVarAxiosArgs.method,
|
|
4375
|
-
localVarAxiosArgs.params,
|
|
4376
|
-
localVarAxiosArgs?.timeUnit,
|
|
4377
|
-
{ isSigned: false }
|
|
4378
|
-
);
|
|
4379
|
-
}
|
|
4380
|
-
/**
|
|
4381
|
-
* Keepalive a margin user data stream to prevent a time out.
|
|
4382
|
-
*
|
|
4383
|
-
* Weight: 1
|
|
4384
|
-
*
|
|
4385
|
-
* @summary Keepalive Margin User Data Stream (USER_STREAM)
|
|
4386
|
-
* @param {KeepaliveMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
4387
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
4388
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4389
|
-
* @memberof TradeDataStreamApi
|
|
4390
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Keepalive-Margin-User-Data-Stream Binance API Documentation}
|
|
4391
|
-
*/
|
|
4392
|
-
async keepaliveMarginUserDataStream(requestParameters) {
|
|
4393
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.keepaliveMarginUserDataStream(
|
|
4394
|
-
requestParameters?.listenKey
|
|
4395
|
-
);
|
|
4396
|
-
return (0, import_common6.sendRequest)(
|
|
4397
|
-
this.configuration,
|
|
4398
|
-
localVarAxiosArgs.endpoint,
|
|
4399
|
-
localVarAxiosArgs.method,
|
|
4400
|
-
localVarAxiosArgs.params,
|
|
4401
|
-
localVarAxiosArgs?.timeUnit,
|
|
4402
|
-
{ isSigned: false }
|
|
4403
|
-
);
|
|
4404
|
-
}
|
|
4405
|
-
/**
|
|
4406
|
-
* Start a new isolated margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
4407
|
-
*
|
|
4408
|
-
* Weight: 1
|
|
4409
|
-
*
|
|
4410
|
-
* @summary Start Isolated Margin User Data Stream (USER_STREAM)
|
|
4411
|
-
* @param {StartIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
4412
|
-
* @returns {Promise<RestApiResponse<StartIsolatedMarginUserDataStreamResponse>>}
|
|
4413
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4414
|
-
* @memberof TradeDataStreamApi
|
|
4415
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
4416
|
-
*/
|
|
4417
|
-
async startIsolatedMarginUserDataStream(requestParameters) {
|
|
4418
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.startIsolatedMarginUserDataStream(
|
|
4419
|
-
requestParameters?.symbol
|
|
4420
|
-
);
|
|
4421
|
-
return (0, import_common6.sendRequest)(
|
|
4422
|
-
this.configuration,
|
|
4423
|
-
localVarAxiosArgs.endpoint,
|
|
4424
|
-
localVarAxiosArgs.method,
|
|
4425
|
-
localVarAxiosArgs.params,
|
|
4426
|
-
localVarAxiosArgs?.timeUnit,
|
|
4427
|
-
{ isSigned: false }
|
|
4428
|
-
);
|
|
4429
|
-
}
|
|
4430
|
-
/**
|
|
4431
|
-
* Start a new margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
4432
|
-
*
|
|
4433
|
-
* Weight: 1
|
|
4434
|
-
*
|
|
4435
|
-
* @summary Start Margin User Data Stream (USER_STREAM)
|
|
4436
|
-
* @returns {Promise<RestApiResponse<StartMarginUserDataStreamResponse>>}
|
|
4437
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
4438
|
-
* @memberof TradeDataStreamApi
|
|
4439
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Margin-User-Data-Stream Binance API Documentation}
|
|
4440
|
-
*/
|
|
4441
|
-
async startMarginUserDataStream() {
|
|
4442
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.startMarginUserDataStream();
|
|
4443
|
-
return (0, import_common6.sendRequest)(
|
|
4444
|
-
this.configuration,
|
|
4445
|
-
localVarAxiosArgs.endpoint,
|
|
4446
|
-
localVarAxiosArgs.method,
|
|
4447
|
-
localVarAxiosArgs.params,
|
|
4448
|
-
localVarAxiosArgs?.timeUnit,
|
|
4449
|
-
{ isSigned: false }
|
|
4450
|
-
);
|
|
4451
|
-
}
|
|
4452
|
-
};
|
|
4453
|
-
|
|
4454
4130
|
// src/rest-api/modules/transfer-api.ts
|
|
4455
|
-
var
|
|
4131
|
+
var import_common6 = require("@binance/common");
|
|
4456
4132
|
var TransferApiAxiosParamCreator = function(configuration) {
|
|
4457
4133
|
return {
|
|
4458
4134
|
/**
|
|
@@ -4526,7 +4202,7 @@ var TransferApiAxiosParamCreator = function(configuration) {
|
|
|
4526
4202
|
* @throws {RequiredError}
|
|
4527
4203
|
*/
|
|
4528
4204
|
queryMaxTransferOutAmount: async (asset, isolatedSymbol, recvWindow) => {
|
|
4529
|
-
(0,
|
|
4205
|
+
(0, import_common6.assertParamExists)("queryMaxTransferOutAmount", "asset", asset);
|
|
4530
4206
|
const localVarQueryParameter = {};
|
|
4531
4207
|
if (asset !== void 0 && asset !== null) {
|
|
4532
4208
|
localVarQueryParameter["asset"] = asset;
|
|
@@ -4580,7 +4256,7 @@ var TransferApi = class {
|
|
|
4580
4256
|
requestParameters?.isolatedSymbol,
|
|
4581
4257
|
requestParameters?.recvWindow
|
|
4582
4258
|
);
|
|
4583
|
-
return (0,
|
|
4259
|
+
return (0, import_common6.sendRequest)(
|
|
4584
4260
|
this.configuration,
|
|
4585
4261
|
localVarAxiosArgs.endpoint,
|
|
4586
4262
|
localVarAxiosArgs.method,
|
|
@@ -4609,7 +4285,7 @@ var TransferApi = class {
|
|
|
4609
4285
|
requestParameters?.isolatedSymbol,
|
|
4610
4286
|
requestParameters?.recvWindow
|
|
4611
4287
|
);
|
|
4612
|
-
return (0,
|
|
4288
|
+
return (0, import_common6.sendRequest)(
|
|
4613
4289
|
this.configuration,
|
|
4614
4290
|
localVarAxiosArgs.endpoint,
|
|
4615
4291
|
localVarAxiosArgs.method,
|
|
@@ -4621,7 +4297,7 @@ var TransferApi = class {
|
|
|
4621
4297
|
};
|
|
4622
4298
|
|
|
4623
4299
|
// src/rest-api/rest-api.ts
|
|
4624
|
-
var
|
|
4300
|
+
var import_common7 = require("@binance/common");
|
|
4625
4301
|
var RestAPI = class {
|
|
4626
4302
|
constructor(configuration) {
|
|
4627
4303
|
this.configuration = configuration;
|
|
@@ -4630,7 +4306,6 @@ var RestAPI = class {
|
|
|
4630
4306
|
this.marketDataApi = new MarketDataApi(configuration);
|
|
4631
4307
|
this.riskDataStreamApi = new RiskDataStreamApi(configuration);
|
|
4632
4308
|
this.tradeApi = new TradeApi(configuration);
|
|
4633
|
-
this.tradeDataStreamApi = new TradeDataStreamApi(configuration);
|
|
4634
4309
|
this.transferApi = new TransferApi(configuration);
|
|
4635
4310
|
}
|
|
4636
4311
|
/**
|
|
@@ -4642,7 +4317,7 @@ var RestAPI = class {
|
|
|
4642
4317
|
* @returns A promise resolving to the response data object.
|
|
4643
4318
|
*/
|
|
4644
4319
|
sendRequest(endpoint, method, params = {}) {
|
|
4645
|
-
return (0,
|
|
4320
|
+
return (0, import_common7.sendRequest)(this.configuration, endpoint, method, params, void 0);
|
|
4646
4321
|
}
|
|
4647
4322
|
/**
|
|
4648
4323
|
* Generic function to send a signed request.
|
|
@@ -4653,7 +4328,7 @@ var RestAPI = class {
|
|
|
4653
4328
|
* @returns A promise resolving to the response data object.
|
|
4654
4329
|
*/
|
|
4655
4330
|
sendSignedRequest(endpoint, method, params = {}) {
|
|
4656
|
-
return (0,
|
|
4331
|
+
return (0, import_common7.sendRequest)(this.configuration, endpoint, method, params, void 0, {
|
|
4657
4332
|
isSigned: true
|
|
4658
4333
|
});
|
|
4659
4334
|
}
|
|
@@ -5604,95 +5279,6 @@ var RestAPI = class {
|
|
|
5604
5279
|
smallLiabilityExchange(requestParameters) {
|
|
5605
5280
|
return this.tradeApi.smallLiabilityExchange(requestParameters);
|
|
5606
5281
|
}
|
|
5607
|
-
/**
|
|
5608
|
-
* Close out a isolated margin user data stream.
|
|
5609
|
-
*
|
|
5610
|
-
* Weight: 3000
|
|
5611
|
-
*
|
|
5612
|
-
* @summary Close Isolated Margin User Data Stream (USER_STREAM)
|
|
5613
|
-
* @param {CloseIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
5614
|
-
* @deprecated
|
|
5615
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
5616
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5617
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
5618
|
-
*/
|
|
5619
|
-
closeIsolatedMarginUserDataStream(requestParameters) {
|
|
5620
|
-
return this.tradeDataStreamApi.closeIsolatedMarginUserDataStream(requestParameters);
|
|
5621
|
-
}
|
|
5622
|
-
/**
|
|
5623
|
-
* Close out a Margin user data stream.
|
|
5624
|
-
*
|
|
5625
|
-
* Weight: 3000
|
|
5626
|
-
*
|
|
5627
|
-
* @summary Close Margin User Data Stream (USER_STREAM)
|
|
5628
|
-
* @param {CloseMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
5629
|
-
* @deprecated
|
|
5630
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
5631
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5632
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Close-Margin-User-Data-Stream Binance API Documentation}
|
|
5633
|
-
*/
|
|
5634
|
-
closeMarginUserDataStream(requestParameters) {
|
|
5635
|
-
return this.tradeDataStreamApi.closeMarginUserDataStream(requestParameters);
|
|
5636
|
-
}
|
|
5637
|
-
/**
|
|
5638
|
-
* Keepalive an isolated margin user data stream to prevent a time out.
|
|
5639
|
-
*
|
|
5640
|
-
* Weight: 1
|
|
5641
|
-
*
|
|
5642
|
-
* @summary Keepalive Isolated Margin User Data Stream (USER_STREAM)
|
|
5643
|
-
* @param {KeepaliveIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
5644
|
-
* @deprecated
|
|
5645
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
5646
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5647
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Keepalive-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
5648
|
-
*/
|
|
5649
|
-
keepaliveIsolatedMarginUserDataStream(requestParameters) {
|
|
5650
|
-
return this.tradeDataStreamApi.keepaliveIsolatedMarginUserDataStream(requestParameters);
|
|
5651
|
-
}
|
|
5652
|
-
/**
|
|
5653
|
-
* Keepalive a margin user data stream to prevent a time out.
|
|
5654
|
-
*
|
|
5655
|
-
* Weight: 1
|
|
5656
|
-
*
|
|
5657
|
-
* @summary Keepalive Margin User Data Stream (USER_STREAM)
|
|
5658
|
-
* @param {KeepaliveMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
5659
|
-
* @deprecated
|
|
5660
|
-
* @returns {Promise<RestApiResponse<void>>}
|
|
5661
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5662
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Keepalive-Margin-User-Data-Stream Binance API Documentation}
|
|
5663
|
-
*/
|
|
5664
|
-
keepaliveMarginUserDataStream(requestParameters) {
|
|
5665
|
-
return this.tradeDataStreamApi.keepaliveMarginUserDataStream(requestParameters);
|
|
5666
|
-
}
|
|
5667
|
-
/**
|
|
5668
|
-
* Start a new isolated margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
5669
|
-
*
|
|
5670
|
-
* Weight: 1
|
|
5671
|
-
*
|
|
5672
|
-
* @summary Start Isolated Margin User Data Stream (USER_STREAM)
|
|
5673
|
-
* @param {StartIsolatedMarginUserDataStreamRequest} requestParameters Request parameters.
|
|
5674
|
-
* @deprecated
|
|
5675
|
-
* @returns {Promise<RestApiResponse<StartIsolatedMarginUserDataStreamResponse>>}
|
|
5676
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5677
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Isolated-Margin-User-Data-Stream Binance API Documentation}
|
|
5678
|
-
*/
|
|
5679
|
-
startIsolatedMarginUserDataStream(requestParameters) {
|
|
5680
|
-
return this.tradeDataStreamApi.startIsolatedMarginUserDataStream(requestParameters);
|
|
5681
|
-
}
|
|
5682
|
-
/**
|
|
5683
|
-
* Start a new margin user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
|
|
5684
|
-
*
|
|
5685
|
-
* Weight: 1
|
|
5686
|
-
*
|
|
5687
|
-
* @summary Start Margin User Data Stream (USER_STREAM)
|
|
5688
|
-
* @deprecated
|
|
5689
|
-
* @returns {Promise<RestApiResponse<StartMarginUserDataStreamResponse>>}
|
|
5690
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
5691
|
-
* @see {@link https://developers.binance.com/docs/margin_trading/trade-data-stream/Start-Margin-User-Data-Stream Binance API Documentation}
|
|
5692
|
-
*/
|
|
5693
|
-
startMarginUserDataStream() {
|
|
5694
|
-
return this.tradeDataStreamApi.startMarginUserDataStream();
|
|
5695
|
-
}
|
|
5696
5282
|
/**
|
|
5697
5283
|
* Get Cross Margin Transfer History
|
|
5698
5284
|
*
|
|
@@ -5739,10 +5325,10 @@ __export(websocket_streams_exports, {
|
|
|
5739
5325
|
});
|
|
5740
5326
|
|
|
5741
5327
|
// src/websocket-streams/websocket-streams.ts
|
|
5742
|
-
var
|
|
5328
|
+
var import_common9 = require("@binance/common");
|
|
5743
5329
|
|
|
5744
5330
|
// src/websocket-streams/websocket-streams-connection.ts
|
|
5745
|
-
var
|
|
5331
|
+
var import_common8 = require("@binance/common");
|
|
5746
5332
|
var WebsocketStreamsConnection = class {
|
|
5747
5333
|
constructor(websocketBase) {
|
|
5748
5334
|
this.websocketBase = websocketBase;
|
|
@@ -5825,7 +5411,7 @@ var WebsocketStreamsConnection = class {
|
|
|
5825
5411
|
* @returns A WebSocket stream handler for the risk data stream.
|
|
5826
5412
|
*/
|
|
5827
5413
|
riskData(listenKey, id) {
|
|
5828
|
-
return (0,
|
|
5414
|
+
return (0, import_common8.createStreamHandler)(this.websocketBase, listenKey, id);
|
|
5829
5415
|
}
|
|
5830
5416
|
/**
|
|
5831
5417
|
* Subscribes to the trade data WebSocket stream using the provided listen key.
|
|
@@ -5834,7 +5420,7 @@ var WebsocketStreamsConnection = class {
|
|
|
5834
5420
|
* @returns A WebSocket stream handler for the trade data stream.
|
|
5835
5421
|
*/
|
|
5836
5422
|
tradeData(listenKey, id) {
|
|
5837
|
-
return (0,
|
|
5423
|
+
return (0, import_common8.createStreamHandler)(
|
|
5838
5424
|
this.websocketBase,
|
|
5839
5425
|
listenKey,
|
|
5840
5426
|
id
|
|
@@ -5861,7 +5447,7 @@ var WebsocketStreams = class {
|
|
|
5861
5447
|
mode,
|
|
5862
5448
|
poolSize
|
|
5863
5449
|
} = {}) {
|
|
5864
|
-
const websocketBase = new
|
|
5450
|
+
const websocketBase = new import_common9.WebsocketStreamsBase({
|
|
5865
5451
|
...this.configuration,
|
|
5866
5452
|
...mode && { mode },
|
|
5867
5453
|
...poolSize && { poolSize }
|
|
@@ -5875,12 +5461,12 @@ var WebsocketStreams = class {
|
|
|
5875
5461
|
// src/margin-trading.ts
|
|
5876
5462
|
var MarginTrading = class {
|
|
5877
5463
|
constructor(config) {
|
|
5878
|
-
const userAgent = (0,
|
|
5464
|
+
const userAgent = (0, import_common10.buildUserAgent)(name, version);
|
|
5879
5465
|
if (config?.configurationRestAPI) {
|
|
5880
|
-
const configRestAPI = new
|
|
5466
|
+
const configRestAPI = new import_common10.ConfigurationRestAPI(
|
|
5881
5467
|
config.configurationRestAPI
|
|
5882
5468
|
);
|
|
5883
|
-
configRestAPI.basePath = configRestAPI.basePath ||
|
|
5469
|
+
configRestAPI.basePath = configRestAPI.basePath || import_common10.MARGIN_TRADING_REST_API_PROD_URL;
|
|
5884
5470
|
configRestAPI.baseOptions = configRestAPI.baseOptions || {};
|
|
5885
5471
|
configRestAPI.baseOptions.headers = {
|
|
5886
5472
|
...configRestAPI.baseOptions.headers || {},
|
|
@@ -5889,10 +5475,10 @@ var MarginTrading = class {
|
|
|
5889
5475
|
this.restAPI = new RestAPI(configRestAPI);
|
|
5890
5476
|
}
|
|
5891
5477
|
if (config?.configurationWebsocketStreams) {
|
|
5892
|
-
const configWebsocketStreams = new
|
|
5478
|
+
const configWebsocketStreams = new import_common10.ConfigurationWebsocketStreams(
|
|
5893
5479
|
config.configurationWebsocketStreams
|
|
5894
5480
|
);
|
|
5895
|
-
configWebsocketStreams.wsURL = configWebsocketStreams.wsURL ||
|
|
5481
|
+
configWebsocketStreams.wsURL = configWebsocketStreams.wsURL || import_common10.MARGIN_TRADING_WS_STREAMS_PROD_URL;
|
|
5896
5482
|
configWebsocketStreams.userAgent = userAgent;
|
|
5897
5483
|
this.websocketStreams = new WebsocketStreams(configWebsocketStreams);
|
|
5898
5484
|
}
|
|
@@ -5900,7 +5486,7 @@ var MarginTrading = class {
|
|
|
5900
5486
|
};
|
|
5901
5487
|
|
|
5902
5488
|
// src/index.ts
|
|
5903
|
-
var
|
|
5489
|
+
var import_common11 = require("@binance/common");
|
|
5904
5490
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5905
5491
|
0 && (module.exports = {
|
|
5906
5492
|
BadRequestError,
|