ccxt 4.1.59 → 4.1.61
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 +3 -3
- package/dist/ccxt.browser.js +589 -319
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +204 -84
- package/dist/cjs/src/base/Exchange.js +7 -7
- package/dist/cjs/src/base/ws/Client.js +1 -1
- package/dist/cjs/src/binance.js +2 -0
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +94 -2
- package/dist/cjs/src/coinbasepro.js +15 -0
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/htx.js +7 -1
- package/dist/cjs/src/kucoin.js +126 -128
- package/dist/cjs/src/kuna.js +4 -3
- package/dist/cjs/src/mexc.js +18 -13
- package/dist/cjs/src/okx.js +28 -11
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/htx.js +70 -56
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/alpaca.d.ts +66 -16
- package/js/src/abstract/binance.d.ts +2 -0
- package/js/src/abstract/binancecoinm.d.ts +2 -0
- package/js/src/abstract/binanceus.d.ts +2 -0
- package/js/src/abstract/binanceusdm.d.ts +2 -0
- package/js/src/alpaca.js +204 -84
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +7 -7
- package/js/src/base/ws/Client.js +1 -1
- package/js/src/binance.js +2 -0
- package/js/src/bitrue.js +1 -1
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.js +94 -2
- package/js/src/coinbasepro.js +15 -0
- package/js/src/gate.js +1 -1
- package/js/src/htx.js +7 -1
- package/js/src/kucoin.js +126 -128
- package/js/src/kuna.js +4 -3
- package/js/src/mexc.js +18 -13
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +28 -11
- package/js/src/p2b.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +70 -56
- package/package.json +1 -1
- package/skip-tests.json +2 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -2526,16 +2526,14 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2526
2526
|
'logo': 'https://user-images.githubusercontent.com/1294454/187234005-b864db3d-f1e3-447a-aaf9-a9fc7b955d07.jpg',
|
|
2527
2527
|
'www': 'https://alpaca.markets',
|
|
2528
2528
|
'api': {
|
|
2529
|
-
'
|
|
2530
|
-
'
|
|
2531
|
-
'
|
|
2532
|
-
'markets': 'https://api.{hostname}/{version}',
|
|
2529
|
+
'broker': 'https://broker-api.{hostname}',
|
|
2530
|
+
'trader': 'https://api.{hostname}',
|
|
2531
|
+
'market': 'https://data.{hostname}',
|
|
2533
2532
|
},
|
|
2534
2533
|
'test': {
|
|
2535
|
-
'
|
|
2536
|
-
'
|
|
2537
|
-
'
|
|
2538
|
-
'markets': 'https://api.{hostname}/{version}',
|
|
2534
|
+
'broker': 'https://broker-api.sandbox.{hostname}',
|
|
2535
|
+
'trader': 'https://paper-api.{hostname}',
|
|
2536
|
+
'market': 'https://data.sandbox.{hostname}',
|
|
2539
2537
|
},
|
|
2540
2538
|
'doc': 'https://alpaca.markets/docs/',
|
|
2541
2539
|
'fees': 'https://alpaca.markets/support/what-are-the-fees-associated-with-crypto-trading/',
|
|
@@ -2589,37 +2587,96 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2589
2587
|
'withdraw': false,
|
|
2590
2588
|
},
|
|
2591
2589
|
'api': {
|
|
2592
|
-
'
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2590
|
+
'broker': {},
|
|
2591
|
+
'trader': {
|
|
2592
|
+
'private': {
|
|
2593
|
+
'get': [
|
|
2594
|
+
'v2/account',
|
|
2595
|
+
'v2/orders',
|
|
2596
|
+
'v2/orders/{order_id}',
|
|
2597
|
+
'v2/positions',
|
|
2598
|
+
'v2/positions/{symbol_or_asset_id}',
|
|
2599
|
+
'v2/account/portfolio/history',
|
|
2600
|
+
'v2/watchlists',
|
|
2601
|
+
'v2/watchlists/{watchlist_id}',
|
|
2602
|
+
'v2/watchlists:by_name',
|
|
2603
|
+
'v2/account/configurations',
|
|
2604
|
+
'v2/account/activities',
|
|
2605
|
+
'v2/account/activities/{activity_type}',
|
|
2606
|
+
'v2/calendar',
|
|
2607
|
+
'v2/clock',
|
|
2608
|
+
'v2/assets',
|
|
2609
|
+
'v2/assets/{symbol_or_asset_id}',
|
|
2610
|
+
'v2/corporate_actions/announcements/{id}',
|
|
2611
|
+
'v2/corporate_actions/announcements',
|
|
2612
|
+
],
|
|
2613
|
+
'post': [
|
|
2614
|
+
'v2/orders',
|
|
2615
|
+
'v2/watchlists',
|
|
2616
|
+
'v2/watchlists/{watchlist_id}',
|
|
2617
|
+
'v2/watchlists:by_name',
|
|
2618
|
+
],
|
|
2619
|
+
'put': [
|
|
2620
|
+
'v2/watchlists/{watchlist_id}',
|
|
2621
|
+
'v2/watchlists:by_name',
|
|
2622
|
+
],
|
|
2623
|
+
'patch': [
|
|
2624
|
+
'v2/orders/{order_id}',
|
|
2625
|
+
'v2/account/configurations',
|
|
2626
|
+
],
|
|
2627
|
+
'delete': [
|
|
2628
|
+
'v2/orders',
|
|
2629
|
+
'v2/orders/{order_id}',
|
|
2630
|
+
'v2/positions',
|
|
2631
|
+
'v2/positions/{symbol_or_asset_id}',
|
|
2632
|
+
'v2/watchlists/{watchlist_id}',
|
|
2633
|
+
'v2/watchlists:by_name',
|
|
2634
|
+
'v2/watchlists/{watchlist_id}/{symbol}',
|
|
2635
|
+
],
|
|
2636
|
+
},
|
|
2613
2637
|
},
|
|
2614
|
-
'
|
|
2615
|
-
'
|
|
2616
|
-
'
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2638
|
+
'market': {
|
|
2639
|
+
'public': {
|
|
2640
|
+
'get': [
|
|
2641
|
+
'v1beta3/crypto/{loc}/bars',
|
|
2642
|
+
'v1beta3/crypto/{loc}/latest/bars',
|
|
2643
|
+
'v1beta3/crypto/{loc}/latest/orderbooks',
|
|
2644
|
+
'v1beta3/crypto/{loc}/latest/quotes',
|
|
2645
|
+
'v1beta3/crypto/{loc}/latest/trades',
|
|
2646
|
+
'v1beta3/crypto/{loc}/quotes',
|
|
2647
|
+
'v1beta3/crypto/{loc}/snapshots',
|
|
2648
|
+
'v1beta3/crypto/{loc}/trades',
|
|
2649
|
+
],
|
|
2650
|
+
},
|
|
2651
|
+
'private': {
|
|
2652
|
+
'get': [
|
|
2653
|
+
'v1beta1/corporate-actions',
|
|
2654
|
+
'v1beta1/forex/latest/rates',
|
|
2655
|
+
'v1beta1/forex/rates',
|
|
2656
|
+
'v1beta1/logos/{symbol}',
|
|
2657
|
+
'v1beta1/news',
|
|
2658
|
+
'v1beta1/screener/stocks/most-actives',
|
|
2659
|
+
'v1beta1/screener/{market_type}/movers',
|
|
2660
|
+
'v2/stocks/auctions',
|
|
2661
|
+
'v2/stocks/bars',
|
|
2662
|
+
'v2/stocks/bars/latest',
|
|
2663
|
+
'v2/stocks/meta/conditions/{ticktype}',
|
|
2664
|
+
'v2/stocks/meta/exchanges',
|
|
2665
|
+
'v2/stocks/quotes',
|
|
2666
|
+
'v2/stocks/quotes/latest',
|
|
2667
|
+
'v2/stocks/snapshots',
|
|
2668
|
+
'v2/stocks/trades',
|
|
2669
|
+
'v2/stocks/trades/latest',
|
|
2670
|
+
'v2/stocks/{symbol}/auctions',
|
|
2671
|
+
'v2/stocks/{symbol}/bars',
|
|
2672
|
+
'v2/stocks/{symbol}/bars/latest',
|
|
2673
|
+
'v2/stocks/{symbol}/quotes',
|
|
2674
|
+
'v2/stocks/{symbol}/quotes/latest',
|
|
2675
|
+
'v2/stocks/{symbol}/snapshot',
|
|
2676
|
+
'v2/stocks/{symbol}/trades',
|
|
2677
|
+
'v2/stocks/{symbol}/trades/latest',
|
|
2678
|
+
],
|
|
2679
|
+
},
|
|
2623
2680
|
},
|
|
2624
2681
|
},
|
|
2625
2682
|
'timeframes': {
|
|
@@ -2678,14 +2735,6 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2678
2735
|
'APCA-PARTNER-ID': 'ccxt',
|
|
2679
2736
|
},
|
|
2680
2737
|
'options': {
|
|
2681
|
-
'fetchTradesMethod': 'cryptoPublicGetCryptoTrades',
|
|
2682
|
-
'fetchOHLCVMethod': 'cryptoPublicGetCryptoBars',
|
|
2683
|
-
'versions': {
|
|
2684
|
-
'public': 'v2',
|
|
2685
|
-
'private': 'v2',
|
|
2686
|
-
'cryptoPublic': 'v1beta2',
|
|
2687
|
-
'markets': 'v2', // crypto beta
|
|
2688
|
-
},
|
|
2689
2738
|
'defaultExchange': 'CBSE',
|
|
2690
2739
|
'exchanges': [
|
|
2691
2740
|
'CBSE',
|
|
@@ -2724,7 +2773,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2724
2773
|
'asset_class': 'crypto',
|
|
2725
2774
|
'tradeable': true,
|
|
2726
2775
|
};
|
|
2727
|
-
const assets = await this.
|
|
2776
|
+
const assets = await this.traderPrivateGetV2Assets(this.extend(request, params));
|
|
2728
2777
|
//
|
|
2729
2778
|
// [
|
|
2730
2779
|
// {
|
|
@@ -2815,26 +2864,42 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2815
2864
|
* @method
|
|
2816
2865
|
* @name alpaca#fetchTrades
|
|
2817
2866
|
* @description get the list of most recent trades for a particular symbol
|
|
2867
|
+
* @see https://docs.alpaca.markets/reference/cryptotrades
|
|
2868
|
+
* @see https://docs.alpaca.markets/reference/cryptolatesttrades
|
|
2818
2869
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2819
2870
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2820
2871
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2821
2872
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
2873
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
2874
|
+
* @param {string} [params.method] method, default: marketPublicGetV1beta3CryptoLocTrades
|
|
2822
2875
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2823
2876
|
*/
|
|
2824
2877
|
await this.loadMarkets();
|
|
2825
2878
|
const market = this.market(symbol);
|
|
2826
|
-
const
|
|
2879
|
+
const marketId = market['id'];
|
|
2880
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
2881
|
+
const method = this.safeString(params, 'method', 'marketPublicGetV1beta3CryptoLocTrades');
|
|
2827
2882
|
const request = {
|
|
2828
|
-
'symbols':
|
|
2883
|
+
'symbols': marketId,
|
|
2884
|
+
'loc': loc,
|
|
2829
2885
|
};
|
|
2830
|
-
|
|
2831
|
-
|
|
2886
|
+
params = this.omit(params, ['loc', 'method']);
|
|
2887
|
+
let response = undefined;
|
|
2888
|
+
if (method === 'marketPublicGetV1beta3CryptoLocTrades') {
|
|
2889
|
+
if (since !== undefined) {
|
|
2890
|
+
request['start'] = this.iso8601(since);
|
|
2891
|
+
}
|
|
2892
|
+
if (limit !== undefined) {
|
|
2893
|
+
request['limit'] = limit;
|
|
2894
|
+
}
|
|
2895
|
+
response = await this.marketPublicGetV1beta3CryptoLocTrades(this.extend(request, params));
|
|
2832
2896
|
}
|
|
2833
|
-
if (
|
|
2834
|
-
|
|
2897
|
+
else if (method === 'marketPublicGetV1beta3CryptoLocLatestTrades') {
|
|
2898
|
+
response = await this.marketPublicGetV1beta3CryptoLocLatestTrades(this.extend(request, params));
|
|
2899
|
+
}
|
|
2900
|
+
else {
|
|
2901
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTrades() does not support ' + method + ', marketPublicGetV1beta3CryptoLocTrades and marketPublicGetV1beta3CryptoLocLatestTrades are supported');
|
|
2835
2902
|
}
|
|
2836
|
-
const method = this.safeString(this.options, 'fetchTradesMethod', 'cryptoPublicGetCryptoTrades');
|
|
2837
|
-
const response = await this[method](this.extend(request, params));
|
|
2838
2903
|
//
|
|
2839
2904
|
// {
|
|
2840
2905
|
// "next_page_token":null,
|
|
@@ -2851,27 +2916,50 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2851
2916
|
// }
|
|
2852
2917
|
// }
|
|
2853
2918
|
//
|
|
2919
|
+
// {
|
|
2920
|
+
// "trades":{
|
|
2921
|
+
// "BTC/USD":{
|
|
2922
|
+
// "i":36440704,
|
|
2923
|
+
// "p":22625,
|
|
2924
|
+
// "s":0.0001,
|
|
2925
|
+
// "t":"2022-07-21T11:47:31.073391Z",
|
|
2926
|
+
// "tks":"B"
|
|
2927
|
+
// }
|
|
2928
|
+
// }
|
|
2929
|
+
// }
|
|
2930
|
+
//
|
|
2854
2931
|
const trades = this.safeValue(response, 'trades', {});
|
|
2855
|
-
|
|
2932
|
+
let symbolTrades = this.safeValue(trades, marketId, {});
|
|
2933
|
+
if (!Array.isArray(symbolTrades)) {
|
|
2934
|
+
symbolTrades = [symbolTrades];
|
|
2935
|
+
}
|
|
2856
2936
|
return this.parseTrades(symbolTrades, market, since, limit);
|
|
2857
2937
|
}
|
|
2858
2938
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2939
|
+
//
|
|
2940
|
+
// @method
|
|
2941
|
+
// @name alpaca#fetchOrderBook
|
|
2942
|
+
// @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
2943
|
+
// @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
|
|
2944
|
+
// @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2945
|
+
// @param {int} [limit] the maximum amount of order book entries to return
|
|
2946
|
+
// @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
2947
|
+
// <<<<<<< HEAD
|
|
2948
|
+
// @param {string} [params.loc] crypto location, default: us
|
|
2949
|
+
// @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
2950
|
+
// =======
|
|
2951
|
+
// @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2952
|
+
// >>>>>>> f68b1b599ee41469fefa424f0efc9b6891549278
|
|
2953
|
+
//
|
|
2868
2954
|
await this.loadMarkets();
|
|
2869
2955
|
const market = this.market(symbol);
|
|
2870
2956
|
const id = market['id'];
|
|
2957
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
2871
2958
|
const request = {
|
|
2872
2959
|
'symbols': id,
|
|
2960
|
+
'loc': loc,
|
|
2873
2961
|
};
|
|
2874
|
-
const response = await this.
|
|
2962
|
+
const response = await this.marketPublicGetV1beta3CryptoLocLatestOrderbooks(this.extend(request, params));
|
|
2875
2963
|
//
|
|
2876
2964
|
// {
|
|
2877
2965
|
// "orderbooks":{
|
|
@@ -2919,27 +3007,44 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2919
3007
|
* @method
|
|
2920
3008
|
* @name alpaca#fetchOHLCV
|
|
2921
3009
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
3010
|
+
* @see https://docs.alpaca.markets/reference/cryptobars
|
|
3011
|
+
* @see https://docs.alpaca.markets/reference/cryptolatestbars
|
|
2922
3012
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2923
3013
|
* @param {string} timeframe the length of time each candle represents
|
|
2924
3014
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2925
3015
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2926
3016
|
* @param {object} [params] extra parameters specific to the alpha api endpoint
|
|
3017
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
3018
|
+
* @param {string} [params.method] method, default: marketPublicGetV1beta3CryptoLocBars
|
|
2927
3019
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2928
3020
|
*/
|
|
2929
3021
|
await this.loadMarkets();
|
|
2930
3022
|
const market = this.market(symbol);
|
|
3023
|
+
const marketId = market['id'];
|
|
3024
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
3025
|
+
const method = this.safeString(params, 'method', 'marketPublicGetV1beta3CryptoLocBars');
|
|
2931
3026
|
const request = {
|
|
2932
|
-
'symbols':
|
|
2933
|
-
'
|
|
3027
|
+
'symbols': marketId,
|
|
3028
|
+
'loc': loc,
|
|
2934
3029
|
};
|
|
2935
|
-
|
|
2936
|
-
|
|
3030
|
+
params = this.omit(params, ['loc', 'method']);
|
|
3031
|
+
let response = undefined;
|
|
3032
|
+
if (method === 'marketPublicGetV1beta3CryptoLocBars') {
|
|
3033
|
+
if (limit !== undefined) {
|
|
3034
|
+
request['limit'] = limit;
|
|
3035
|
+
}
|
|
3036
|
+
if (since !== undefined) {
|
|
3037
|
+
request['start'] = this.yyyymmdd(since);
|
|
3038
|
+
}
|
|
3039
|
+
request['timeframe'] = this.safeString(this.timeframes, timeframe, timeframe);
|
|
3040
|
+
response = await this.marketPublicGetV1beta3CryptoLocBars(this.extend(request, params));
|
|
2937
3041
|
}
|
|
2938
|
-
if (
|
|
2939
|
-
|
|
3042
|
+
else if (method === 'marketPublicGetV1beta3CryptoLocLatestBars') {
|
|
3043
|
+
response = await this.marketPublicGetV1beta3CryptoLocLatestBars(this.extend(request, params));
|
|
3044
|
+
}
|
|
3045
|
+
else {
|
|
3046
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOHLCV() does not support ' + method + ', marketPublicGetV1beta3CryptoLocBars and marketPublicGetV1beta3CryptoLocLatestBars are supported');
|
|
2940
3047
|
}
|
|
2941
|
-
const method = this.safeString(this.options, 'fetchOHLCVMethod', 'cryptoPublicGetCryptoBars');
|
|
2942
|
-
const response = await this[method](this.extend(request, params));
|
|
2943
3048
|
//
|
|
2944
3049
|
// {
|
|
2945
3050
|
// "bars":{
|
|
@@ -2969,8 +3074,26 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2969
3074
|
// "next_page_token":"QlRDL1VTRHxNfDIwMjItMDctMjFUMDU6MDE6MDAuMDAwMDAwMDAwWg=="
|
|
2970
3075
|
// }
|
|
2971
3076
|
//
|
|
3077
|
+
// {
|
|
3078
|
+
// "bars":{
|
|
3079
|
+
// "BTC/USD":{
|
|
3080
|
+
// "c":22887,
|
|
3081
|
+
// "h":22888,
|
|
3082
|
+
// "l":22873,
|
|
3083
|
+
// "n":11,
|
|
3084
|
+
// "o":22883,
|
|
3085
|
+
// "t":"2022-07-21T05:00:00Z",
|
|
3086
|
+
// "v":1.1138,
|
|
3087
|
+
// "vw":22883.0155324116
|
|
3088
|
+
// }
|
|
3089
|
+
// }
|
|
3090
|
+
// }
|
|
3091
|
+
//
|
|
2972
3092
|
const bars = this.safeValue(response, 'bars', {});
|
|
2973
|
-
|
|
3093
|
+
let ohlcvs = this.safeValue(bars, marketId, {});
|
|
3094
|
+
if (!Array.isArray(ohlcvs)) {
|
|
3095
|
+
ohlcvs = [ohlcvs];
|
|
3096
|
+
}
|
|
2974
3097
|
return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
|
|
2975
3098
|
}
|
|
2976
3099
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -3046,7 +3169,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3046
3169
|
const clientOrderId = this.safeString(params, 'clientOrderId', defaultClientId);
|
|
3047
3170
|
request['client_order_id'] = clientOrderId;
|
|
3048
3171
|
params = this.omit(params, ['clientOrderId']);
|
|
3049
|
-
const order = await this.
|
|
3172
|
+
const order = await this.traderPrivatePostV2Orders(this.extend(request, params));
|
|
3050
3173
|
//
|
|
3051
3174
|
// {
|
|
3052
3175
|
// "id": "61e69015-8549-4bfd-b9c3-01e75843f47d",
|
|
@@ -3098,7 +3221,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3098
3221
|
const request = {
|
|
3099
3222
|
'order_id': id,
|
|
3100
3223
|
};
|
|
3101
|
-
const response = await this.
|
|
3224
|
+
const response = await this.traderPrivateDeleteV2OrdersOrderId(this.extend(request, params));
|
|
3102
3225
|
//
|
|
3103
3226
|
// {
|
|
3104
3227
|
// "code": 40410000,
|
|
@@ -3120,7 +3243,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3120
3243
|
const request = {
|
|
3121
3244
|
'order_id': id,
|
|
3122
3245
|
};
|
|
3123
|
-
const order = await this.
|
|
3246
|
+
const order = await this.traderPrivateGetV2OrdersOrderId(this.extend(request, params));
|
|
3124
3247
|
const marketId = this.safeString(order, 'symbol');
|
|
3125
3248
|
const market = this.safeMarket(marketId);
|
|
3126
3249
|
return this.parseOrder(order, market);
|
|
@@ -3141,7 +3264,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3141
3264
|
if (symbol !== undefined) {
|
|
3142
3265
|
market = this.market(symbol);
|
|
3143
3266
|
}
|
|
3144
|
-
const orders = await this.
|
|
3267
|
+
const orders = await this.traderPrivateGetV2Orders(params);
|
|
3145
3268
|
return this.parseOrders(orders, market, since, limit);
|
|
3146
3269
|
}
|
|
3147
3270
|
parseOrder(order, market = undefined) {
|
|
@@ -3287,13 +3410,10 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3287
3410
|
}, market);
|
|
3288
3411
|
}
|
|
3289
3412
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3290
|
-
const versions = this.safeValue(this.options, 'versions');
|
|
3291
|
-
const version = this.safeString(versions, api);
|
|
3292
3413
|
let endpoint = '/' + this.implodeParams(path, params);
|
|
3293
|
-
let url = this.
|
|
3294
|
-
url = this.implodeHostname(url);
|
|
3414
|
+
let url = this.implodeHostname(this.urls['api'][api[0]]);
|
|
3295
3415
|
headers = (headers !== undefined) ? headers : {};
|
|
3296
|
-
if (api === 'private') {
|
|
3416
|
+
if (api[1] === 'private') {
|
|
3297
3417
|
headers['APCA-API-KEY-ID'] = this.apiKey;
|
|
3298
3418
|
headers['APCA-API-SECRET-KEY'] = this.secret;
|
|
3299
3419
|
}
|
|
@@ -7119,7 +7239,7 @@ class Exchange {
|
|
|
7119
7239
|
'fetchPermissions': undefined,
|
|
7120
7240
|
'fetchPosition': undefined,
|
|
7121
7241
|
'fetchPositions': undefined,
|
|
7122
|
-
'
|
|
7242
|
+
'fetchPositionsForSymbol': undefined,
|
|
7123
7243
|
'fetchPositionsRisk': undefined,
|
|
7124
7244
|
'fetchPremiumIndexOHLCV': undefined,
|
|
7125
7245
|
'fetchStatus': 'emulated',
|
|
@@ -9729,16 +9849,16 @@ class Exchange {
|
|
|
9729
9849
|
async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9730
9850
|
return this.watchPositions(symbols, since, limit, params);
|
|
9731
9851
|
}
|
|
9732
|
-
async
|
|
9852
|
+
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
9733
9853
|
/**
|
|
9734
9854
|
* @method
|
|
9735
|
-
* @name exchange#
|
|
9736
|
-
* @description
|
|
9737
|
-
* @param {string} symbol unified market symbol
|
|
9855
|
+
* @name exchange#fetchPositionsForSymbol
|
|
9856
|
+
* @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for one-market position, because of less rate-limit consumption and speed
|
|
9857
|
+
* @param {string} symbol unified market symbol
|
|
9738
9858
|
* @param {object} params extra parameters specific to the endpoint
|
|
9739
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - one position for "one-way" mode, and two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
|
9859
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
|
9740
9860
|
*/
|
|
9741
|
-
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + '
|
|
9861
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
|
|
9742
9862
|
}
|
|
9743
9863
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
9744
9864
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositions() is not supported yet');
|
|
@@ -13656,8 +13776,8 @@ class ArrayCacheBySymbolBySide extends ArrayCache {
|
|
|
13656
13776
|
/* harmony import */ var _static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7348);
|
|
13657
13777
|
/* harmony import */ var _Future_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2367);
|
|
13658
13778
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(927);
|
|
13659
|
-
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
13660
|
-
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
13779
|
+
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1621);
|
|
13780
|
+
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9125);
|
|
13661
13781
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1237);
|
|
13662
13782
|
/* harmony import */ var _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9651);
|
|
13663
13783
|
|
|
@@ -13766,7 +13886,7 @@ class Client {
|
|
|
13766
13886
|
if (!this.isOpen()) {
|
|
13767
13887
|
const error = new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' failed due to a connection timeout');
|
|
13768
13888
|
this.onError(error);
|
|
13769
|
-
this.connection.close(
|
|
13889
|
+
this.connection.close(1006);
|
|
13770
13890
|
}
|
|
13771
13891
|
}
|
|
13772
13892
|
setConnectionTimeout() {
|
|
@@ -13793,7 +13913,7 @@ class Client {
|
|
|
13793
13913
|
}
|
|
13794
13914
|
onPingInterval() {
|
|
13795
13915
|
if (this.keepAlive && this.isOpen()) {
|
|
13796
|
-
const now = (0,
|
|
13916
|
+
const now = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13797
13917
|
this.lastPong = this.lastPong || now;
|
|
13798
13918
|
if ((this.lastPong + this.keepAlive * this.maxPingPongMisses) < now) {
|
|
13799
13919
|
this.onError(new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' timed out due to a ping-pong keepalive missing on time'));
|
|
@@ -13802,7 +13922,7 @@ class Client {
|
|
|
13802
13922
|
if (this.ping) {
|
|
13803
13923
|
this.send(this.ping(this));
|
|
13804
13924
|
}
|
|
13805
|
-
else if (
|
|
13925
|
+
else if (_base_functions_js__WEBPACK_IMPORTED_MODULE_5__/* .isNode */ .UG) {
|
|
13806
13926
|
// can't do this inside browser
|
|
13807
13927
|
// https://stackoverflow.com/questions/10585355/sending-websocket-ping-pong-frame-from-browser
|
|
13808
13928
|
this.connection.ping();
|
|
@@ -13821,7 +13941,7 @@ class Client {
|
|
|
13821
13941
|
if (this.verbose) {
|
|
13822
13942
|
this.log(new Date(), 'onOpen');
|
|
13823
13943
|
}
|
|
13824
|
-
this.connectionEstablished = (0,
|
|
13944
|
+
this.connectionEstablished = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13825
13945
|
this.isConnected = true;
|
|
13826
13946
|
this.connected.resolve(this.url);
|
|
13827
13947
|
// this.connection.terminate () // debugging
|
|
@@ -13838,7 +13958,7 @@ class Client {
|
|
|
13838
13958
|
}
|
|
13839
13959
|
}
|
|
13840
13960
|
onPong() {
|
|
13841
|
-
this.lastPong = (0,
|
|
13961
|
+
this.lastPong = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13842
13962
|
if (this.verbose) {
|
|
13843
13963
|
this.log(new Date(), 'onPong');
|
|
13844
13964
|
}
|
|
@@ -13881,7 +14001,7 @@ class Client {
|
|
|
13881
14001
|
}
|
|
13882
14002
|
message = (typeof message === 'string') ? message : JSON.stringify(message);
|
|
13883
14003
|
const future = (0,_Future_js__WEBPACK_IMPORTED_MODULE_2__/* .createFuture */ .N)();
|
|
13884
|
-
if (
|
|
14004
|
+
if (_base_functions_js__WEBPACK_IMPORTED_MODULE_5__/* .isNode */ .UG) {
|
|
13885
14005
|
function onSendComplete(error) {
|
|
13886
14006
|
if (error) {
|
|
13887
14007
|
future.reject(error);
|
|
@@ -16709,6 +16829,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16709
16829
|
'margin/capital-flow': 10,
|
|
16710
16830
|
'margin/delist-schedule': 10,
|
|
16711
16831
|
'margin/available-inventory': 0.3334,
|
|
16832
|
+
'margin/leverageBracket': 0.1,
|
|
16712
16833
|
'loan/vip/loanable/data': 40,
|
|
16713
16834
|
'loan/vip/collateral/data': 40,
|
|
16714
16835
|
'loan/vip/request/data': 2.6668,
|
|
@@ -16738,6 +16859,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16738
16859
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
16739
16860
|
'capital/config/getall': 1,
|
|
16740
16861
|
'capital/deposit/address': 1,
|
|
16862
|
+
'capital/deposit/address/list': 1,
|
|
16741
16863
|
'capital/deposit/hisrec': 0.1,
|
|
16742
16864
|
'capital/deposit/subAddress': 0.1,
|
|
16743
16865
|
'capital/deposit/subHisrec': 0.1,
|
|
@@ -60438,7 +60560,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60438
60560
|
this.checkAddress(address);
|
|
60439
60561
|
await this.loadMarkets();
|
|
60440
60562
|
const currency = this.currency(code);
|
|
60441
|
-
let chainName = this.
|
|
60563
|
+
let chainName = this.safeString2(params, 'network', 'chainName');
|
|
60442
60564
|
if (chainName === undefined) {
|
|
60443
60565
|
const networks = this.safeValue(currency, 'networks', {});
|
|
60444
60566
|
const optionsNetworks = this.safeValue(this.options, 'networks', {});
|
|
@@ -79913,7 +80035,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
79913
80035
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
79914
80036
|
*/
|
|
79915
80037
|
let symbol = undefined;
|
|
79916
|
-
if (Array.isArray(symbols)) {
|
|
80038
|
+
if ((symbols !== undefined) && Array.isArray(symbols)) {
|
|
79917
80039
|
const symbolsLength = symbols.length;
|
|
79918
80040
|
if (symbolsLength > 1) {
|
|
79919
80041
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchPositions() does not accept an array with more than one symbol');
|
|
@@ -83712,12 +83834,17 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83712
83834
|
'fiat',
|
|
83713
83835
|
// 'vault',
|
|
83714
83836
|
],
|
|
83837
|
+
'v3Accounts': [
|
|
83838
|
+
'ACCOUNT_TYPE_CRYPTO',
|
|
83839
|
+
'ACCOUNT_TYPE_FIAT',
|
|
83840
|
+
],
|
|
83715
83841
|
'createMarketBuyOrderRequiresPrice': true,
|
|
83716
83842
|
'advanced': true,
|
|
83717
83843
|
'fetchMarkets': 'fetchMarketsV3',
|
|
83718
83844
|
'fetchTicker': 'fetchTickerV3',
|
|
83719
83845
|
'fetchTickers': 'fetchTickersV3',
|
|
83720
83846
|
'fetchAccounts': 'fetchAccountsV3',
|
|
83847
|
+
'fetchBalance': 'v2PrivateGetAccounts',
|
|
83721
83848
|
'user_native_currency': 'USD', // needed to get fees for v3
|
|
83722
83849
|
},
|
|
83723
83850
|
});
|
|
@@ -83727,6 +83854,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83727
83854
|
* @method
|
|
83728
83855
|
* @name coinbase#fetchTime
|
|
83729
83856
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
83857
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
|
|
83730
83858
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83731
83859
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
83732
83860
|
*/
|
|
@@ -83747,6 +83875,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83747
83875
|
* @method
|
|
83748
83876
|
* @name coinbase#fetchAccounts
|
|
83749
83877
|
* @description fetch all the accounts associated with a profile
|
|
83878
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts
|
|
83879
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
|
|
83750
83880
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83751
83881
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
83752
83882
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
@@ -83950,6 +84080,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83950
84080
|
* @method
|
|
83951
84081
|
* @name coinbase#createDepositAddress
|
|
83952
84082
|
* @description create a currency deposit address
|
|
84083
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-addresses#create-address
|
|
83953
84084
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
83954
84085
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83955
84086
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -84024,6 +84155,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84024
84155
|
* @method
|
|
84025
84156
|
* @name coinbase#fetchMySells
|
|
84026
84157
|
* @description fetch sells
|
|
84158
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-sells#list-sells
|
|
84027
84159
|
* @param {string} symbol not used by coinbase fetchMySells ()
|
|
84028
84160
|
* @param {int} [since] timestamp in ms of the earliest sell, default is undefined
|
|
84029
84161
|
* @param {int} [limit] max number of sells to return, default is undefined
|
|
@@ -84042,6 +84174,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84042
84174
|
* @method
|
|
84043
84175
|
* @name coinbase#fetchMyBuys
|
|
84044
84176
|
* @description fetch buys
|
|
84177
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-buys#list-buys
|
|
84045
84178
|
* @param {string} symbol not used by coinbase fetchMyBuys ()
|
|
84046
84179
|
* @param {int} [since] timestamp in ms of the earliest buy, default is undefined
|
|
84047
84180
|
* @param {int} [limit] max number of buys to return, default is undefined
|
|
@@ -84067,6 +84200,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84067
84200
|
* @method
|
|
84068
84201
|
* @name coinbase#fetchWithdrawals
|
|
84069
84202
|
* @description fetch all withdrawals made from an account
|
|
84203
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-withdrawals#list-withdrawals
|
|
84070
84204
|
* @param {string} code unified currency code
|
|
84071
84205
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
84072
84206
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -84081,6 +84215,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84081
84215
|
* @method
|
|
84082
84216
|
* @name coinbase#fetchDeposits
|
|
84083
84217
|
* @description fetch all deposits made to an account
|
|
84218
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#list-deposits
|
|
84084
84219
|
* @param {string} code unified currency code
|
|
84085
84220
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
84086
84221
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -84339,6 +84474,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84339
84474
|
* @method
|
|
84340
84475
|
* @name coinbase#fetchMarkets
|
|
84341
84476
|
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
|
|
84477
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
|
84478
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84342
84479
|
* @description retrieves data on all markets for coinbase
|
|
84343
84480
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
84344
84481
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -84562,6 +84699,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84562
84699
|
* @method
|
|
84563
84700
|
* @name coinbase#fetchCurrencies
|
|
84564
84701
|
* @description fetches all available currencies on an exchange
|
|
84702
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
|
84703
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84565
84704
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84566
84705
|
* @returns {object} an associative dictionary of currencies
|
|
84567
84706
|
*/
|
|
@@ -84637,6 +84776,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84637
84776
|
* @method
|
|
84638
84777
|
* @name coinbase#fetchTickers
|
|
84639
84778
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
84779
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
|
|
84780
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84640
84781
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
84641
84782
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84642
84783
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -84738,6 +84879,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84738
84879
|
* @method
|
|
84739
84880
|
* @name coinbase#fetchTicker
|
|
84740
84881
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
84882
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getmarkettrades
|
|
84883
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-spot-price
|
|
84884
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-buy-price
|
|
84885
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
|
|
84741
84886
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
84742
84887
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84743
84888
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -84928,8 +85073,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84928
85073
|
}, market);
|
|
84929
85074
|
}
|
|
84930
85075
|
parseBalance(response, params = {}) {
|
|
84931
|
-
const balances = this.
|
|
85076
|
+
const balances = this.safeValue2(response, 'data', 'accounts', []);
|
|
84932
85077
|
const accounts = this.safeValue(params, 'type', this.options['accounts']);
|
|
85078
|
+
const v3Accounts = this.safeValue(params, 'type', this.options['v3Accounts']);
|
|
84933
85079
|
const result = { 'info': response };
|
|
84934
85080
|
for (let b = 0; b < balances.length; b++) {
|
|
84935
85081
|
const balance = balances[b];
|
|
@@ -84954,6 +85100,30 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84954
85100
|
result[code] = account;
|
|
84955
85101
|
}
|
|
84956
85102
|
}
|
|
85103
|
+
else if (this.inArray(type, v3Accounts)) {
|
|
85104
|
+
const available = this.safeValue(balance, 'available_balance');
|
|
85105
|
+
const hold = this.safeValue(balance, 'hold');
|
|
85106
|
+
if (available !== undefined && hold !== undefined) {
|
|
85107
|
+
const currencyId = this.safeString(available, 'currency');
|
|
85108
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
85109
|
+
const used = this.safeString(hold, 'value');
|
|
85110
|
+
const free = this.safeString(available, 'value');
|
|
85111
|
+
const total = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(used, free);
|
|
85112
|
+
let account = this.safeValue(result, code);
|
|
85113
|
+
if (account === undefined) {
|
|
85114
|
+
account = this.account();
|
|
85115
|
+
account['free'] = free;
|
|
85116
|
+
account['used'] = used;
|
|
85117
|
+
account['total'] = total;
|
|
85118
|
+
}
|
|
85119
|
+
else {
|
|
85120
|
+
account['free'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['free'], free);
|
|
85121
|
+
account['used'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['used'], used);
|
|
85122
|
+
account['total'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['total'], total);
|
|
85123
|
+
}
|
|
85124
|
+
result[code] = account;
|
|
85125
|
+
}
|
|
85126
|
+
}
|
|
84957
85127
|
}
|
|
84958
85128
|
return this.safeBalance(result);
|
|
84959
85129
|
}
|
|
@@ -84962,15 +85132,28 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84962
85132
|
* @method
|
|
84963
85133
|
* @name coinbase#fetchBalance
|
|
84964
85134
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
85135
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts
|
|
85136
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
|
|
84965
85137
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
85138
|
+
* @param {boolean} [params.v3] default false, set true to use v3 api endpoint
|
|
84966
85139
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
84967
85140
|
*/
|
|
84968
85141
|
await this.loadMarkets();
|
|
84969
85142
|
const request = {
|
|
84970
85143
|
'limit': 100,
|
|
84971
85144
|
};
|
|
84972
|
-
|
|
85145
|
+
let response = undefined;
|
|
85146
|
+
const isV3 = this.safeValue(params, 'v3', false);
|
|
85147
|
+
params = this.omit(params, 'v3');
|
|
85148
|
+
const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
|
|
85149
|
+
if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
|
|
85150
|
+
response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
|
|
85151
|
+
}
|
|
85152
|
+
else {
|
|
85153
|
+
response = await this.v2PrivateGetAccounts(this.extend(request, params));
|
|
85154
|
+
}
|
|
84973
85155
|
//
|
|
85156
|
+
// v2PrivateGetAccounts
|
|
84974
85157
|
// {
|
|
84975
85158
|
// "pagination":{
|
|
84976
85159
|
// "ending_before":null,
|
|
@@ -85010,6 +85193,36 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85010
85193
|
// ]
|
|
85011
85194
|
// }
|
|
85012
85195
|
//
|
|
85196
|
+
// v3PrivateGetBrokerageAccounts
|
|
85197
|
+
// {
|
|
85198
|
+
// "accounts": [
|
|
85199
|
+
// {
|
|
85200
|
+
// "uuid": "11111111-1111-1111-1111-111111111111",
|
|
85201
|
+
// "name": "USDC Wallet",
|
|
85202
|
+
// "currency": "USDC",
|
|
85203
|
+
// "available_balance": {
|
|
85204
|
+
// "value": "0.0000000000000000",
|
|
85205
|
+
// "currency": "USDC"
|
|
85206
|
+
// },
|
|
85207
|
+
// "default": true,
|
|
85208
|
+
// "active": true,
|
|
85209
|
+
// "created_at": "2023-01-04T06:20:06.456Z",
|
|
85210
|
+
// "updated_at": "2023-01-04T06:20:07.181Z",
|
|
85211
|
+
// "deleted_at": null,
|
|
85212
|
+
// "type": "ACCOUNT_TYPE_CRYPTO",
|
|
85213
|
+
// "ready": false,
|
|
85214
|
+
// "hold": {
|
|
85215
|
+
// "value": "0.0000000000000000",
|
|
85216
|
+
// "currency": "USDC"
|
|
85217
|
+
// }
|
|
85218
|
+
// },
|
|
85219
|
+
// ...
|
|
85220
|
+
// ],
|
|
85221
|
+
// "has_next": false,
|
|
85222
|
+
// "cursor": "",
|
|
85223
|
+
// "size": 9
|
|
85224
|
+
// }
|
|
85225
|
+
//
|
|
85013
85226
|
return this.parseBalance(response, params);
|
|
85014
85227
|
}
|
|
85015
85228
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -85017,6 +85230,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85017
85230
|
* @method
|
|
85018
85231
|
* @name coinbase#fetchLedger
|
|
85019
85232
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
85233
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
|
|
85020
85234
|
* @param {string} code unified currency code, default is undefined
|
|
85021
85235
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
85022
85236
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -86791,6 +87005,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86791
87005
|
* @method
|
|
86792
87006
|
* @name coinbasepro#fetchCurrencies
|
|
86793
87007
|
* @description fetches all available currencies on an exchange
|
|
87008
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrencies
|
|
86794
87009
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
86795
87010
|
* @returns {object} an associative dictionary of currencies
|
|
86796
87011
|
*/
|
|
@@ -86861,6 +87076,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86861
87076
|
* @method
|
|
86862
87077
|
* @name coinbasepro#fetchMarkets
|
|
86863
87078
|
* @description retrieves data on all markets for coinbasepro
|
|
87079
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducts
|
|
86864
87080
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
86865
87081
|
* @returns {object[]} an array of objects representing market data
|
|
86866
87082
|
*/
|
|
@@ -86981,6 +87197,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86981
87197
|
* @method
|
|
86982
87198
|
* @name coinbasepro#fetchAccounts
|
|
86983
87199
|
* @description fetch all the accounts associated with a profile
|
|
87200
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
|
|
86984
87201
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
86985
87202
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
86986
87203
|
*/
|
|
@@ -87046,6 +87263,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87046
87263
|
* @method
|
|
87047
87264
|
* @name coinbasepro#fetchBalance
|
|
87048
87265
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
87266
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
|
|
87049
87267
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87050
87268
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
87051
87269
|
*/
|
|
@@ -87178,6 +87396,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87178
87396
|
* @method
|
|
87179
87397
|
* @name coinbasepro#fetchTickers
|
|
87180
87398
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
87399
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproduct
|
|
87181
87400
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
87182
87401
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87183
87402
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -87413,6 +87632,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87413
87632
|
* @method
|
|
87414
87633
|
* @name coinbasepro#fetchTradingFees
|
|
87415
87634
|
* @description fetch the trading fees for multiple markets
|
|
87635
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfees
|
|
87416
87636
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87417
87637
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
87418
87638
|
*/
|
|
@@ -87911,6 +88131,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87911
88131
|
* @method
|
|
87912
88132
|
* @name coinbasepro#deposit
|
|
87913
88133
|
* @description Creates a new deposit address, as required by coinbasepro
|
|
88134
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositpaymentmethod
|
|
88135
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositcoinbaseaccount
|
|
87914
88136
|
* @param {string} code Unified CCXT currency code (e.g. `"USDT"`)
|
|
87915
88137
|
* @param {float} amount The amount of currency to send in the deposit (e.g. `20`)
|
|
87916
88138
|
* @param {string} address Not used by coinbasepro
|
|
@@ -87952,6 +88174,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87952
88174
|
* @method
|
|
87953
88175
|
* @name coinbasepro#withdraw
|
|
87954
88176
|
* @description make a withdrawal
|
|
88177
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod
|
|
88178
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawcoinbaseaccount
|
|
87955
88179
|
* @param {string} code unified currency code
|
|
87956
88180
|
* @param {float} amount the amount to withdraw
|
|
87957
88181
|
* @param {string} address the address to withdraw to
|
|
@@ -88235,6 +88459,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88235
88459
|
* @method
|
|
88236
88460
|
* @name coinbasepro#fetchDeposits
|
|
88237
88461
|
* @description fetch all deposits made to an account
|
|
88462
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
|
|
88463
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
|
|
88238
88464
|
* @param {string} code unified currency code
|
|
88239
88465
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
88240
88466
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -88248,6 +88474,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88248
88474
|
* @method
|
|
88249
88475
|
* @name coinbasepro#fetchWithdrawals
|
|
88250
88476
|
* @description fetch all withdrawals made from an account
|
|
88477
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
|
|
88478
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
|
|
88251
88479
|
* @param {string} code unified currency code
|
|
88252
88480
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
88253
88481
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -88358,6 +88586,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88358
88586
|
* @method
|
|
88359
88587
|
* @name coinbasepro#createDepositAddress
|
|
88360
88588
|
* @description create a currency deposit address
|
|
88589
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
|
|
88361
88590
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
88362
88591
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
88363
88592
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -124561,7 +124790,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124561
124790
|
params = this.omit(params, 'symbol');
|
|
124562
124791
|
}
|
|
124563
124792
|
if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
|
|
124564
|
-
request['settle'] = currency['
|
|
124793
|
+
request['settle'] = currency['id'];
|
|
124565
124794
|
}
|
|
124566
124795
|
const response = await this.privateWalletPostTransfers(this.extend(request, params));
|
|
124567
124796
|
//
|
|
@@ -137395,7 +137624,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137395
137624
|
if (limit !== undefined) {
|
|
137396
137625
|
request['size'] = limit;
|
|
137397
137626
|
}
|
|
137398
|
-
|
|
137627
|
+
let response = undefined;
|
|
137628
|
+
if (method === 'spot_private_get_v1_order_orders') {
|
|
137629
|
+
response = await this.spotPrivateGetV1OrderOrders(this.extend(request, params));
|
|
137630
|
+
}
|
|
137631
|
+
else {
|
|
137632
|
+
response = await this.spotPrivateGetV1OrderHistory(this.extend(request, params));
|
|
137633
|
+
}
|
|
137399
137634
|
//
|
|
137400
137635
|
// spot_private_get_v1_order_orders GET /v1/order/orders
|
|
137401
137636
|
//
|
|
@@ -155202,17 +155437,20 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155202
155437
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelAllOrders does not support isolated margin for stop orders');
|
|
155203
155438
|
}
|
|
155204
155439
|
}
|
|
155205
|
-
let
|
|
155440
|
+
let response = undefined;
|
|
155206
155441
|
if (stop) {
|
|
155207
|
-
|
|
155442
|
+
response = await this.privateDeleteStopOrderCancel(this.extend(request, query));
|
|
155208
155443
|
}
|
|
155209
155444
|
else if (hf) {
|
|
155210
155445
|
if (symbol === undefined) {
|
|
155211
155446
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol parameter for hf orders');
|
|
155212
155447
|
}
|
|
155213
|
-
|
|
155448
|
+
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
155449
|
+
}
|
|
155450
|
+
else {
|
|
155451
|
+
response = await this.privateDeleteOrders(this.extend(request, query));
|
|
155214
155452
|
}
|
|
155215
|
-
return
|
|
155453
|
+
return response;
|
|
155216
155454
|
}
|
|
155217
155455
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
155218
155456
|
/**
|
|
@@ -155269,20 +155507,22 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155269
155507
|
if (until) {
|
|
155270
155508
|
request['endAt'] = until;
|
|
155271
155509
|
}
|
|
155272
|
-
|
|
155510
|
+
request['tradeType'] = this.safeString(this.options['marginModes'], marginMode, 'TRADE');
|
|
155511
|
+
let response = undefined;
|
|
155273
155512
|
if (stop) {
|
|
155274
|
-
|
|
155513
|
+
response = await this.privateGetStopOrder(this.extend(request, query));
|
|
155275
155514
|
}
|
|
155276
155515
|
else if (hf) {
|
|
155277
155516
|
if (lowercaseStatus === 'active') {
|
|
155278
|
-
|
|
155517
|
+
response = await this.privateGetHfOrdersActive(this.extend(request, query));
|
|
155279
155518
|
}
|
|
155280
155519
|
else if (lowercaseStatus === 'done') {
|
|
155281
|
-
|
|
155520
|
+
response = await this.privateGetHfOrdersDone(this.extend(request, query));
|
|
155282
155521
|
}
|
|
155283
155522
|
}
|
|
155284
|
-
|
|
155285
|
-
|
|
155523
|
+
else {
|
|
155524
|
+
response = await this.privateGetOrders(this.extend(request, query));
|
|
155525
|
+
}
|
|
155286
155526
|
//
|
|
155287
155527
|
// {
|
|
155288
155528
|
// "code": "200000",
|
|
@@ -155427,21 +155667,21 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155427
155667
|
}
|
|
155428
155668
|
request['symbol'] = market['id'];
|
|
155429
155669
|
}
|
|
155430
|
-
params = this.omit(params, ['stop', 'hf']);
|
|
155431
|
-
let
|
|
155670
|
+
params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId']);
|
|
155671
|
+
let response = undefined;
|
|
155432
155672
|
if (clientOrderId !== undefined) {
|
|
155433
155673
|
request['clientOid'] = clientOrderId;
|
|
155434
155674
|
if (stop) {
|
|
155435
|
-
method = 'privateGetStopOrderQueryOrderByClientOid';
|
|
155436
155675
|
if (symbol !== undefined) {
|
|
155437
155676
|
request['symbol'] = market['id'];
|
|
155438
155677
|
}
|
|
155678
|
+
response = await this.privateGetStopOrderQueryOrderByClientOid(this.extend(request, params));
|
|
155439
155679
|
}
|
|
155440
155680
|
else if (hf) {
|
|
155441
|
-
|
|
155681
|
+
response = await this.privateGetHfOrdersClientOrderClientOid(this.extend(request, params));
|
|
155442
155682
|
}
|
|
155443
155683
|
else {
|
|
155444
|
-
|
|
155684
|
+
response = await this.privateGetOrderClientOrderClientOid(this.extend(request, params));
|
|
155445
155685
|
}
|
|
155446
155686
|
}
|
|
155447
155687
|
else {
|
|
@@ -155451,18 +155691,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155451
155691
|
if (id === undefined) {
|
|
155452
155692
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' fetchOrder() requires an order id');
|
|
155453
155693
|
}
|
|
155694
|
+
request['orderId'] = id;
|
|
155454
155695
|
if (stop) {
|
|
155455
|
-
|
|
155696
|
+
response = await this.privateGetStopOrderOrderId(this.extend(request, params));
|
|
155456
155697
|
}
|
|
155457
155698
|
else if (hf) {
|
|
155458
|
-
|
|
155699
|
+
response = await this.privateGetHfOrdersOrderId(this.extend(request, params));
|
|
155700
|
+
}
|
|
155701
|
+
else {
|
|
155702
|
+
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
155459
155703
|
}
|
|
155460
|
-
request['orderId'] = id;
|
|
155461
155704
|
}
|
|
155462
|
-
params = this.omit(params, ['clientOid', 'clientOrderId']);
|
|
155463
|
-
const response = await this[method](this.extend(request, params));
|
|
155464
155705
|
let responseData = this.safeValue(response, 'data');
|
|
155465
|
-
if (
|
|
155706
|
+
if (Array.isArray(responseData)) {
|
|
155466
155707
|
responseData = this.safeValue(responseData, 0);
|
|
155467
155708
|
}
|
|
155468
155709
|
return this.parseOrder(responseData, market);
|
|
@@ -155704,10 +155945,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155704
155945
|
if (limit !== undefined) {
|
|
155705
155946
|
request['pageSize'] = limit;
|
|
155706
155947
|
}
|
|
155707
|
-
|
|
155948
|
+
const method = this.options['fetchMyTradesMethod'];
|
|
155708
155949
|
let parseResponseData = false;
|
|
155950
|
+
let response = undefined;
|
|
155951
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
155709
155952
|
if (hf) {
|
|
155710
|
-
|
|
155953
|
+
response = await this.privateGetHfFills(this.extend(request, params));
|
|
155711
155954
|
}
|
|
155712
155955
|
else if (method === 'private_get_fills') {
|
|
155713
155956
|
// does not return trades earlier than 2019-02-18T00:00:00Z
|
|
@@ -155715,26 +155958,18 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155715
155958
|
// only returns trades up to one week after the since param
|
|
155716
155959
|
request['startAt'] = since;
|
|
155717
155960
|
}
|
|
155961
|
+
response = await this.privateGetFills(this.extend(request, params));
|
|
155718
155962
|
}
|
|
155719
155963
|
else if (method === 'private_get_limit_fills') {
|
|
155720
155964
|
// does not return trades earlier than 2019-02-18T00:00:00Z
|
|
155721
155965
|
// takes no params
|
|
155722
155966
|
// only returns first 1000 trades (not only "in the last 24 hours" as stated in the docs)
|
|
155723
155967
|
parseResponseData = true;
|
|
155724
|
-
|
|
155725
|
-
else if (method === 'private_get_hist_orders') {
|
|
155726
|
-
// despite that this endpoint is called `HistOrders`
|
|
155727
|
-
// it returns historical trades instead of orders
|
|
155728
|
-
// returns trades earlier than 2019-02-18T00:00:00Z only
|
|
155729
|
-
if (since !== undefined) {
|
|
155730
|
-
request['startAt'] = this.parseToInt(since / 1000);
|
|
155731
|
-
}
|
|
155968
|
+
response = await this.privateGetLimitFills(this.extend(request, params));
|
|
155732
155969
|
}
|
|
155733
155970
|
else {
|
|
155734
155971
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
|
|
155735
155972
|
}
|
|
155736
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
155737
|
-
const response = await this[method](this.extend(request, params));
|
|
155738
155973
|
//
|
|
155739
155974
|
// {
|
|
155740
155975
|
// "currentPage": 1,
|
|
@@ -156177,8 +156412,6 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156177
156412
|
/**
|
|
156178
156413
|
* @method
|
|
156179
156414
|
* @name kucoin#fetchDeposits
|
|
156180
|
-
* @see https://docs.kucoin.com/#get-deposit-list
|
|
156181
|
-
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
156182
156415
|
* @description fetch all deposits made to an account
|
|
156183
156416
|
* @see https://docs.kucoin.com/#get-deposit-list
|
|
156184
156417
|
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
@@ -156205,19 +156438,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156205
156438
|
if (limit !== undefined) {
|
|
156206
156439
|
request['pageSize'] = limit;
|
|
156207
156440
|
}
|
|
156208
|
-
|
|
156209
|
-
|
|
156441
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156442
|
+
let response = undefined;
|
|
156443
|
+
if (since !== undefined && since < 1550448000000) {
|
|
156210
156444
|
// if since is earlier than 2019-02-18T00:00:00Z
|
|
156211
|
-
|
|
156212
|
-
|
|
156213
|
-
|
|
156214
|
-
|
|
156215
|
-
|
|
156445
|
+
request['startAt'] = this.parseToInt(since / 1000);
|
|
156446
|
+
response = await this.privateGetHistDeposits(this.extend(request, params));
|
|
156447
|
+
}
|
|
156448
|
+
else {
|
|
156449
|
+
if (since !== undefined) {
|
|
156216
156450
|
request['startAt'] = since;
|
|
156217
156451
|
}
|
|
156452
|
+
response = await this.privateGetDeposits(this.extend(request, params));
|
|
156218
156453
|
}
|
|
156219
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156220
|
-
const response = await this[method](this.extend(request, params));
|
|
156221
156454
|
//
|
|
156222
156455
|
// {
|
|
156223
156456
|
// "code": "200000",
|
|
@@ -156289,19 +156522,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156289
156522
|
if (limit !== undefined) {
|
|
156290
156523
|
request['pageSize'] = limit;
|
|
156291
156524
|
}
|
|
156292
|
-
|
|
156293
|
-
|
|
156525
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156526
|
+
let response = undefined;
|
|
156527
|
+
if (since !== undefined && since < 1550448000000) {
|
|
156294
156528
|
// if since is earlier than 2019-02-18T00:00:00Z
|
|
156295
|
-
|
|
156296
|
-
|
|
156297
|
-
|
|
156298
|
-
|
|
156299
|
-
|
|
156529
|
+
request['startAt'] = this.parseToInt(since / 1000);
|
|
156530
|
+
response = await this.privateGetHistWithdrawals(this.extend(request, params));
|
|
156531
|
+
}
|
|
156532
|
+
else {
|
|
156533
|
+
if (since !== undefined) {
|
|
156300
156534
|
request['startAt'] = since;
|
|
156301
156535
|
}
|
|
156536
|
+
response = await this.privateGetWithdrawals(this.extend(request, params));
|
|
156302
156537
|
}
|
|
156303
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156304
|
-
const response = await this[method](this.extend(request, params));
|
|
156305
156538
|
//
|
|
156306
156539
|
// {
|
|
156307
156540
|
// "code": "200000",
|
|
@@ -156378,26 +156611,26 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156378
156611
|
const type = this.safeString(accountsByType, requestedType, requestedType);
|
|
156379
156612
|
params = this.omit(params, 'type');
|
|
156380
156613
|
const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
156381
|
-
let
|
|
156614
|
+
let response = undefined;
|
|
156382
156615
|
const request = {};
|
|
156383
156616
|
const isolated = (marginMode === 'isolated') || (type === 'isolated');
|
|
156384
156617
|
const cross = (marginMode === 'cross') || (type === 'cross');
|
|
156385
156618
|
if (isolated) {
|
|
156386
|
-
method = 'privateGetIsolatedAccounts';
|
|
156387
156619
|
if (currency !== undefined) {
|
|
156388
156620
|
request['balanceCurrency'] = currency['id'];
|
|
156389
156621
|
}
|
|
156622
|
+
response = await this.privateGetIsolatedAccounts(this.extend(request, query));
|
|
156390
156623
|
}
|
|
156391
156624
|
else if (cross) {
|
|
156392
|
-
|
|
156625
|
+
response = await this.privateGetMarginAccount(this.extend(request, query));
|
|
156393
156626
|
}
|
|
156394
156627
|
else {
|
|
156395
156628
|
if (currency !== undefined) {
|
|
156396
156629
|
request['currency'] = currency['id'];
|
|
156397
156630
|
}
|
|
156398
156631
|
request['type'] = type;
|
|
156632
|
+
response = await this.privateGetAccounts(this.extend(request, query));
|
|
156399
156633
|
}
|
|
156400
|
-
const response = await this[method](this.extend(request, query));
|
|
156401
156634
|
//
|
|
156402
156635
|
// Spot and Cross
|
|
156403
156636
|
//
|
|
@@ -156937,43 +157170,37 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156937
157170
|
marginMode = 'cross'; // cross as default marginMode
|
|
156938
157171
|
}
|
|
156939
157172
|
const request = {};
|
|
156940
|
-
let
|
|
157173
|
+
let response = undefined;
|
|
157174
|
+
if (code !== undefined) {
|
|
157175
|
+
const currency = this.currency(code);
|
|
157176
|
+
request['quoteCurrency'] = currency['id'];
|
|
157177
|
+
}
|
|
156941
157178
|
if (marginMode === 'isolated') {
|
|
156942
|
-
|
|
156943
|
-
const currency = this.currency(code);
|
|
156944
|
-
request['balanceCurrency'] = currency['id'];
|
|
156945
|
-
}
|
|
156946
|
-
method = 'privateGetIsolatedAccounts';
|
|
157179
|
+
response = await this.privateGetIsolatedAccounts(this.extend(request, params));
|
|
156947
157180
|
}
|
|
156948
157181
|
else {
|
|
156949
|
-
|
|
156950
|
-
const currency = this.currency(code);
|
|
156951
|
-
request['currency'] = currency['id'];
|
|
156952
|
-
}
|
|
157182
|
+
response = await this.privateGetMarginAccounts(this.extend(request, params));
|
|
156953
157183
|
}
|
|
156954
|
-
const response = await this[method](this.extend(request, params));
|
|
156955
157184
|
//
|
|
156956
157185
|
// Cross
|
|
156957
157186
|
//
|
|
156958
157187
|
// {
|
|
156959
157188
|
// "code": "200000",
|
|
156960
157189
|
// "data": {
|
|
156961
|
-
// "
|
|
156962
|
-
// "
|
|
156963
|
-
// "
|
|
156964
|
-
// "
|
|
156965
|
-
// "
|
|
157190
|
+
// "totalAssetOfQuoteCurrency": "0",
|
|
157191
|
+
// "totalLiabilityOfQuoteCurrency": "0",
|
|
157192
|
+
// "debtRatio": "0",
|
|
157193
|
+
// "status": "EFFECTIVE",
|
|
157194
|
+
// "accounts": [
|
|
156966
157195
|
// {
|
|
156967
|
-
// "
|
|
156968
|
-
// "
|
|
156969
|
-
// "
|
|
156970
|
-
// "
|
|
156971
|
-
// "liability": "
|
|
156972
|
-
// "
|
|
156973
|
-
// "
|
|
156974
|
-
// "
|
|
156975
|
-
// "createdAt": 1658970912000,
|
|
156976
|
-
// "maturityTime": 1659575713000
|
|
157196
|
+
// "currency": "1INCH",
|
|
157197
|
+
// "total": "0",
|
|
157198
|
+
// "available": "0",
|
|
157199
|
+
// "hold": "0",
|
|
157200
|
+
// "liability": "0",
|
|
157201
|
+
// "maxBorrowSize": "0",
|
|
157202
|
+
// "borrowEnabled": true,
|
|
157203
|
+
// "transferInEnabled": true
|
|
156977
157204
|
// }
|
|
156978
157205
|
// ]
|
|
156979
157206
|
// }
|
|
@@ -156988,34 +157215,38 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156988
157215
|
// "liabilityConversionBalance": "0.01480001",
|
|
156989
157216
|
// "assets": [
|
|
156990
157217
|
// {
|
|
156991
|
-
// "symbol": "
|
|
156992
|
-
// "status": "CLEAR",
|
|
157218
|
+
// "symbol": "MANA-USDT",
|
|
156993
157219
|
// "debtRatio": "0",
|
|
157220
|
+
// "status": "BORROW",
|
|
156994
157221
|
// "baseAsset": {
|
|
156995
|
-
// "currency": "
|
|
156996
|
-
// "
|
|
156997
|
-
// "
|
|
156998
|
-
// "
|
|
156999
|
-
// "
|
|
157000
|
-
// "
|
|
157001
|
-
// "
|
|
157222
|
+
// "currency": "MANA",
|
|
157223
|
+
// "borrowEnabled": true,
|
|
157224
|
+
// "repayEnabled": true,
|
|
157225
|
+
// "transferEnabled": true,
|
|
157226
|
+
// "borrowed": "0",
|
|
157227
|
+
// "totalAsset": "0",
|
|
157228
|
+
// "available": "0",
|
|
157229
|
+
// "hold": "0",
|
|
157230
|
+
// "maxBorrowSize": "1000"
|
|
157002
157231
|
// },
|
|
157003
157232
|
// "quoteAsset": {
|
|
157004
157233
|
// "currency": "USDT",
|
|
157005
|
-
// "
|
|
157006
|
-
// "
|
|
157007
|
-
// "
|
|
157008
|
-
// "
|
|
157009
|
-
// "
|
|
157010
|
-
// "
|
|
157234
|
+
// "borrowEnabled": true,
|
|
157235
|
+
// "repayEnabled": true,
|
|
157236
|
+
// "transferEnabled": true,
|
|
157237
|
+
// "borrowed": "0",
|
|
157238
|
+
// "totalAsset": "0",
|
|
157239
|
+
// "available": "0",
|
|
157240
|
+
// "hold": "0",
|
|
157241
|
+
// "maxBorrowSize": "50000"
|
|
157011
157242
|
// }
|
|
157012
|
-
// }
|
|
157243
|
+
// }
|
|
157013
157244
|
// ]
|
|
157014
157245
|
// }
|
|
157015
157246
|
// }
|
|
157016
157247
|
//
|
|
157017
157248
|
const data = this.safeValue(response, 'data', {});
|
|
157018
|
-
const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, '
|
|
157249
|
+
const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, 'accounts', []);
|
|
157019
157250
|
return this.parseBorrowInterests(assets, undefined);
|
|
157020
157251
|
}
|
|
157021
157252
|
parseBorrowInterest(info, market = undefined) {
|
|
@@ -157023,43 +157254,45 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157023
157254
|
// Cross
|
|
157024
157255
|
//
|
|
157025
157256
|
// {
|
|
157026
|
-
// "
|
|
157027
|
-
// "
|
|
157028
|
-
// "
|
|
157029
|
-
// "
|
|
157030
|
-
// "liability": "
|
|
157031
|
-
// "
|
|
157032
|
-
// "
|
|
157033
|
-
// "
|
|
157034
|
-
//
|
|
157035
|
-
// "maturityTime": 1659575713000
|
|
157036
|
-
// },
|
|
157257
|
+
// "currency": "1INCH",
|
|
157258
|
+
// "total": "0",
|
|
157259
|
+
// "available": "0",
|
|
157260
|
+
// "hold": "0",
|
|
157261
|
+
// "liability": "0",
|
|
157262
|
+
// "maxBorrowSize": "0",
|
|
157263
|
+
// "borrowEnabled": true,
|
|
157264
|
+
// "transferInEnabled": true
|
|
157265
|
+
// }
|
|
157037
157266
|
//
|
|
157038
157267
|
// Isolated
|
|
157039
157268
|
//
|
|
157040
157269
|
// {
|
|
157041
|
-
// "symbol": "
|
|
157042
|
-
// "status": "CLEAR",
|
|
157270
|
+
// "symbol": "MANA-USDT",
|
|
157043
157271
|
// "debtRatio": "0",
|
|
157272
|
+
// "status": "BORROW",
|
|
157044
157273
|
// "baseAsset": {
|
|
157045
|
-
// "currency": "
|
|
157046
|
-
// "
|
|
157047
|
-
// "
|
|
157048
|
-
// "
|
|
157049
|
-
// "
|
|
157050
|
-
// "
|
|
157051
|
-
// "
|
|
157274
|
+
// "currency": "MANA",
|
|
157275
|
+
// "borrowEnabled": true,
|
|
157276
|
+
// "repayEnabled": true,
|
|
157277
|
+
// "transferEnabled": true,
|
|
157278
|
+
// "borrowed": "0",
|
|
157279
|
+
// "totalAsset": "0",
|
|
157280
|
+
// "available": "0",
|
|
157281
|
+
// "hold": "0",
|
|
157282
|
+
// "maxBorrowSize": "1000"
|
|
157052
157283
|
// },
|
|
157053
157284
|
// "quoteAsset": {
|
|
157054
157285
|
// "currency": "USDT",
|
|
157055
|
-
// "
|
|
157056
|
-
// "
|
|
157057
|
-
// "
|
|
157058
|
-
// "
|
|
157059
|
-
// "
|
|
157060
|
-
// "
|
|
157286
|
+
// "borrowEnabled": true,
|
|
157287
|
+
// "repayEnabled": true,
|
|
157288
|
+
// "transferEnabled": true,
|
|
157289
|
+
// "borrowed": "0",
|
|
157290
|
+
// "totalAsset": "0",
|
|
157291
|
+
// "available": "0",
|
|
157292
|
+
// "hold": "0",
|
|
157293
|
+
// "maxBorrowSize": "50000"
|
|
157061
157294
|
// }
|
|
157062
|
-
// }
|
|
157295
|
+
// }
|
|
157063
157296
|
//
|
|
157064
157297
|
const marketId = this.safeString(info, 'symbol');
|
|
157065
157298
|
const marginMode = (marketId === undefined) ? 'cross' : 'isolated';
|
|
@@ -157076,7 +157309,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157076
157309
|
currencyId = this.safeString(isolatedBase, 'currency');
|
|
157077
157310
|
}
|
|
157078
157311
|
else {
|
|
157079
|
-
amountBorrowed = this.safeNumber(info, '
|
|
157312
|
+
amountBorrowed = this.safeNumber(info, 'liability');
|
|
157080
157313
|
interest = this.safeNumber(info, 'accruedInterest');
|
|
157081
157314
|
currencyId = this.safeString(info, 'currency');
|
|
157082
157315
|
}
|
|
@@ -159877,7 +160110,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159877
160110
|
'fetchPosition': false,
|
|
159878
160111
|
'fetchPositionMode': false,
|
|
159879
160112
|
'fetchPositions': false,
|
|
159880
|
-
'
|
|
160113
|
+
'fetchPositionsForSymbol': false,
|
|
159881
160114
|
'fetchPositionsRisk': false,
|
|
159882
160115
|
'fetchPremiumIndexOHLCV': false,
|
|
159883
160116
|
'fetchTicker': true,
|
|
@@ -160755,7 +160988,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
160755
160988
|
const request = {
|
|
160756
160989
|
'pair': market['id'],
|
|
160757
160990
|
'orderSide': (side === 'buy') ? 'Bid' : 'Ask',
|
|
160758
|
-
'quantity':
|
|
160991
|
+
'quantity': this.numberToString(amount),
|
|
160759
160992
|
'type': capitalizedType,
|
|
160760
160993
|
};
|
|
160761
160994
|
if (capitalizedType === 'Limit') {
|
|
@@ -161621,7 +161854,8 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
161621
161854
|
let url = undefined;
|
|
161622
161855
|
if (Array.isArray(api)) {
|
|
161623
161856
|
const isGet = method === 'GET';
|
|
161624
|
-
const
|
|
161857
|
+
const version = this.safeString(api, 0);
|
|
161858
|
+
const access = this.safeString(api, 1);
|
|
161625
161859
|
if (version === 'v3') {
|
|
161626
161860
|
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
161627
161861
|
if (access === 'public') {
|
|
@@ -169978,18 +170212,18 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
169978
170212
|
'networks': {
|
|
169979
170213
|
'BTC': 'BTC',
|
|
169980
170214
|
'BCH': 'BCH',
|
|
169981
|
-
'TRC20': 'TRC20',
|
|
169982
|
-
'ERC20': 'ERC20',
|
|
169983
|
-
'BEP20': 'BEP20
|
|
169984
|
-
'OPTIMISM': 'OP',
|
|
169985
|
-
'SOL': 'SOL',
|
|
170215
|
+
'TRC20': 'Tron(TRC20)',
|
|
170216
|
+
'ERC20': 'Ethereum(ERC20)',
|
|
170217
|
+
'BEP20': 'BNBSmartChain(BEP20)',
|
|
170218
|
+
'OPTIMISM': 'Optimism(OP)',
|
|
170219
|
+
'SOL': 'Solana(SOL)',
|
|
169986
170220
|
'CRC20': 'CRONOS',
|
|
169987
|
-
'ALGO': 'ALGO',
|
|
170221
|
+
'ALGO': 'Algorand(ALGO)',
|
|
169988
170222
|
'XRP': 'XRP',
|
|
169989
|
-
'MATIC': 'MATIC',
|
|
170223
|
+
'MATIC': 'Polygon(MATIC)',
|
|
169990
170224
|
'AVAXX': 'AVAX_XCHAIN',
|
|
169991
|
-
'AVAXC': '
|
|
169992
|
-
'ARBONE': '
|
|
170225
|
+
'AVAXC': 'AvalancheCChain(AVAXCCHAIN)',
|
|
170226
|
+
'ARBONE': 'ArbitrumOne(ARB)',
|
|
169993
170227
|
'ARBNOVA': 'ARBNOVA',
|
|
169994
170228
|
'FTM': 'FTM',
|
|
169995
170229
|
'WAVES': 'WAVES',
|
|
@@ -170574,10 +170808,15 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
170574
170808
|
networkId = parts.join('');
|
|
170575
170809
|
networkId = networkId.replace('-20', '20');
|
|
170576
170810
|
const networksById = {
|
|
170577
|
-
'
|
|
170578
|
-
'
|
|
170579
|
-
'
|
|
170580
|
-
'
|
|
170811
|
+
'Ethereum(ERC20)': 'ERC20',
|
|
170812
|
+
'Algorand(ALGO)': 'ALGO',
|
|
170813
|
+
'ArbitrumOne(ARB)': 'ARBONE',
|
|
170814
|
+
'AvalancheCChain(AVAXCCHAIN)': 'AVAXC',
|
|
170815
|
+
'BNBSmartChain(BEP20)': 'BEP20',
|
|
170816
|
+
'Polygon(MATIC)': 'MATIC',
|
|
170817
|
+
'Optimism(OP)': 'OPTIMISM',
|
|
170818
|
+
'Solana(SOL)': 'SOL',
|
|
170819
|
+
'Tron(TRC20)': 'TRC20',
|
|
170581
170820
|
};
|
|
170582
170821
|
return this.safeString(networksById, networkId, networkId);
|
|
170583
170822
|
}
|
|
@@ -183018,6 +183257,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
183018
183257
|
'fetchPermissions': undefined,
|
|
183019
183258
|
'fetchPosition': true,
|
|
183020
183259
|
'fetchPositions': true,
|
|
183260
|
+
'fetchPositionsForSymbol': true,
|
|
183021
183261
|
'fetchPositionsRisk': false,
|
|
183022
183262
|
'fetchPremiumIndexOHLCV': false,
|
|
183023
183263
|
'fetchSettlementHistory': true,
|
|
@@ -187942,7 +188182,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
187942
188182
|
if (position === undefined) {
|
|
187943
188183
|
return undefined;
|
|
187944
188184
|
}
|
|
187945
|
-
return this.parsePosition(position);
|
|
188185
|
+
return this.parsePosition(position, market);
|
|
187946
188186
|
}
|
|
187947
188187
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
187948
188188
|
/**
|
|
@@ -188029,6 +188269,19 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188029
188269
|
}
|
|
188030
188270
|
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
188031
188271
|
}
|
|
188272
|
+
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
188273
|
+
/**
|
|
188274
|
+
* @method
|
|
188275
|
+
* @name okx#fetchPositions
|
|
188276
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
188277
|
+
* @description fetch all open positions for specific symbol
|
|
188278
|
+
* @param {string} symbol unified market symbol
|
|
188279
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
188280
|
+
* @param {string} [params.instType] MARGIN (if needed)
|
|
188281
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
188282
|
+
*/
|
|
188283
|
+
return await this.fetchPositions([symbol], params);
|
|
188284
|
+
}
|
|
188032
188285
|
parsePosition(position, market = undefined) {
|
|
188033
188286
|
//
|
|
188034
188287
|
// {
|
|
@@ -189332,7 +189585,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189332
189585
|
* @method
|
|
189333
189586
|
* @name okx#borrowCrossMargin
|
|
189334
189587
|
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
189335
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-
|
|
189588
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
189336
189589
|
* @param {string} code unified currency code of the currency to borrow
|
|
189337
189590
|
* @param {float} amount the amount to borrow
|
|
189338
189591
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
@@ -189352,12 +189605,10 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189352
189605
|
// "data": [
|
|
189353
189606
|
// {
|
|
189354
189607
|
// "amt": "102",
|
|
189355
|
-
// "availLoan": "97",
|
|
189356
189608
|
// "ccy": "USDT",
|
|
189357
|
-
// "
|
|
189358
|
-
// "posLoan": "0",
|
|
189609
|
+
// "ordId": "544199684697214976",
|
|
189359
189610
|
// "side": "borrow",
|
|
189360
|
-
// "
|
|
189611
|
+
// "state": "1"
|
|
189361
189612
|
// }
|
|
189362
189613
|
// ],
|
|
189363
189614
|
// "msg": ""
|
|
@@ -189372,18 +189623,25 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189372
189623
|
* @method
|
|
189373
189624
|
* @name okx#repayCrossMargin
|
|
189374
189625
|
* @description repay borrowed margin and interest
|
|
189375
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-
|
|
189626
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
189376
189627
|
* @param {string} code unified currency code of the currency to repay
|
|
189377
189628
|
* @param {float} amount the amount to repay
|
|
189378
189629
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
189630
|
+
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
189379
189631
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
189380
189632
|
*/
|
|
189381
189633
|
await this.loadMarkets();
|
|
189634
|
+
const id = this.safeString2(params, 'id', 'ordId');
|
|
189635
|
+
params = this.omit(params, 'id');
|
|
189636
|
+
if (id === undefined) {
|
|
189637
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' repayCrossMargin() requires an id parameter');
|
|
189638
|
+
}
|
|
189382
189639
|
const currency = this.currency(code);
|
|
189383
189640
|
const request = {
|
|
189384
189641
|
'ccy': currency['id'],
|
|
189385
189642
|
'amt': this.currencyToPrecision(code, amount),
|
|
189386
189643
|
'side': 'repay',
|
|
189644
|
+
'ordId': id,
|
|
189387
189645
|
};
|
|
189388
189646
|
const response = await this.privatePostAccountBorrowRepay(this.extend(request, params));
|
|
189389
189647
|
//
|
|
@@ -189392,12 +189650,10 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189392
189650
|
// "data": [
|
|
189393
189651
|
// {
|
|
189394
189652
|
// "amt": "102",
|
|
189395
|
-
// "availLoan": "97",
|
|
189396
189653
|
// "ccy": "USDT",
|
|
189397
|
-
// "
|
|
189398
|
-
// "posLoan": "0",
|
|
189654
|
+
// "ordId": "544199684697214976",
|
|
189399
189655
|
// "side": "repay",
|
|
189400
|
-
// "
|
|
189656
|
+
// "state": "1"
|
|
189401
189657
|
// }
|
|
189402
189658
|
// ],
|
|
189403
189659
|
// "msg": ""
|
|
@@ -190103,7 +190359,7 @@ class p2b extends _abstract_p2b_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
190103
190359
|
'fetchPermissions': false,
|
|
190104
190360
|
'fetchPosition': false,
|
|
190105
190361
|
'fetchPositions': false,
|
|
190106
|
-
'
|
|
190362
|
+
'fetchPositionsForSymbol': false,
|
|
190107
190363
|
'fetchPositionsRisk': false,
|
|
190108
190364
|
'fetchPremiumIndexOHLCV': false,
|
|
190109
190365
|
'fetchTicker': true,
|
|
@@ -218682,7 +218938,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
218682
218938
|
'args': topics,
|
|
218683
218939
|
};
|
|
218684
218940
|
const message = this.extend(request, params);
|
|
218685
|
-
return await this.watch(url, messageHash, message, subscriptionHash);
|
|
218941
|
+
return await this.watch(url, messageHash, message, messageHash, subscriptionHash);
|
|
218686
218942
|
}
|
|
218687
218943
|
async authenticate(url, params = {}) {
|
|
218688
218944
|
this.checkRequiredCredentials();
|
|
@@ -229797,6 +230053,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229797
230053
|
'spot': {
|
|
229798
230054
|
'public': 'wss://{hostname}/ws',
|
|
229799
230055
|
'private': 'wss://{hostname}/ws/v2',
|
|
230056
|
+
'feed': 'wss://{hostname}/feed',
|
|
229800
230057
|
},
|
|
229801
230058
|
'future': {
|
|
229802
230059
|
'linear': {
|
|
@@ -229824,6 +230081,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229824
230081
|
'spot': {
|
|
229825
230082
|
'public': 'wss://api-aws.huobi.pro/ws',
|
|
229826
230083
|
'private': 'wss://api-aws.huobi.pro/ws/v2',
|
|
230084
|
+
'feed': 'wss://{hostname}/feed',
|
|
229827
230085
|
},
|
|
229828
230086
|
'future': {
|
|
229829
230087
|
'linear': {
|
|
@@ -230090,13 +230348,13 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230090
230348
|
await this.loadMarkets();
|
|
230091
230349
|
const market = this.market(symbol);
|
|
230092
230350
|
symbol = market['symbol'];
|
|
230093
|
-
const
|
|
230094
|
-
|
|
230095
|
-
|
|
230096
|
-
|
|
230097
|
-
|
|
230098
|
-
|
|
230099
|
-
if (!
|
|
230351
|
+
const allowedLimits = [20, 150];
|
|
230352
|
+
// 2) 5-level/20-level incremental MBP is a tick by tick feed,
|
|
230353
|
+
// which means whenever there is an order book change at that level, it pushes an update;
|
|
230354
|
+
// 150-levels/400-level incremental MBP feed is based on the gap
|
|
230355
|
+
// between two snapshots at 100ms interval.
|
|
230356
|
+
limit = (limit === undefined) ? 20 : limit;
|
|
230357
|
+
if (!this.inArray(limit, allowedLimits)) {
|
|
230100
230358
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook swap market accepts limits of 20 and 150 only');
|
|
230101
230359
|
}
|
|
230102
230360
|
let messageHash = undefined;
|
|
@@ -230106,7 +230364,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230106
230364
|
else {
|
|
230107
230365
|
messageHash = 'market.' + market['id'] + '.depth.size_' + limit.toString() + '.high_freq';
|
|
230108
230366
|
}
|
|
230109
|
-
const url = this.getUrlByMarketType(market['type'], market['linear']);
|
|
230367
|
+
const url = this.getUrlByMarketType(market['type'], market['linear'], false, true);
|
|
230110
230368
|
let method = this.handleOrderBookSubscription;
|
|
230111
230369
|
if (!market['spot']) {
|
|
230112
230370
|
params = this.extend(params);
|
|
@@ -230141,6 +230399,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230141
230399
|
const symbol = this.safeString(subscription, 'symbol');
|
|
230142
230400
|
const messageHash = this.safeString(subscription, 'messageHash');
|
|
230143
230401
|
const id = this.safeString(message, 'id');
|
|
230402
|
+
const lastTimestamp = this.safeInteger(subscription, 'lastTimestamp');
|
|
230144
230403
|
try {
|
|
230145
230404
|
const orderbook = this.orderbooks[symbol];
|
|
230146
230405
|
const data = this.safeValue(message, 'data');
|
|
@@ -230148,16 +230407,15 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230148
230407
|
const firstMessage = this.safeValue(messages, 0, {});
|
|
230149
230408
|
const snapshot = this.parseOrderBook(data, symbol);
|
|
230150
230409
|
const tick = this.safeValue(firstMessage, 'tick');
|
|
230151
|
-
const sequence = this.safeInteger(tick, '
|
|
230410
|
+
const sequence = this.safeInteger(tick, 'prevSeqNum');
|
|
230152
230411
|
const nonce = this.safeInteger(data, 'seqNum');
|
|
230153
230412
|
snapshot['nonce'] = nonce;
|
|
230154
|
-
const
|
|
230155
|
-
|
|
230156
|
-
snapshot['datetime'] = this.iso8601(timestamp);
|
|
230413
|
+
const snapshotTimestamp = this.safeInteger(message, 'ts');
|
|
230414
|
+
subscription['lastTimestamp'] = snapshotTimestamp;
|
|
230157
230415
|
const snapshotLimit = this.safeInteger(subscription, 'limit');
|
|
230158
230416
|
const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
|
|
230159
230417
|
client.resolve(snapshotOrderBook, id);
|
|
230160
|
-
if ((sequence
|
|
230418
|
+
if ((sequence === undefined) || (nonce < sequence)) {
|
|
230161
230419
|
const maxAttempts = this.handleOption('watchOrderBook', 'maxRetries', 3);
|
|
230162
230420
|
let numAttempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230163
230421
|
// retry to synchronize if we have not reached maxAttempts yet
|
|
@@ -230165,9 +230423,10 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230165
230423
|
// safety guard
|
|
230166
230424
|
if (messageHash in client.subscriptions) {
|
|
230167
230425
|
numAttempts = this.sum(numAttempts, 1);
|
|
230426
|
+
const delayTime = this.sum(1000, lastTimestamp - snapshotTimestamp);
|
|
230168
230427
|
subscription['numAttempts'] = numAttempts;
|
|
230169
230428
|
client.subscriptions[messageHash] = subscription;
|
|
230170
|
-
this.
|
|
230429
|
+
this.delay(delayTime, this.watchOrderBookSnapshot, client, message, subscription);
|
|
230171
230430
|
}
|
|
230172
230431
|
}
|
|
230173
230432
|
else {
|
|
@@ -230179,8 +230438,9 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230179
230438
|
orderbook.reset(snapshot);
|
|
230180
230439
|
// unroll the accumulated deltas
|
|
230181
230440
|
for (let i = 0; i < messages.length; i++) {
|
|
230182
|
-
this.handleOrderBookMessage(client, messages[i]
|
|
230441
|
+
this.handleOrderBookMessage(client, messages[i]);
|
|
230183
230442
|
}
|
|
230443
|
+
orderbook.cache = [];
|
|
230184
230444
|
this.orderbooks[symbol] = orderbook;
|
|
230185
230445
|
client.resolve(orderbook, messageHash);
|
|
230186
230446
|
}
|
|
@@ -230191,29 +230451,31 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230191
230451
|
}
|
|
230192
230452
|
async watchOrderBookSnapshot(client, message, subscription) {
|
|
230193
230453
|
const messageHash = this.safeString(subscription, 'messageHash');
|
|
230454
|
+
const symbol = this.safeString(subscription, 'symbol');
|
|
230455
|
+
const limit = this.safeInteger(subscription, 'limit');
|
|
230456
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
230457
|
+
const params = this.safeValue(subscription, 'params');
|
|
230458
|
+
const attempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230459
|
+
const market = this.market(symbol);
|
|
230460
|
+
const url = this.getUrlByMarketType(market['type'], market['linear'], false, true);
|
|
230461
|
+
const requestId = this.requestId();
|
|
230462
|
+
const request = {
|
|
230463
|
+
'req': messageHash,
|
|
230464
|
+
'id': requestId,
|
|
230465
|
+
};
|
|
230466
|
+
// this is a temporary subscription by a specific requestId
|
|
230467
|
+
// it has a very short lifetime until the snapshot is received over ws
|
|
230468
|
+
const snapshotSubscription = {
|
|
230469
|
+
'id': requestId,
|
|
230470
|
+
'messageHash': messageHash,
|
|
230471
|
+
'symbol': symbol,
|
|
230472
|
+
'limit': limit,
|
|
230473
|
+
'params': params,
|
|
230474
|
+
'numAttempts': attempts,
|
|
230475
|
+
'lastTimestamp': timestamp,
|
|
230476
|
+
'method': this.handleOrderBookSnapshot,
|
|
230477
|
+
};
|
|
230194
230478
|
try {
|
|
230195
|
-
const symbol = this.safeString(subscription, 'symbol');
|
|
230196
|
-
const limit = this.safeInteger(subscription, 'limit');
|
|
230197
|
-
const params = this.safeValue(subscription, 'params');
|
|
230198
|
-
const attempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230199
|
-
const market = this.market(symbol);
|
|
230200
|
-
const url = this.getUrlByMarketType(market['type'], market['linear']);
|
|
230201
|
-
const requestId = this.requestId();
|
|
230202
|
-
const request = {
|
|
230203
|
-
'req': messageHash,
|
|
230204
|
-
'id': requestId,
|
|
230205
|
-
};
|
|
230206
|
-
// this is a temporary subscription by a specific requestId
|
|
230207
|
-
// it has a very short lifetime until the snapshot is received over ws
|
|
230208
|
-
const snapshotSubscription = {
|
|
230209
|
-
'id': requestId,
|
|
230210
|
-
'messageHash': messageHash,
|
|
230211
|
-
'symbol': symbol,
|
|
230212
|
-
'limit': limit,
|
|
230213
|
-
'params': params,
|
|
230214
|
-
'numAttempts': attempts,
|
|
230215
|
-
'method': this.handleOrderBookSnapshot,
|
|
230216
|
-
};
|
|
230217
230479
|
const orderbook = await this.watch(url, requestId, request, requestId, snapshotSubscription);
|
|
230218
230480
|
return orderbook.limit();
|
|
230219
230481
|
}
|
|
@@ -230232,7 +230494,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230232
230494
|
this.handleDelta(bookside, deltas[i]);
|
|
230233
230495
|
}
|
|
230234
230496
|
}
|
|
230235
|
-
handleOrderBookMessage(client, message
|
|
230497
|
+
handleOrderBookMessage(client, message) {
|
|
230236
230498
|
// spot markets
|
|
230237
230499
|
//
|
|
230238
230500
|
// {
|
|
@@ -230302,30 +230564,34 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230302
230564
|
const ch = this.safeValue(message, 'ch');
|
|
230303
230565
|
const parts = ch.split('.');
|
|
230304
230566
|
const marketId = this.safeString(parts, 1);
|
|
230305
|
-
const
|
|
230567
|
+
const market = this.safeMarket(marketId);
|
|
230568
|
+
const symbol = market['symbol'];
|
|
230569
|
+
const orderbook = this.orderbooks[symbol];
|
|
230306
230570
|
const tick = this.safeValue(message, 'tick', {});
|
|
230307
|
-
const seqNum = this.
|
|
230571
|
+
const seqNum = this.safeInteger(tick, 'seqNum');
|
|
230308
230572
|
const prevSeqNum = this.safeInteger(tick, 'prevSeqNum');
|
|
230309
230573
|
const event = this.safeString(tick, 'event');
|
|
230574
|
+
const version = this.safeInteger(tick, 'version');
|
|
230310
230575
|
const timestamp = this.safeInteger(message, 'ts');
|
|
230311
230576
|
if (event === 'snapshot') {
|
|
230312
230577
|
const snapshot = this.parseOrderBook(tick, symbol, timestamp);
|
|
230313
230578
|
orderbook.reset(snapshot);
|
|
230314
|
-
orderbook['nonce'] =
|
|
230579
|
+
orderbook['nonce'] = version;
|
|
230315
230580
|
}
|
|
230316
|
-
if (prevSeqNum !== undefined && prevSeqNum > orderbook['nonce']) {
|
|
230581
|
+
if ((prevSeqNum !== undefined) && prevSeqNum > orderbook['nonce']) {
|
|
230317
230582
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' watchOrderBook() received a mesage out of order');
|
|
230318
230583
|
}
|
|
230319
|
-
|
|
230584
|
+
const spotConditon = market['spot'] && (prevSeqNum === orderbook['nonce']);
|
|
230585
|
+
const nonSpotCondition = market['contract'] && (version - 1 === orderbook['nonce']);
|
|
230586
|
+
if (spotConditon || nonSpotCondition) {
|
|
230320
230587
|
const asks = this.safeValue(tick, 'asks', []);
|
|
230321
230588
|
const bids = this.safeValue(tick, 'bids', []);
|
|
230322
230589
|
this.handleDeltas(orderbook['asks'], asks);
|
|
230323
230590
|
this.handleDeltas(orderbook['bids'], bids);
|
|
230324
|
-
orderbook['nonce'] = seqNum;
|
|
230591
|
+
orderbook['nonce'] = spotConditon ? seqNum : version;
|
|
230325
230592
|
orderbook['timestamp'] = timestamp;
|
|
230326
230593
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
230327
230594
|
}
|
|
230328
|
-
return orderbook;
|
|
230329
230595
|
}
|
|
230330
230596
|
handleOrderBook(client, message) {
|
|
230331
230597
|
//
|
|
@@ -230373,9 +230639,9 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230373
230639
|
// "ts":1645023376098
|
|
230374
230640
|
// }
|
|
230375
230641
|
//
|
|
230376
|
-
const tick = this.safeValue(message, 'tick', {});
|
|
230377
|
-
const event = this.safeString(tick, 'event');
|
|
230378
230642
|
const messageHash = this.safeString(message, 'ch');
|
|
230643
|
+
const tick = this.safeValue(message, 'tick');
|
|
230644
|
+
const event = this.safeString(tick, 'event');
|
|
230379
230645
|
const ch = this.safeValue(message, 'ch');
|
|
230380
230646
|
const parts = ch.split('.');
|
|
230381
230647
|
const marketId = this.safeString(parts, 1);
|
|
@@ -230386,23 +230652,22 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230386
230652
|
const sizeParts = size.split('_');
|
|
230387
230653
|
const limit = this.safeInteger(sizeParts, 1);
|
|
230388
230654
|
orderbook = this.orderBook({}, limit);
|
|
230655
|
+
this.orderbooks[symbol] = orderbook;
|
|
230389
230656
|
}
|
|
230390
|
-
if (orderbook['nonce'] === undefined) {
|
|
230657
|
+
if ((event === undefined) && (orderbook['nonce'] === undefined)) {
|
|
230391
230658
|
orderbook.cache.push(message);
|
|
230392
230659
|
}
|
|
230393
|
-
|
|
230394
|
-
this.
|
|
230660
|
+
else {
|
|
230661
|
+
this.handleOrderBookMessage(client, message);
|
|
230395
230662
|
client.resolve(orderbook, messageHash);
|
|
230396
230663
|
}
|
|
230397
230664
|
}
|
|
230398
230665
|
handleOrderBookSubscription(client, message, subscription) {
|
|
230399
230666
|
const symbol = this.safeString(subscription, 'symbol');
|
|
230667
|
+
const market = this.market(symbol);
|
|
230400
230668
|
const limit = this.safeInteger(subscription, 'limit');
|
|
230401
|
-
if (symbol in this.orderbooks) {
|
|
230402
|
-
delete this.orderbooks[symbol];
|
|
230403
|
-
}
|
|
230404
230669
|
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
230405
|
-
if (
|
|
230670
|
+
if (market['spot']) {
|
|
230406
230671
|
this.spawn(this.watchOrderBookSnapshot, client, message, subscription);
|
|
230407
230672
|
}
|
|
230408
230673
|
}
|
|
@@ -231975,7 +232240,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
231975
232240
|
'fee': fee,
|
|
231976
232241
|
}, market);
|
|
231977
232242
|
}
|
|
231978
|
-
getUrlByMarketType(type, isLinear = true, isPrivate = false) {
|
|
232243
|
+
getUrlByMarketType(type, isLinear = true, isPrivate = false, isFeed = false) {
|
|
231979
232244
|
const api = this.safeString(this.options, 'api', 'api');
|
|
231980
232245
|
const hostname = { 'hostname': this.hostname };
|
|
231981
232246
|
let hostnameURL = undefined;
|
|
@@ -231985,7 +232250,12 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
231985
232250
|
hostnameURL = this.urls['api']['ws'][api]['spot']['private'];
|
|
231986
232251
|
}
|
|
231987
232252
|
else {
|
|
231988
|
-
|
|
232253
|
+
if (isFeed) {
|
|
232254
|
+
hostnameURL = this.urls['api']['ws'][api]['spot']['feed'];
|
|
232255
|
+
}
|
|
232256
|
+
else {
|
|
232257
|
+
hostnameURL = this.urls['api']['ws'][api]['spot']['public'];
|
|
232258
|
+
}
|
|
231989
232259
|
}
|
|
231990
232260
|
url = this.implodeParams(hostnameURL, hostname);
|
|
231991
232261
|
}
|
|
@@ -285863,7 +286133,7 @@ SOFTWARE.
|
|
|
285863
286133
|
|
|
285864
286134
|
//-----------------------------------------------------------------------------
|
|
285865
286135
|
// this is updated by vss.js when building
|
|
285866
|
-
const version = '4.1.
|
|
286136
|
+
const version = '4.1.61';
|
|
285867
286137
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
285868
286138
|
//-----------------------------------------------------------------------------
|
|
285869
286139
|
|