ccxt 4.4.82 → 4.4.86
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/README.md +6 -9
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +6 -17
- package/dist/cjs/src/abstract/bittrade.js +9 -0
- package/dist/cjs/src/apex.js +2 -1
- package/dist/cjs/src/ascendex.js +189 -155
- package/dist/cjs/src/base/Exchange.js +15 -2
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bitget.js +6 -7
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitrue.js +14 -35
- package/dist/cjs/src/bitso.js +33 -0
- package/dist/cjs/src/bitstamp.js +33 -0
- package/dist/cjs/src/bittrade.js +2049 -0
- package/dist/cjs/src/blofin.js +154 -13
- package/dist/cjs/src/btcbox.js +25 -5
- package/dist/cjs/src/bybit.js +16 -40
- package/dist/cjs/src/cex.js +2 -4
- package/dist/cjs/src/coinbase.js +58 -46
- package/dist/cjs/src/coinbaseexchange.js +142 -32
- package/dist/cjs/src/coincatch.js +14 -67
- package/dist/cjs/src/coinex.js +29 -32
- package/dist/cjs/src/coinlist.js +16 -15
- package/dist/cjs/src/coinmetro.js +22 -11
- package/dist/cjs/src/coinone.js +8 -10
- package/dist/cjs/src/coinsph.js +126 -1
- package/dist/cjs/src/cryptocom.js +111 -1
- package/dist/cjs/src/cryptomus.js +43 -89
- package/dist/cjs/src/delta.js +76 -36
- package/dist/cjs/src/deribit.js +4 -5
- package/dist/cjs/src/derive.js +46 -10
- package/dist/cjs/src/ellipx.js +175 -79
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/gemini.js +3 -5
- package/dist/cjs/src/hitbtc.js +56 -69
- package/dist/cjs/src/hollaex.js +107 -49
- package/dist/cjs/src/htx.js +20 -44
- package/dist/cjs/src/hyperliquid.js +6 -6
- package/dist/cjs/src/kraken.js +29 -24
- package/dist/cjs/src/kucoinfutures.js +6 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +2 -2
- package/dist/cjs/src/ndax.js +25 -24
- package/dist/cjs/src/okcoin.js +12 -31
- package/dist/cjs/src/okx.js +9 -0
- package/dist/cjs/src/onetrading.js +9 -6
- package/dist/cjs/src/oxfun.js +42 -114
- package/dist/cjs/src/paradex.js +124 -4
- package/dist/cjs/src/pro/binance.js +32 -33
- package/dist/cjs/src/pro/bithumb.js +5 -3
- package/dist/cjs/src/pro/bittrade.js +605 -0
- package/dist/cjs/src/pro/kraken.js +289 -79
- package/dist/cjs/src/pro/luno.js +6 -5
- package/dist/cjs/src/pro/mexc.js +304 -7
- package/dist/cjs/src/pro/poloniex.js +6 -2
- package/examples/js/cli.js +127 -13
- package/js/ccxt.d.ts +8 -20
- package/js/ccxt.js +6 -14
- package/js/src/abstract/blofin.d.ts +8 -0
- package/js/src/abstract/btcbox.d.ts +1 -0
- package/js/src/abstract/myokx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/apex.js +2 -1
- package/js/src/ascendex.d.ts +2 -0
- package/js/src/ascendex.js +189 -155
- package/js/src/base/Exchange.d.ts +15 -1
- package/js/src/base/Exchange.js +15 -2
- package/js/src/base/types.d.ts +3 -0
- package/js/src/bequant.js +1 -1
- package/js/src/bitget.js +6 -7
- package/js/src/bitmart.js +1 -1
- package/js/src/bitrue.js +14 -35
- package/js/src/bitso.js +33 -0
- package/js/src/bitstamp.js +33 -0
- package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
- package/js/src/{huobijp.js → bittrade.js} +35 -35
- package/js/src/blofin.d.ts +42 -2
- package/js/src/blofin.js +154 -13
- package/js/src/btcbox.js +25 -5
- package/js/src/bybit.js +16 -40
- package/js/src/cex.js +2 -4
- package/js/src/coinbase.js +58 -46
- package/js/src/coinbaseexchange.js +142 -32
- package/js/src/coincatch.js +14 -67
- package/js/src/coinex.js +28 -29
- package/js/src/coinlist.js +16 -15
- package/js/src/coinmetro.js +22 -11
- package/js/src/coinone.js +8 -10
- package/js/src/coinsph.d.ts +10 -1
- package/js/src/coinsph.js +126 -1
- package/js/src/cryptocom.d.ts +10 -1
- package/js/src/cryptocom.js +111 -1
- package/js/src/cryptomus.js +43 -89
- package/js/src/delta.js +76 -36
- package/js/src/deribit.js +4 -5
- package/js/src/derive.js +46 -10
- package/js/src/ellipx.d.ts +2 -3
- package/js/src/ellipx.js +175 -80
- package/js/src/gate.js +1 -1
- package/js/src/gemini.js +3 -5
- package/js/src/hitbtc.js +56 -69
- package/js/src/hollaex.js +107 -49
- package/js/src/htx.js +20 -44
- package/js/src/hyperliquid.js +6 -6
- package/js/src/kraken.js +29 -24
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +6 -0
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +2 -2
- package/js/src/ndax.js +25 -24
- package/js/src/okcoin.js +12 -31
- package/js/src/okx.js +9 -0
- package/js/src/onetrading.js +9 -6
- package/js/src/oxfun.js +42 -114
- package/js/src/paradex.d.ts +12 -1
- package/js/src/paradex.js +124 -4
- package/js/src/pro/binance.d.ts +26 -26
- package/js/src/pro/binance.js +32 -33
- package/js/src/pro/bithumb.js +5 -3
- package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
- package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
- package/js/src/pro/kraken.d.ts +7 -6
- package/js/src/pro/kraken.js +290 -80
- package/js/src/pro/luno.js +6 -5
- package/js/src/pro/mexc.d.ts +58 -0
- package/js/src/pro/mexc.js +304 -7
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/poloniex.js +6 -2
- package/package.json +1 -1
- package/js/src/abstract/bl3p.d.ts +0 -22
- package/js/src/abstract/huobijp.js +0 -11
- package/js/src/abstract/idex.d.ts +0 -29
- package/js/src/abstract/idex.js +0 -11
- package/js/src/abstract/kuna.d.ts +0 -185
- package/js/src/abstract/kuna.js +0 -11
- package/js/src/bl3p.d.ts +0 -116
- package/js/src/bl3p.js +0 -552
- package/js/src/idex.d.ts +0 -312
- package/js/src/idex.js +0 -1961
- package/js/src/kuna.d.ts +0 -335
- package/js/src/kuna.js +0 -2006
- package/js/src/pro/idex.d.ts +0 -81
- package/js/src/pro/idex.js +0 -720
- /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
- /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
package/dist/cjs/src/paradex.js
CHANGED
|
@@ -72,6 +72,7 @@ class paradex extends paradex$1 {
|
|
|
72
72
|
'fetchFundingRate': false,
|
|
73
73
|
'fetchFundingRateHistory': false,
|
|
74
74
|
'fetchFundingRates': false,
|
|
75
|
+
'fetchGreeks': true,
|
|
75
76
|
'fetchIndexOHLCV': false,
|
|
76
77
|
'fetchIsolatedBorrowRate': false,
|
|
77
78
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -554,15 +555,16 @@ class paradex extends paradex$1 {
|
|
|
554
555
|
let expiry = this.safeInteger(market, 'expiry_at');
|
|
555
556
|
const optionType = this.safeString(market, 'option_type');
|
|
556
557
|
const strikePrice = this.safeString(market, 'strike_price');
|
|
558
|
+
const takerFee = this.parseNumber('0.0003');
|
|
559
|
+
let makerFee = this.parseNumber('-0.00005');
|
|
557
560
|
if (isOption) {
|
|
558
561
|
const optionTypeSuffix = (optionType === 'CALL') ? 'C' : 'P';
|
|
559
562
|
symbol = symbol + '-' + strikePrice + '-' + optionTypeSuffix;
|
|
563
|
+
makerFee = this.parseNumber('0.0003');
|
|
560
564
|
}
|
|
561
565
|
else {
|
|
562
566
|
expiry = undefined;
|
|
563
567
|
}
|
|
564
|
-
const takerFee = this.parseNumber('0.0003');
|
|
565
|
-
const makerFee = this.parseNumber('-0.00005');
|
|
566
568
|
return this.safeMarketStructure({
|
|
567
569
|
'id': marketId,
|
|
568
570
|
'symbol': symbol,
|
|
@@ -1255,7 +1257,11 @@ class paradex extends paradex$1 {
|
|
|
1255
1257
|
const price = this.safeString(order, 'price');
|
|
1256
1258
|
const amount = this.safeString(order, 'size');
|
|
1257
1259
|
const orderType = this.safeString(order, 'type');
|
|
1258
|
-
const
|
|
1260
|
+
const cancelReason = this.safeString(order, 'cancel_reason');
|
|
1261
|
+
let status = this.safeString(order, 'status');
|
|
1262
|
+
if (cancelReason !== undefined) {
|
|
1263
|
+
status = 'canceled';
|
|
1264
|
+
}
|
|
1259
1265
|
const side = this.safeStringLower(order, 'side');
|
|
1260
1266
|
const average = this.omitZero(this.safeString(order, 'avg_fill_price'));
|
|
1261
1267
|
const remaining = this.omitZero(this.safeString(order, 'remaining_size'));
|
|
@@ -1275,7 +1281,7 @@ class paradex extends paradex$1 {
|
|
|
1275
1281
|
'status': this.parseOrderStatus(status),
|
|
1276
1282
|
'symbol': symbol,
|
|
1277
1283
|
'type': this.parseOrderType(orderType),
|
|
1278
|
-
'timeInForce': this.parseTimeInForce(this.safeString(order, '
|
|
1284
|
+
'timeInForce': this.parseTimeInForce(this.safeString(order, 'instruction')),
|
|
1279
1285
|
'postOnly': undefined,
|
|
1280
1286
|
'reduceOnly': reduceOnly,
|
|
1281
1287
|
'side': side,
|
|
@@ -2345,6 +2351,120 @@ class paradex extends paradex$1 {
|
|
|
2345
2351
|
};
|
|
2346
2352
|
return await this.privatePostAccountMarginMarket(this.extend(request, params));
|
|
2347
2353
|
}
|
|
2354
|
+
/**
|
|
2355
|
+
* @method
|
|
2356
|
+
* @name paradex#fetchGreeks
|
|
2357
|
+
* @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
2358
|
+
* @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
|
|
2359
|
+
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
2360
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2361
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
2362
|
+
*/
|
|
2363
|
+
async fetchGreeks(symbol, params = {}) {
|
|
2364
|
+
await this.loadMarkets();
|
|
2365
|
+
const market = this.market(symbol);
|
|
2366
|
+
const request = {
|
|
2367
|
+
'market': market['id'],
|
|
2368
|
+
};
|
|
2369
|
+
const response = await this.publicGetMarketsSummary(this.extend(request, params));
|
|
2370
|
+
//
|
|
2371
|
+
// {
|
|
2372
|
+
// "results": [
|
|
2373
|
+
// {
|
|
2374
|
+
// "symbol": "BTC-USD-114000-P",
|
|
2375
|
+
// "mark_price": "10835.66892602",
|
|
2376
|
+
// "mark_iv": "0.71781855",
|
|
2377
|
+
// "delta": "-0.98726024",
|
|
2378
|
+
// "greeks": {
|
|
2379
|
+
// "delta": "-0.9872602390817709",
|
|
2380
|
+
// "gamma": "0.000004560958862297231",
|
|
2381
|
+
// "vega": "227.11344863639806",
|
|
2382
|
+
// "rho": "-302.0617972461581",
|
|
2383
|
+
// "vanna": "0.06609830491614832",
|
|
2384
|
+
// "volga": "925.9501532805552"
|
|
2385
|
+
// },
|
|
2386
|
+
// "last_traded_price": "10551.5",
|
|
2387
|
+
// "bid": "10794.9",
|
|
2388
|
+
// "bid_iv": "0.05",
|
|
2389
|
+
// "ask": "10887.3",
|
|
2390
|
+
// "ask_iv": "0.8783283",
|
|
2391
|
+
// "last_iv": "0.05",
|
|
2392
|
+
// "volume_24h": "0",
|
|
2393
|
+
// "total_volume": "195240.72672261014",
|
|
2394
|
+
// "created_at": 1747644009995,
|
|
2395
|
+
// "underlying_price": "103164.79162649",
|
|
2396
|
+
// "open_interest": "0",
|
|
2397
|
+
// "funding_rate": "0.000004464241170536191",
|
|
2398
|
+
// "price_change_rate_24h": "0.074915",
|
|
2399
|
+
// "future_funding_rate": "0.0001"
|
|
2400
|
+
// }
|
|
2401
|
+
// ]
|
|
2402
|
+
// }
|
|
2403
|
+
//
|
|
2404
|
+
const data = this.safeList(response, 'results', []);
|
|
2405
|
+
const greeks = this.safeDict(data, 0, {});
|
|
2406
|
+
return this.parseGreeks(greeks, market);
|
|
2407
|
+
}
|
|
2408
|
+
parseGreeks(greeks, market = undefined) {
|
|
2409
|
+
//
|
|
2410
|
+
// {
|
|
2411
|
+
// "symbol": "BTC-USD-114000-P",
|
|
2412
|
+
// "mark_price": "10835.66892602",
|
|
2413
|
+
// "mark_iv": "0.71781855",
|
|
2414
|
+
// "delta": "-0.98726024",
|
|
2415
|
+
// "greeks": {
|
|
2416
|
+
// "delta": "-0.9872602390817709",
|
|
2417
|
+
// "gamma": "0.000004560958862297231",
|
|
2418
|
+
// "vega": "227.11344863639806",
|
|
2419
|
+
// "rho": "-302.0617972461581",
|
|
2420
|
+
// "vanna": "0.06609830491614832",
|
|
2421
|
+
// "volga": "925.9501532805552"
|
|
2422
|
+
// },
|
|
2423
|
+
// "last_traded_price": "10551.5",
|
|
2424
|
+
// "bid": "10794.9",
|
|
2425
|
+
// "bid_iv": "0.05",
|
|
2426
|
+
// "ask": "10887.3",
|
|
2427
|
+
// "ask_iv": "0.8783283",
|
|
2428
|
+
// "last_iv": "0.05",
|
|
2429
|
+
// "volume_24h": "0",
|
|
2430
|
+
// "total_volume": "195240.72672261014",
|
|
2431
|
+
// "created_at": 1747644009995,
|
|
2432
|
+
// "underlying_price": "103164.79162649",
|
|
2433
|
+
// "open_interest": "0",
|
|
2434
|
+
// "funding_rate": "0.000004464241170536191",
|
|
2435
|
+
// "price_change_rate_24h": "0.074915",
|
|
2436
|
+
// "future_funding_rate": "0.0001"
|
|
2437
|
+
// }
|
|
2438
|
+
//
|
|
2439
|
+
const marketId = this.safeString(greeks, 'symbol');
|
|
2440
|
+
market = this.safeMarket(marketId, market, undefined, 'option');
|
|
2441
|
+
const symbol = market['symbol'];
|
|
2442
|
+
const timestamp = this.safeInteger(greeks, 'created_at');
|
|
2443
|
+
const greeksData = this.safeDict(greeks, 'greeks', {});
|
|
2444
|
+
return {
|
|
2445
|
+
'symbol': symbol,
|
|
2446
|
+
'timestamp': timestamp,
|
|
2447
|
+
'datetime': this.iso8601(timestamp),
|
|
2448
|
+
'delta': this.safeNumber(greeksData, 'delta'),
|
|
2449
|
+
'gamma': this.safeNumber(greeksData, 'gamma'),
|
|
2450
|
+
'theta': undefined,
|
|
2451
|
+
'vega': this.safeNumber(greeksData, 'vega'),
|
|
2452
|
+
'rho': this.safeNumber(greeksData, 'rho'),
|
|
2453
|
+
'vanna': this.safeNumber(greeksData, 'vanna'),
|
|
2454
|
+
'volga': this.safeNumber(greeksData, 'volga'),
|
|
2455
|
+
'bidSize': undefined,
|
|
2456
|
+
'askSize': undefined,
|
|
2457
|
+
'bidImpliedVolatility': this.safeNumber(greeks, 'bid_iv'),
|
|
2458
|
+
'askImpliedVolatility': this.safeNumber(greeks, 'ask_iv'),
|
|
2459
|
+
'markImpliedVolatility': this.safeNumber(greeks, 'mark_iv'),
|
|
2460
|
+
'bidPrice': this.safeNumber(greeks, 'bid'),
|
|
2461
|
+
'askPrice': this.safeNumber(greeks, 'ask'),
|
|
2462
|
+
'markPrice': this.safeNumber(greeks, 'mark_price'),
|
|
2463
|
+
'lastPrice': this.safeNumber(greeks, 'last_traded_price'),
|
|
2464
|
+
'underlyingPrice': this.safeNumber(greeks, 'underlying_price'),
|
|
2465
|
+
'info': greeks,
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2348
2468
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
2349
2469
|
let url = this.implodeHostname(this.urls['api'][this.version]) + '/' + this.implodeParams(path, params);
|
|
2350
2470
|
const query = this.omit(params, this.extractParams(path));
|
|
@@ -737,7 +737,7 @@ class binance extends binance$1 {
|
|
|
737
737
|
* @method
|
|
738
738
|
* @name binance#fetchOrderBookWs
|
|
739
739
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
740
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
740
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#order-book
|
|
741
741
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/websocket-api/Order-Book
|
|
742
742
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
743
743
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -827,6 +827,7 @@ class binance extends binance$1 {
|
|
|
827
827
|
orderbook.reset(snapshot);
|
|
828
828
|
// unroll the accumulated deltas
|
|
829
829
|
const messages = orderbook.cache;
|
|
830
|
+
orderbook.cache = [];
|
|
830
831
|
for (let i = 0; i < messages.length; i++) {
|
|
831
832
|
const messageItem = messages[i];
|
|
832
833
|
const U = this.safeInteger(messageItem, 'U');
|
|
@@ -900,10 +901,8 @@ class binance extends binance$1 {
|
|
|
900
901
|
// ]
|
|
901
902
|
// }
|
|
902
903
|
//
|
|
903
|
-
const
|
|
904
|
-
const
|
|
905
|
-
const isSpot = isTestnetSpot || isSpotMainNet;
|
|
906
|
-
const marketType = isSpot ? 'spot' : 'contract';
|
|
904
|
+
const isSpot = (client.url.indexOf('/stream') > -1);
|
|
905
|
+
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
907
906
|
const marketId = this.safeString(message, 's');
|
|
908
907
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
909
908
|
const symbol = market['symbol'];
|
|
@@ -1040,8 +1039,8 @@ class binance extends binance$1 {
|
|
|
1040
1039
|
* @method
|
|
1041
1040
|
* @name binance#watchTradesForSymbols
|
|
1042
1041
|
* @description get the list of most recent trades for a list of symbols
|
|
1043
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1044
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1042
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
|
|
1043
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
|
|
1045
1044
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1046
1045
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1047
1046
|
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
@@ -1103,8 +1102,8 @@ class binance extends binance$1 {
|
|
|
1103
1102
|
* @method
|
|
1104
1103
|
* @name binance#unWatchTradesForSymbols
|
|
1105
1104
|
* @description unsubscribes from the trades channel
|
|
1106
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1107
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1105
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
|
|
1106
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
|
|
1108
1107
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1109
1108
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1110
1109
|
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
@@ -1165,8 +1164,8 @@ class binance extends binance$1 {
|
|
|
1165
1164
|
* @method
|
|
1166
1165
|
* @name binance#unWatchTrades
|
|
1167
1166
|
* @description unsubscribes from the trades channel
|
|
1168
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1169
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1167
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
|
|
1168
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
|
|
1170
1169
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1171
1170
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1172
1171
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
@@ -1182,8 +1181,8 @@ class binance extends binance$1 {
|
|
|
1182
1181
|
* @method
|
|
1183
1182
|
* @name binance#watchTrades
|
|
1184
1183
|
* @description get the list of most recent trades for a particular symbol
|
|
1185
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1186
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1184
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#aggregate-trades
|
|
1185
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
|
|
1187
1186
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1188
1187
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Aggregate-Trade-Streams
|
|
1189
1188
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
@@ -1362,7 +1361,7 @@ class binance extends binance$1 {
|
|
|
1362
1361
|
handleTrade(client, message) {
|
|
1363
1362
|
// the trade streams push raw trade information in real-time
|
|
1364
1363
|
// each trade has a unique buyer and seller
|
|
1365
|
-
const isSpot = (
|
|
1364
|
+
const isSpot = (client.url.indexOf('/stream') > -1);
|
|
1366
1365
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
1367
1366
|
const marketId = this.safeString(message, 's');
|
|
1368
1367
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
@@ -1382,7 +1381,7 @@ class binance extends binance$1 {
|
|
|
1382
1381
|
* @method
|
|
1383
1382
|
* @name binance#watchOHLCV
|
|
1384
1383
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1385
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1384
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
|
|
1386
1385
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1387
1386
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1388
1387
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
@@ -1405,7 +1404,7 @@ class binance extends binance$1 {
|
|
|
1405
1404
|
* @method
|
|
1406
1405
|
* @name binance#watchOHLCVForSymbols
|
|
1407
1406
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1408
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1407
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
|
|
1409
1408
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1410
1409
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1411
1410
|
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
@@ -1471,7 +1470,7 @@ class binance extends binance$1 {
|
|
|
1471
1470
|
* @method
|
|
1472
1471
|
* @name binance#unWatchOHLCVForSymbols
|
|
1473
1472
|
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1474
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1473
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
|
|
1475
1474
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1476
1475
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1477
1476
|
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
@@ -1538,7 +1537,7 @@ class binance extends binance$1 {
|
|
|
1538
1537
|
* @method
|
|
1539
1538
|
* @name binance#unWatchOHLCV
|
|
1540
1539
|
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1541
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1540
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
|
|
1542
1541
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1543
1542
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams
|
|
1544
1543
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
@@ -1604,7 +1603,7 @@ class binance extends binance$1 {
|
|
|
1604
1603
|
this.safeFloat(kline, 'c'),
|
|
1605
1604
|
this.safeFloat(kline, 'v'),
|
|
1606
1605
|
];
|
|
1607
|
-
const isSpot = (
|
|
1606
|
+
const isSpot = (client.url.indexOf('/stream') > -1);
|
|
1608
1607
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
1609
1608
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
1610
1609
|
const messageHash = 'ohlcv::' + symbol + '::' + unifiedTimeframe;
|
|
@@ -1663,7 +1662,7 @@ class binance extends binance$1 {
|
|
|
1663
1662
|
* @method
|
|
1664
1663
|
* @name binance#fetchOHLCVWs
|
|
1665
1664
|
* @description query historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1666
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1665
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines
|
|
1667
1666
|
* @param {string} symbol unified symbol of the market to query OHLCV data for
|
|
1668
1667
|
* @param {string} timeframe the length of time each candle represents
|
|
1669
1668
|
* @param {int} since timestamp in ms of the earliest candle to fetch
|
|
@@ -1946,7 +1945,7 @@ class binance extends binance$1 {
|
|
|
1946
1945
|
* @method
|
|
1947
1946
|
* @name binance#watchBidsAsks
|
|
1948
1947
|
* @description watches best bid & ask for symbols
|
|
1949
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
1948
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#symbol-order-book-ticker
|
|
1950
1949
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/All-Book-Tickers-Stream
|
|
1951
1950
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Book-Tickers-Stream
|
|
1952
1951
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
@@ -2246,7 +2245,7 @@ class binance extends binance$1 {
|
|
|
2246
2245
|
this.handleTickersAndBidsAsks(client, message, 'tickers');
|
|
2247
2246
|
}
|
|
2248
2247
|
handleTickersAndBidsAsks(client, message, methodType) {
|
|
2249
|
-
const isSpot = (
|
|
2248
|
+
const isSpot = (client.url.indexOf('/stream') > -1);
|
|
2250
2249
|
const marketType = (isSpot) ? 'spot' : 'contract';
|
|
2251
2250
|
const isBidAsk = (methodType === 'bidasks');
|
|
2252
2251
|
let channelName = undefined;
|
|
@@ -2505,7 +2504,7 @@ class binance extends binance$1 {
|
|
|
2505
2504
|
* @name binance#fetchBalanceWs
|
|
2506
2505
|
* @description fetch balance and get the amount of funds available for trading or funds locked in orders
|
|
2507
2506
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
|
|
2508
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
2507
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/account-requests#account-information-user_data
|
|
2509
2508
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
|
|
2510
2509
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2511
2510
|
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
|
|
@@ -2875,7 +2874,7 @@ class binance extends binance$1 {
|
|
|
2875
2874
|
* @method
|
|
2876
2875
|
* @name binance#createOrderWs
|
|
2877
2876
|
* @description create a trade order
|
|
2878
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
2877
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#place-new-order-trade
|
|
2879
2878
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
|
|
2880
2879
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
|
|
2881
2880
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -3024,7 +3023,7 @@ class binance extends binance$1 {
|
|
|
3024
3023
|
* @method
|
|
3025
3024
|
* @name binance#editOrderWs
|
|
3026
3025
|
* @description edit a trade order
|
|
3027
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3026
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-and-replace-order-trade
|
|
3028
3027
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
|
|
3029
3028
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
|
|
3030
3029
|
* @param {string} id order id
|
|
@@ -3182,7 +3181,7 @@ class binance extends binance$1 {
|
|
|
3182
3181
|
* @method
|
|
3183
3182
|
* @name binance#cancelOrderWs
|
|
3184
3183
|
* @description cancel multiple orders
|
|
3185
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3184
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-order-trade
|
|
3186
3185
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
|
|
3187
3186
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
|
|
3188
3187
|
* @param {string} id order id
|
|
@@ -3229,7 +3228,7 @@ class binance extends binance$1 {
|
|
|
3229
3228
|
* @method
|
|
3230
3229
|
* @name binance#cancelAllOrdersWs
|
|
3231
3230
|
* @description cancel all open orders in a market
|
|
3232
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3231
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-open-orders-trade
|
|
3233
3232
|
* @param {string} [symbol] unified market symbol of the market to cancel orders in
|
|
3234
3233
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3235
3234
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -3264,7 +3263,7 @@ class binance extends binance$1 {
|
|
|
3264
3263
|
* @method
|
|
3265
3264
|
* @name binance#fetchOrderWs
|
|
3266
3265
|
* @description fetches information on an order made by the user
|
|
3267
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3266
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#query-order-user_data
|
|
3268
3267
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
|
|
3269
3268
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
|
|
3270
3269
|
* @param {string} id order id
|
|
@@ -3312,7 +3311,7 @@ class binance extends binance$1 {
|
|
|
3312
3311
|
* @method
|
|
3313
3312
|
* @name binance#fetchOrdersWs
|
|
3314
3313
|
* @description fetches information on multiple orders made by the user
|
|
3315
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3314
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#order-lists
|
|
3316
3315
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3317
3316
|
* @param {int|undefined} [since] the earliest time in ms to fetch orders for
|
|
3318
3317
|
* @param {int|undefined} [limit] the maximum number of order structures to retrieve
|
|
@@ -3357,7 +3356,7 @@ class binance extends binance$1 {
|
|
|
3357
3356
|
* @method
|
|
3358
3357
|
* @name binance#fetchClosedOrdersWs
|
|
3359
3358
|
* @description fetch closed orders
|
|
3360
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3359
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#order-lists
|
|
3361
3360
|
* @param {string} symbol unified market symbol
|
|
3362
3361
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3363
3362
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -3379,7 +3378,7 @@ class binance extends binance$1 {
|
|
|
3379
3378
|
* @method
|
|
3380
3379
|
* @name binance#fetchOpenOrdersWs
|
|
3381
3380
|
* @description fetch all unfilled currently open orders
|
|
3382
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3381
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#current-open-orders-user_data
|
|
3383
3382
|
* @param {string} symbol unified market symbol
|
|
3384
3383
|
* @param {int|undefined} [since] the earliest time in ms to fetch open orders for
|
|
3385
3384
|
* @param {int|undefined} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -3942,7 +3941,7 @@ class binance extends binance$1 {
|
|
|
3942
3941
|
* @method
|
|
3943
3942
|
* @name binance#fetchMyTradesWs
|
|
3944
3943
|
* @description fetch all trades made by the user
|
|
3945
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3944
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/account-requests#account-trade-history-user_data
|
|
3946
3945
|
* @param {string} symbol unified market symbol
|
|
3947
3946
|
* @param {int|undefined} [since] the earliest time in ms to fetch trades for
|
|
3948
3947
|
* @param {int|undefined} [limit] the maximum number of trades structures to retrieve
|
|
@@ -3995,7 +3994,7 @@ class binance extends binance$1 {
|
|
|
3995
3994
|
* @method
|
|
3996
3995
|
* @name binance#fetchTradesWs
|
|
3997
3996
|
* @description fetch all trades made by the user
|
|
3998
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/
|
|
3997
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#recent-trades
|
|
3999
3998
|
* @param {string} symbol unified market symbol
|
|
4000
3999
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4001
4000
|
* @param {int} [limit] the maximum number of trades structures to retrieve, default=500, max=1000
|
|
@@ -324,18 +324,20 @@ class bithumb extends bithumb$1 {
|
|
|
324
324
|
// "contPrice" : "10579000",
|
|
325
325
|
// "contQty" : "0.01",
|
|
326
326
|
// "contAmt" : "105790.00",
|
|
327
|
-
// "contDtm" : "2020-01-29 12:24:18.
|
|
327
|
+
// "contDtm" : "2020-01-29 12:24:18.830038",
|
|
328
328
|
// "updn" : "dn"
|
|
329
329
|
// }
|
|
330
330
|
//
|
|
331
331
|
const marketId = this.safeString(trade, 'symbol');
|
|
332
332
|
const datetime = this.safeString(trade, 'contDtm');
|
|
333
|
+
// that date is not UTC iso8601, but exchange's local time, -9hr difference
|
|
334
|
+
const timestamp = this.parse8601(datetime) - 32400000;
|
|
333
335
|
const sideId = this.safeString(trade, 'buySellGb');
|
|
334
336
|
return this.safeTrade({
|
|
335
337
|
'id': undefined,
|
|
336
338
|
'info': trade,
|
|
337
|
-
'timestamp':
|
|
338
|
-
'datetime':
|
|
339
|
+
'timestamp': timestamp,
|
|
340
|
+
'datetime': this.iso8601(timestamp),
|
|
339
341
|
'symbol': this.safeSymbol(marketId, market, '_'),
|
|
340
342
|
'order': undefined,
|
|
341
343
|
'type': undefined,
|