Skip to content

Commit 819aeda

Browse files
Merge branch 'master' of https://github.com/ccxt/ccxt
2 parents 4a4e96b + 590e9b0 commit 819aeda

File tree

6 files changed

+112
-45
lines changed

6 files changed

+112
-45
lines changed

dist/ccxt.browser.js

+26-11
Original file line numberDiff line numberDiff line change
@@ -269819,6 +269819,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
269819269819
'ws-api': {
269820269820
'spot': 'wss://testnet.binance.vision/ws-api/v3',
269821269821
'future': 'wss://testnet.binancefuture.com/ws-fapi/v1',
269822+
'delivery': 'wss://testnet.binancefuture.com/ws-dapi/v1',
269822269823
},
269823269824
},
269824269825
},
@@ -269831,6 +269832,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
269831269832
'ws-api': {
269832269833
'spot': 'wss://ws-api.binance.com:443/ws-api/v3',
269833269834
'future': 'wss://ws-fapi.binance.com/ws-fapi/v1',
269835+
'delivery': 'wss://ws-dapi.binance.com/ws-dapi/v1',
269834269836
},
269835269837
'papi': 'wss://fstream.binance.com/pm/ws',
269836269838
},
@@ -272254,6 +272256,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272254272256
* @description fetch balance and get the amount of funds available for trading or funds locked in orders
272255272257
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
272256272258
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#account-information-user_data
272259+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
272257272260
* @param {object} [params] extra parameters specific to the exchange API endpoint
272258272261
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
272259272262
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
@@ -272264,7 +272267,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272264272267
async fetchBalanceWs(params = {}) {
272265272268
await this.loadMarkets();
272266272269
const type = this.getMarketType('fetchBalanceWs', undefined, params);
272267-
if (type !== 'spot' && type !== 'future') {
272270+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
272268272271
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchBalanceWs only supports spot or swap markets');
272269272272
}
272270272273
const url = this.urls['api']['ws']['ws-api'][type];
@@ -272373,6 +272376,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272373272376
* @name binance#fetchPositionsWs
272374272377
* @description fetch all open positions
272375272378
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
272379+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Position-Information
272376272380
* @param {string[]} [symbols] list of unified market symbols
272377272381
* @param {object} [params] extra parameters specific to the exchange API endpoint
272378272382
* @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
@@ -272381,17 +272385,23 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272381272385
*/
272382272386
async fetchPositionsWs(symbols = undefined, params = {}) {
272383272387
await this.loadMarkets();
272384-
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
272385-
const url = this.urls['api']['ws']['ws-api']['future'];
272386-
const requestId = this.requestId(url);
272387-
const messageHash = requestId.toString();
272388272388
const payload = {};
272389+
let market = undefined;
272390+
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
272389272391
if (symbols !== undefined) {
272390272392
const symbolsLength = symbols.length;
272391272393
if (symbolsLength === 1) {
272392-
payload['symbol'] = this.marketId(symbols[0]);
272394+
market = this.market(symbols[0]);
272395+
payload['symbol'] = market['id'];
272393272396
}
272394272397
}
272398+
const type = this.getMarketType('fetchPositionsWs', market, params);
272399+
if (type !== 'future' && type !== 'delivery') {
272400+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchPositionsWs only supports swap markets');
272401+
}
272402+
const url = this.urls['api']['ws']['ws-api'][type];
272403+
const requestId = this.requestId(url);
272404+
const messageHash = requestId.toString();
272395272405
let returnRateLimits = false;
272396272406
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'returnRateLimits', false);
272397272407
payload['returnRateLimits'] = returnRateLimits;
@@ -272617,6 +272627,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272617272627
* @description create a trade order
272618272628
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#place-new-order-trade
272619272629
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
272630+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
272620272631
* @param {string} symbol unified symbol of the market to create an order in
272621272632
* @param {string} type 'market' or 'limit'
272622272633
* @param {string} side 'buy' or 'sell'
@@ -272631,7 +272642,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272631272642
await this.loadMarkets();
272632272643
const market = this.market(symbol);
272633272644
const marketType = this.getMarketType('createOrderWs', market, params);
272634-
if (marketType !== 'spot' && marketType !== 'future') {
272645+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
272635272646
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' createOrderWs only supports spot or swap markets');
272636272647
}
272637272648
const url = this.urls['api']['ws']['ws-api'][marketType];
@@ -272765,6 +272776,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272765272776
* @description edit a trade order
272766272777
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-and-replace-order-trade
272767272778
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
272779+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
272768272780
* @param {string} id order id
272769272781
* @param {string} symbol unified symbol of the market to create an order in
272770272782
* @param {string} type 'market' or 'limit'
@@ -272778,25 +272790,26 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272778272790
await this.loadMarkets();
272779272791
const market = this.market(symbol);
272780272792
const marketType = this.getMarketType('editOrderWs', market, params);
272781-
if (marketType !== 'spot' && marketType !== 'future') {
272793+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
272782272794
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrderWs only supports spot or swap markets');
272783272795
}
272784272796
const url = this.urls['api']['ws']['ws-api'][marketType];
272785272797
const requestId = this.requestId(url);
272786272798
const messageHash = requestId.toString();
272799+
const isSwap = (marketType === 'future' || marketType === 'delivery');
272787272800
let payload = undefined;
272788272801
if (marketType === 'spot') {
272789272802
payload = this.editSpotOrderRequest(id, symbol, type, side, amount, price, params);
272790272803
}
272791-
else if (marketType === 'future') {
272804+
else if (isSwap) {
272792272805
payload = this.editContractOrderRequest(id, symbol, type, side, amount, price, params);
272793272806
}
272794272807
let returnRateLimits = false;
272795272808
[returnRateLimits, params] = this.handleOptionAndParams(params, 'editOrderWs', 'returnRateLimits', false);
272796272809
payload['returnRateLimits'] = returnRateLimits;
272797272810
const message = {
272798272811
'id': messageHash,
272799-
'method': (marketType === 'future') ? 'order.modify' : 'order.cancelReplace',
272812+
'method': (isSwap) ? 'order.modify' : 'order.cancelReplace',
272800272813
'params': this.signParams(this.extend(payload, params)),
272801272814
};
272802272815
const subscription = {
@@ -272921,6 +272934,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
272921272934
* @description cancel multiple orders
272922272935
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
272923272936
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
272937+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
272924272938
* @param {string} id order id
272925272939
* @param {string} [symbol] unified market symbol, default is undefined
272926272940
* @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -273002,6 +273016,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
273002273016
* @description fetches information on an order made by the user
273003273017
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
273004273018
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
273019+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
273005273020
* @param {string} id order id
273006273021
* @param {string} [symbol] unified symbol of the market the order was made in
273007273022
* @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -273014,7 +273029,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
273014273029
}
273015273030
const market = this.market(symbol);
273016273031
const type = this.getMarketType('fetchOrderWs', market, params);
273017-
if (type !== 'spot' && type !== 'future') {
273032+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
273018273033
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOrderWs only supports spot or swap markets');
273019273034
}
273020273035
const url = this.urls['api']['ws']['ws-api'][type];

dist/ccxt.browser.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/src/pro/binance.js

+26-11
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class binance extends binance$1 {
7272
'ws-api': {
7373
'spot': 'wss://testnet.binance.vision/ws-api/v3',
7474
'future': 'wss://testnet.binancefuture.com/ws-fapi/v1',
75+
'delivery': 'wss://testnet.binancefuture.com/ws-dapi/v1',
7576
},
7677
},
7778
},
@@ -84,6 +85,7 @@ class binance extends binance$1 {
8485
'ws-api': {
8586
'spot': 'wss://ws-api.binance.com:443/ws-api/v3',
8687
'future': 'wss://ws-fapi.binance.com/ws-fapi/v1',
88+
'delivery': 'wss://ws-dapi.binance.com/ws-dapi/v1',
8789
},
8890
'papi': 'wss://fstream.binance.com/pm/ws',
8991
},
@@ -2504,6 +2506,7 @@ class binance extends binance$1 {
25042506
* @description fetch balance and get the amount of funds available for trading or funds locked in orders
25052507
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
25062508
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#account-information-user_data
2509+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
25072510
* @param {object} [params] extra parameters specific to the exchange API endpoint
25082511
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
25092512
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
@@ -2514,7 +2517,7 @@ class binance extends binance$1 {
25142517
async fetchBalanceWs(params = {}) {
25152518
await this.loadMarkets();
25162519
const type = this.getMarketType('fetchBalanceWs', undefined, params);
2517-
if (type !== 'spot' && type !== 'future') {
2520+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
25182521
throw new errors.BadRequest(this.id + ' fetchBalanceWs only supports spot or swap markets');
25192522
}
25202523
const url = this.urls['api']['ws']['ws-api'][type];
@@ -2623,6 +2626,7 @@ class binance extends binance$1 {
26232626
* @name binance#fetchPositionsWs
26242627
* @description fetch all open positions
26252628
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
2629+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Position-Information
26262630
* @param {string[]} [symbols] list of unified market symbols
26272631
* @param {object} [params] extra parameters specific to the exchange API endpoint
26282632
* @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
@@ -2631,17 +2635,23 @@ class binance extends binance$1 {
26312635
*/
26322636
async fetchPositionsWs(symbols = undefined, params = {}) {
26332637
await this.loadMarkets();
2634-
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
2635-
const url = this.urls['api']['ws']['ws-api']['future'];
2636-
const requestId = this.requestId(url);
2637-
const messageHash = requestId.toString();
26382638
const payload = {};
2639+
let market = undefined;
2640+
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
26392641
if (symbols !== undefined) {
26402642
const symbolsLength = symbols.length;
26412643
if (symbolsLength === 1) {
2642-
payload['symbol'] = this.marketId(symbols[0]);
2644+
market = this.market(symbols[0]);
2645+
payload['symbol'] = market['id'];
26432646
}
26442647
}
2648+
const type = this.getMarketType('fetchPositionsWs', market, params);
2649+
if (type !== 'future' && type !== 'delivery') {
2650+
throw new errors.BadRequest(this.id + ' fetchPositionsWs only supports swap markets');
2651+
}
2652+
const url = this.urls['api']['ws']['ws-api'][type];
2653+
const requestId = this.requestId(url);
2654+
const messageHash = requestId.toString();
26452655
let returnRateLimits = false;
26462656
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'returnRateLimits', false);
26472657
payload['returnRateLimits'] = returnRateLimits;
@@ -2867,6 +2877,7 @@ class binance extends binance$1 {
28672877
* @description create a trade order
28682878
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#place-new-order-trade
28692879
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
2880+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
28702881
* @param {string} symbol unified symbol of the market to create an order in
28712882
* @param {string} type 'market' or 'limit'
28722883
* @param {string} side 'buy' or 'sell'
@@ -2881,7 +2892,7 @@ class binance extends binance$1 {
28812892
await this.loadMarkets();
28822893
const market = this.market(symbol);
28832894
const marketType = this.getMarketType('createOrderWs', market, params);
2884-
if (marketType !== 'spot' && marketType !== 'future') {
2895+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
28852896
throw new errors.BadRequest(this.id + ' createOrderWs only supports spot or swap markets');
28862897
}
28872898
const url = this.urls['api']['ws']['ws-api'][marketType];
@@ -3015,6 +3026,7 @@ class binance extends binance$1 {
30153026
* @description edit a trade order
30163027
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-and-replace-order-trade
30173028
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
3029+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
30183030
* @param {string} id order id
30193031
* @param {string} symbol unified symbol of the market to create an order in
30203032
* @param {string} type 'market' or 'limit'
@@ -3028,25 +3040,26 @@ class binance extends binance$1 {
30283040
await this.loadMarkets();
30293041
const market = this.market(symbol);
30303042
const marketType = this.getMarketType('editOrderWs', market, params);
3031-
if (marketType !== 'spot' && marketType !== 'future') {
3043+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
30323044
throw new errors.BadRequest(this.id + ' editOrderWs only supports spot or swap markets');
30333045
}
30343046
const url = this.urls['api']['ws']['ws-api'][marketType];
30353047
const requestId = this.requestId(url);
30363048
const messageHash = requestId.toString();
3049+
const isSwap = (marketType === 'future' || marketType === 'delivery');
30373050
let payload = undefined;
30383051
if (marketType === 'spot') {
30393052
payload = this.editSpotOrderRequest(id, symbol, type, side, amount, price, params);
30403053
}
3041-
else if (marketType === 'future') {
3054+
else if (isSwap) {
30423055
payload = this.editContractOrderRequest(id, symbol, type, side, amount, price, params);
30433056
}
30443057
let returnRateLimits = false;
30453058
[returnRateLimits, params] = this.handleOptionAndParams(params, 'editOrderWs', 'returnRateLimits', false);
30463059
payload['returnRateLimits'] = returnRateLimits;
30473060
const message = {
30483061
'id': messageHash,
3049-
'method': (marketType === 'future') ? 'order.modify' : 'order.cancelReplace',
3062+
'method': (isSwap) ? 'order.modify' : 'order.cancelReplace',
30503063
'params': this.signParams(this.extend(payload, params)),
30513064
};
30523065
const subscription = {
@@ -3171,6 +3184,7 @@ class binance extends binance$1 {
31713184
* @description cancel multiple orders
31723185
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
31733186
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
3187+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
31743188
* @param {string} id order id
31753189
* @param {string} [symbol] unified market symbol, default is undefined
31763190
* @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3252,6 +3266,7 @@ class binance extends binance$1 {
32523266
* @description fetches information on an order made by the user
32533267
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
32543268
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
3269+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
32553270
* @param {string} id order id
32563271
* @param {string} [symbol] unified symbol of the market the order was made in
32573272
* @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3264,7 +3279,7 @@ class binance extends binance$1 {
32643279
}
32653280
const market = this.market(symbol);
32663281
const type = this.getMarketType('fetchOrderWs', market, params);
3267-
if (type !== 'spot' && type !== 'future') {
3282+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
32683283
throw new errors.BadRequest(this.id + ' fetchOrderWs only supports spot or swap markets');
32693284
}
32703285
const url = this.urls['api']['ws']['ws-api'][type];

0 commit comments

Comments
 (0)