ccxt 4.1.60 → 4.1.62
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 +1850 -678
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +204 -84
- package/dist/cjs/src/base/Exchange.js +13 -9
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bitrue.js +1509 -348
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +94 -2
- package/dist/cjs/src/gate.js +1 -217
- package/dist/cjs/src/htx.js +7 -1
- package/dist/cjs/src/kuna.js +4 -3
- package/dist/cjs/src/okx.js +13 -10
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- 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 +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bitrue.d.ts +65 -25
- package/js/src/alpaca.js +204 -84
- package/js/src/base/Exchange.js +13 -9
- package/js/src/binance.js +1 -0
- package/js/src/bitrue.d.ts +42 -2
- package/js/src/bitrue.js +1510 -349
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.js +94 -2
- package/js/src/gate.d.ts +0 -27
- package/js/src/gate.js +1 -217
- package/js/src/htx.js +7 -1
- package/js/src/kuna.js +4 -3
- package/js/src/okx.js +13 -10
- package/js/src/p2b.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/jsdoc2md.js +33 -17
- package/package.json +1 -1
- package/skip-tests.json +2 -0
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
|
}
|
|
@@ -8605,11 +8725,13 @@ class Exchange {
|
|
|
8605
8725
|
}
|
|
8606
8726
|
}
|
|
8607
8727
|
if (!parseFee && (reducedLength === 0)) {
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8728
|
+
// copy fee to avoid modification by reference
|
|
8729
|
+
const feeCopy = this.deepExtend(fee);
|
|
8730
|
+
feeCopy['cost'] = this.safeNumber(feeCopy, 'cost');
|
|
8731
|
+
if ('rate' in feeCopy) {
|
|
8732
|
+
feeCopy['rate'] = this.safeNumber(feeCopy, 'rate');
|
|
8611
8733
|
}
|
|
8612
|
-
reducedFees.push(
|
|
8734
|
+
reducedFees.push(feeCopy);
|
|
8613
8735
|
}
|
|
8614
8736
|
order['fees'] = reducedFees;
|
|
8615
8737
|
if (parseFee && (reducedLength === 1)) {
|
|
@@ -8894,11 +9016,13 @@ class Exchange {
|
|
|
8894
9016
|
}
|
|
8895
9017
|
}
|
|
8896
9018
|
if (!parseFee && (reducedLength === 0)) {
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
9019
|
+
// copy fee to avoid modification by reference
|
|
9020
|
+
const feeCopy = this.deepExtend(fee);
|
|
9021
|
+
feeCopy['cost'] = this.safeNumber(feeCopy, 'cost');
|
|
9022
|
+
if ('rate' in feeCopy) {
|
|
9023
|
+
feeCopy['rate'] = this.safeNumber(feeCopy, 'rate');
|
|
8900
9024
|
}
|
|
8901
|
-
reducedFees.push(
|
|
9025
|
+
reducedFees.push(feeCopy);
|
|
8902
9026
|
}
|
|
8903
9027
|
if (parseFees) {
|
|
8904
9028
|
trade['fees'] = reducedFees;
|
|
@@ -9733,7 +9857,7 @@ class Exchange {
|
|
|
9733
9857
|
/**
|
|
9734
9858
|
* @method
|
|
9735
9859
|
* @name exchange#fetchPositionsForSymbol
|
|
9736
|
-
* @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
|
|
9860
|
+
* @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
|
|
9737
9861
|
* @param {string} symbol unified market symbol
|
|
9738
9862
|
* @param {object} params extra parameters specific to the endpoint
|
|
9739
9863
|
* @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
|
|
@@ -16739,6 +16863,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16739
16863
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
16740
16864
|
'capital/config/getall': 1,
|
|
16741
16865
|
'capital/deposit/address': 1,
|
|
16866
|
+
'capital/deposit/address/list': 1,
|
|
16742
16867
|
'capital/deposit/hisrec': 0.1,
|
|
16743
16868
|
'capital/deposit/subAddress': 0.1,
|
|
16744
16869
|
'capital/deposit/subHisrec': 0.1,
|
|
@@ -58612,10 +58737,10 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58612
58737
|
'CORS': undefined,
|
|
58613
58738
|
'spot': true,
|
|
58614
58739
|
'margin': false,
|
|
58615
|
-
'swap':
|
|
58616
|
-
'future':
|
|
58740
|
+
'swap': true,
|
|
58741
|
+
'future': false,
|
|
58617
58742
|
'option': false,
|
|
58618
|
-
'cancelAllOrders':
|
|
58743
|
+
'cancelAllOrders': true,
|
|
58619
58744
|
'cancelOrder': true,
|
|
58620
58745
|
'createOrder': true,
|
|
58621
58746
|
'createStopLimitOrder': true,
|
|
@@ -58654,9 +58779,11 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58654
58779
|
'fetchTradingFees': false,
|
|
58655
58780
|
'fetchTransactionFees': false,
|
|
58656
58781
|
'fetchTransactions': false,
|
|
58657
|
-
'fetchTransfers':
|
|
58782
|
+
'fetchTransfers': true,
|
|
58658
58783
|
'fetchWithdrawals': true,
|
|
58659
|
-
'
|
|
58784
|
+
'setLeverage': true,
|
|
58785
|
+
'setMargin': true,
|
|
58786
|
+
'transfer': true,
|
|
58660
58787
|
'withdraw': true,
|
|
58661
58788
|
},
|
|
58662
58789
|
'timeframes': {
|
|
@@ -58673,66 +58800,142 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58673
58800
|
'urls': {
|
|
58674
58801
|
'logo': 'https://user-images.githubusercontent.com/1294454/139516488-243a830d-05dd-446b-91c6-c1f18fe30c63.jpg',
|
|
58675
58802
|
'api': {
|
|
58676
|
-
'
|
|
58677
|
-
'
|
|
58803
|
+
'spot': 'https://www.bitrue.com/api',
|
|
58804
|
+
'fapi': 'https://fapi.bitrue.com/fapi',
|
|
58805
|
+
'dapi': 'https://fapi.bitrue.com/dapi',
|
|
58678
58806
|
'kline': 'https://www.bitrue.com/kline-api',
|
|
58679
58807
|
},
|
|
58680
58808
|
'www': 'https://www.bitrue.com',
|
|
58681
58809
|
'referral': 'https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE',
|
|
58682
58810
|
'doc': [
|
|
58683
58811
|
'https://github.com/Bitrue-exchange/bitrue-official-api-docs',
|
|
58812
|
+
'https://www.bitrue.com/api-docs',
|
|
58684
58813
|
],
|
|
58685
58814
|
'fees': 'https://bitrue.zendesk.com/hc/en-001/articles/4405479952537',
|
|
58686
58815
|
},
|
|
58687
58816
|
'api': {
|
|
58688
|
-
'
|
|
58689
|
-
'
|
|
58690
|
-
'
|
|
58691
|
-
'
|
|
58692
|
-
|
|
58817
|
+
'spot': {
|
|
58818
|
+
'kline': {
|
|
58819
|
+
'public': {
|
|
58820
|
+
'get': {
|
|
58821
|
+
'public.json': 1,
|
|
58822
|
+
'public{currency}.json': 1,
|
|
58823
|
+
},
|
|
58693
58824
|
},
|
|
58694
58825
|
},
|
|
58695
|
-
|
|
58696
|
-
|
|
58697
|
-
|
|
58698
|
-
|
|
58699
|
-
|
|
58700
|
-
|
|
58701
|
-
|
|
58702
|
-
|
|
58703
|
-
|
|
58704
|
-
|
|
58705
|
-
|
|
58706
|
-
|
|
58707
|
-
|
|
58708
|
-
|
|
58709
|
-
|
|
58826
|
+
'v1': {
|
|
58827
|
+
'public': {
|
|
58828
|
+
'get': {
|
|
58829
|
+
'ping': 1,
|
|
58830
|
+
'time': 1,
|
|
58831
|
+
'exchangeInfo': 1,
|
|
58832
|
+
'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10]] },
|
|
58833
|
+
'trades': 1,
|
|
58834
|
+
'historicalTrades': 5,
|
|
58835
|
+
'aggTrades': 1,
|
|
58836
|
+
'ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
|
|
58837
|
+
'ticker/price': { 'cost': 1, 'noSymbol': 2 },
|
|
58838
|
+
'ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 },
|
|
58839
|
+
'market/kline': 1,
|
|
58840
|
+
},
|
|
58841
|
+
},
|
|
58842
|
+
'private': {
|
|
58843
|
+
'get': {
|
|
58844
|
+
'order': 1,
|
|
58845
|
+
'openOrders': 1,
|
|
58846
|
+
'allOrders': 5,
|
|
58847
|
+
'account': 5,
|
|
58848
|
+
'myTrades': { 'cost': 5, 'noSymbol': 40 },
|
|
58849
|
+
'etf/net-value/{symbol}': 1,
|
|
58850
|
+
'withdraw/history': 1,
|
|
58851
|
+
'deposit/history': 1,
|
|
58852
|
+
},
|
|
58853
|
+
'post': {
|
|
58854
|
+
'order': 4,
|
|
58855
|
+
'withdraw/commit': 1,
|
|
58856
|
+
},
|
|
58857
|
+
'delete': {
|
|
58858
|
+
'order': 1,
|
|
58859
|
+
},
|
|
58710
58860
|
},
|
|
58711
58861
|
},
|
|
58712
|
-
'
|
|
58713
|
-
'
|
|
58714
|
-
'
|
|
58715
|
-
|
|
58716
|
-
|
|
58717
|
-
'account': 5,
|
|
58718
|
-
'myTrades': { 'cost': 5, 'noSymbol': 40 },
|
|
58719
|
-
'etf/net-value/{symbol}': 1,
|
|
58720
|
-
'withdraw/history': 1,
|
|
58721
|
-
'deposit/history': 1,
|
|
58862
|
+
'v2': {
|
|
58863
|
+
'private': {
|
|
58864
|
+
'get': {
|
|
58865
|
+
'myTrades': 5,
|
|
58866
|
+
},
|
|
58722
58867
|
},
|
|
58723
|
-
|
|
58724
|
-
|
|
58725
|
-
|
|
58868
|
+
},
|
|
58869
|
+
},
|
|
58870
|
+
'fapi': {
|
|
58871
|
+
'v1': {
|
|
58872
|
+
'public': {
|
|
58873
|
+
'get': {
|
|
58874
|
+
'ping': 1,
|
|
58875
|
+
'time': 1,
|
|
58876
|
+
'contracts': 1,
|
|
58877
|
+
'depth': 1,
|
|
58878
|
+
'ticker': 1,
|
|
58879
|
+
'klines': 1,
|
|
58880
|
+
},
|
|
58726
58881
|
},
|
|
58727
|
-
|
|
58728
|
-
|
|
58882
|
+
},
|
|
58883
|
+
'v2': {
|
|
58884
|
+
'private': {
|
|
58885
|
+
'get': {
|
|
58886
|
+
'myTrades': 1,
|
|
58887
|
+
'openOrders': 1,
|
|
58888
|
+
'order': 1,
|
|
58889
|
+
'account': 1,
|
|
58890
|
+
'leverageBracket': 1,
|
|
58891
|
+
'commissionRate': 1,
|
|
58892
|
+
'futures_transfer_history': 1,
|
|
58893
|
+
'forceOrdersHistory': 1,
|
|
58894
|
+
},
|
|
58895
|
+
'post': {
|
|
58896
|
+
'positionMargin': 1,
|
|
58897
|
+
'level_edit': 1,
|
|
58898
|
+
'cancel': 1,
|
|
58899
|
+
'order': 1,
|
|
58900
|
+
'allOpenOrders': 1,
|
|
58901
|
+
'futures_transfer': 1,
|
|
58902
|
+
},
|
|
58729
58903
|
},
|
|
58730
58904
|
},
|
|
58731
58905
|
},
|
|
58732
|
-
'
|
|
58733
|
-
'
|
|
58734
|
-
'
|
|
58735
|
-
'
|
|
58906
|
+
'dapi': {
|
|
58907
|
+
'v1': {
|
|
58908
|
+
'public': {
|
|
58909
|
+
'get': {
|
|
58910
|
+
'ping': 1,
|
|
58911
|
+
'time': 1,
|
|
58912
|
+
'contracts': 1,
|
|
58913
|
+
'depth': 1,
|
|
58914
|
+
'ticker': 1,
|
|
58915
|
+
'klines': 1,
|
|
58916
|
+
},
|
|
58917
|
+
},
|
|
58918
|
+
},
|
|
58919
|
+
'v2': {
|
|
58920
|
+
'private': {
|
|
58921
|
+
'get': {
|
|
58922
|
+
'myTrades': 1,
|
|
58923
|
+
'openOrders': 1,
|
|
58924
|
+
'order': 1,
|
|
58925
|
+
'account': 1,
|
|
58926
|
+
'leverageBracket': 1,
|
|
58927
|
+
'commissionRate': 1,
|
|
58928
|
+
'futures_transfer_history': 1,
|
|
58929
|
+
'forceOrdersHistory': 1,
|
|
58930
|
+
},
|
|
58931
|
+
'post': {
|
|
58932
|
+
'positionMargin': 1,
|
|
58933
|
+
'level_edit': 1,
|
|
58934
|
+
'cancel': 1,
|
|
58935
|
+
'order': 1,
|
|
58936
|
+
'allOpenOrders': 1,
|
|
58937
|
+
'futures_transfer': 1,
|
|
58938
|
+
},
|
|
58736
58939
|
},
|
|
58737
58940
|
},
|
|
58738
58941
|
},
|
|
@@ -58818,6 +59021,12 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58818
59021
|
},
|
|
58819
59022
|
// exchange-specific options
|
|
58820
59023
|
'options': {
|
|
59024
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
59025
|
+
'fetchMarkets': [
|
|
59026
|
+
'spot',
|
|
59027
|
+
'linear',
|
|
59028
|
+
'inverse',
|
|
59029
|
+
],
|
|
58821
59030
|
// 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades
|
|
58822
59031
|
'fetchMyTradesMethod': 'v2PrivateGetMyTrades',
|
|
58823
59032
|
'hasAlreadyAuthenticatedSuccessfully': false,
|
|
@@ -58833,6 +59042,39 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58833
59042
|
'ERC20': 'ETH',
|
|
58834
59043
|
'TRC20': 'TRX',
|
|
58835
59044
|
},
|
|
59045
|
+
'defaultType': 'spot',
|
|
59046
|
+
'timeframes': {
|
|
59047
|
+
'spot': {
|
|
59048
|
+
'1m': '1m',
|
|
59049
|
+
'5m': '5m',
|
|
59050
|
+
'15m': '15m',
|
|
59051
|
+
'30m': '30m',
|
|
59052
|
+
'1h': '1H',
|
|
59053
|
+
'2h': '2H',
|
|
59054
|
+
'4h': '4H',
|
|
59055
|
+
'12h': '12H',
|
|
59056
|
+
'1d': '1D',
|
|
59057
|
+
'1w': '1W',
|
|
59058
|
+
},
|
|
59059
|
+
'future': {
|
|
59060
|
+
'1m': '1min',
|
|
59061
|
+
'5m': '5min',
|
|
59062
|
+
'15m': '15min',
|
|
59063
|
+
'30m': '30min',
|
|
59064
|
+
'1h': '1h',
|
|
59065
|
+
'1d': '1day',
|
|
59066
|
+
'1w': '1week',
|
|
59067
|
+
'1M': '1month',
|
|
59068
|
+
},
|
|
59069
|
+
},
|
|
59070
|
+
'accountsByType': {
|
|
59071
|
+
'spot': 'wallet',
|
|
59072
|
+
'future': 'contract',
|
|
59073
|
+
'swap': 'contract',
|
|
59074
|
+
'funding': 'wallet',
|
|
59075
|
+
'fund': 'wallet',
|
|
59076
|
+
'contract': 'contract',
|
|
59077
|
+
},
|
|
58836
59078
|
},
|
|
58837
59079
|
'commonCurrencies': {
|
|
58838
59080
|
'MIM': 'MIM Swarm',
|
|
@@ -58876,6 +59118,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58876
59118
|
'-1115': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58877
59119
|
'-1116': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58878
59120
|
'-1117': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
59121
|
+
'-1166': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
|
|
58879
59122
|
'-1118': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58880
59123
|
'-1119': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58881
59124
|
'-1120': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
@@ -58885,12 +59128,15 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58885
59128
|
'-1128': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58886
59129
|
'-1130': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
58887
59130
|
'-1131': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
59131
|
+
'-1160': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
|
|
59132
|
+
'-1156': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
|
|
58888
59133
|
'-2008': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
58889
59134
|
'-2010': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
58890
59135
|
'-2011': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
58891
59136
|
'-2013': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
58892
59137
|
'-2014': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
58893
59138
|
'-2015': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
59139
|
+
'-2017': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
58894
59140
|
'-2019': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
58895
59141
|
'-3005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
58896
59142
|
'-3006': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
@@ -58912,9 +59158,6 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58912
59158
|
},
|
|
58913
59159
|
});
|
|
58914
59160
|
}
|
|
58915
|
-
costToPrecision(symbol, cost) {
|
|
58916
|
-
return this.decimalToPrecision(cost, _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TRUNCATE */ .tk, this.markets[symbol]['precision']['quote'], this.precisionMode, this.paddingMode);
|
|
58917
|
-
}
|
|
58918
59161
|
currencyToPrecision(code, fee, networkCode = undefined) {
|
|
58919
59162
|
// info is available in currencies only if the user has configured his api keys
|
|
58920
59163
|
if (this.safeValue(this.currencies[code], 'precision') !== undefined) {
|
|
@@ -58932,10 +59175,11 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58932
59175
|
* @method
|
|
58933
59176
|
* @name bitrue#fetchStatus
|
|
58934
59177
|
* @description the latest known information on the availability of the exchange API
|
|
59178
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#test-connectivity
|
|
58935
59179
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
58936
59180
|
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
58937
59181
|
*/
|
|
58938
|
-
const response = await this.
|
|
59182
|
+
const response = await this.spotV1PublicGetPing(params);
|
|
58939
59183
|
//
|
|
58940
59184
|
// empty means working status.
|
|
58941
59185
|
//
|
|
@@ -58957,10 +59201,11 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58957
59201
|
* @method
|
|
58958
59202
|
* @name bitrue#fetchTime
|
|
58959
59203
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
59204
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#check-server-time
|
|
58960
59205
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
58961
59206
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
58962
59207
|
*/
|
|
58963
|
-
const response = await this.
|
|
59208
|
+
const response = await this.spotV1PublicGetTime(params);
|
|
58964
59209
|
//
|
|
58965
59210
|
// {
|
|
58966
59211
|
// "serverTime":1635467280514
|
|
@@ -59047,7 +59292,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59047
59292
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59048
59293
|
* @returns {object} an associative dictionary of currencies
|
|
59049
59294
|
*/
|
|
59050
|
-
const response = await this.
|
|
59295
|
+
const response = await this.spotV1PublicGetExchangeInfo(params);
|
|
59051
59296
|
//
|
|
59052
59297
|
// {
|
|
59053
59298
|
// "timezone":"CTT",
|
|
@@ -59172,10 +59417,38 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59172
59417
|
* @method
|
|
59173
59418
|
* @name bitrue#fetchMarkets
|
|
59174
59419
|
* @description retrieves data on all markets for bitrue
|
|
59420
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#exchangeInfo_endpoint
|
|
59421
|
+
* @see https://www.bitrue.com/api-docs#current-open-contract
|
|
59422
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#current-open-contract
|
|
59175
59423
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
59176
59424
|
* @returns {object[]} an array of objects representing market data
|
|
59177
59425
|
*/
|
|
59178
|
-
const
|
|
59426
|
+
const promisesRaw = [];
|
|
59427
|
+
const fetchMarkets = this.safeValue(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
|
|
59428
|
+
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
59429
|
+
const marketType = fetchMarkets[i];
|
|
59430
|
+
if (marketType === 'spot') {
|
|
59431
|
+
promisesRaw.push(this.spotV1PublicGetExchangeInfo(params));
|
|
59432
|
+
}
|
|
59433
|
+
else if (marketType === 'linear') {
|
|
59434
|
+
promisesRaw.push(this.fapiV1PublicGetContracts(params));
|
|
59435
|
+
}
|
|
59436
|
+
else if (marketType === 'inverse') {
|
|
59437
|
+
promisesRaw.push(this.dapiV1PublicGetContracts(params));
|
|
59438
|
+
}
|
|
59439
|
+
else {
|
|
59440
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchMarkets() this.options fetchMarkets "' + marketType + '" is not a supported market type');
|
|
59441
|
+
}
|
|
59442
|
+
}
|
|
59443
|
+
const promises = await Promise.all(promisesRaw);
|
|
59444
|
+
const spotMarkets = this.safeValue(this.safeValue(promises, 0), 'symbols', []);
|
|
59445
|
+
const futureMarkets = this.safeValue(promises, 1);
|
|
59446
|
+
const deliveryMarkets = this.safeValue(promises, 2);
|
|
59447
|
+
let markets = spotMarkets;
|
|
59448
|
+
markets = this.arrayConcat(markets, futureMarkets);
|
|
59449
|
+
markets = this.arrayConcat(markets, deliveryMarkets);
|
|
59450
|
+
//
|
|
59451
|
+
// spot
|
|
59179
59452
|
//
|
|
59180
59453
|
// {
|
|
59181
59454
|
// "timezone":"CTT",
|
|
@@ -59217,19 +59490,70 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59217
59490
|
// ],
|
|
59218
59491
|
// }
|
|
59219
59492
|
//
|
|
59493
|
+
// swap / delivery
|
|
59494
|
+
//
|
|
59495
|
+
// [
|
|
59496
|
+
// {
|
|
59497
|
+
// "symbol": "H-HT-USDT",
|
|
59498
|
+
// "pricePrecision": 8,
|
|
59499
|
+
// "side": 1,
|
|
59500
|
+
// "maxMarketVolume": 100000,
|
|
59501
|
+
// "multiplier": 6,
|
|
59502
|
+
// "minOrderVolume": 1,
|
|
59503
|
+
// "maxMarketMoney": 10000000,
|
|
59504
|
+
// "type": "H", // E: perpetual contract, S: test contract, others are mixed contract
|
|
59505
|
+
// "maxLimitVolume": 1000000,
|
|
59506
|
+
// "maxValidOrder": 20,
|
|
59507
|
+
// "multiplierCoin": "HT",
|
|
59508
|
+
// "minOrderMoney": 0.001,
|
|
59509
|
+
// "maxLimitMoney": 1000000,
|
|
59510
|
+
// "status": 1
|
|
59511
|
+
// }
|
|
59512
|
+
// ]
|
|
59513
|
+
//
|
|
59220
59514
|
if (this.options['adjustForTimeDifference']) {
|
|
59221
59515
|
await this.loadTimeDifference();
|
|
59222
59516
|
}
|
|
59223
|
-
const markets = this.safeValue(response, 'symbols', []);
|
|
59224
59517
|
return this.parseMarkets(markets);
|
|
59225
59518
|
}
|
|
59226
59519
|
parseMarket(market) {
|
|
59227
59520
|
const id = this.safeString(market, 'symbol');
|
|
59228
59521
|
const lowercaseId = this.safeStringLower(market, 'symbol');
|
|
59229
|
-
const
|
|
59230
|
-
|
|
59522
|
+
const side = this.safeInteger(market, 'side'); // 1 linear, 0 inverse, undefined spot
|
|
59523
|
+
let type = undefined;
|
|
59524
|
+
let isLinear = undefined;
|
|
59525
|
+
let isInverse = undefined;
|
|
59526
|
+
if (side === undefined) {
|
|
59527
|
+
type = 'spot';
|
|
59528
|
+
}
|
|
59529
|
+
else {
|
|
59530
|
+
type = 'swap';
|
|
59531
|
+
isLinear = (side === 1);
|
|
59532
|
+
isInverse = (side === 0);
|
|
59533
|
+
}
|
|
59534
|
+
const isContract = (type !== 'spot');
|
|
59535
|
+
let baseId = this.safeString(market, 'baseAsset');
|
|
59536
|
+
let quoteId = this.safeString(market, 'quoteAsset');
|
|
59537
|
+
let settleId = undefined;
|
|
59538
|
+
let settle = undefined;
|
|
59539
|
+
if (isContract) {
|
|
59540
|
+
const symbolSplit = id.split('-');
|
|
59541
|
+
baseId = this.safeString(symbolSplit, 1);
|
|
59542
|
+
quoteId = this.safeString(symbolSplit, 2);
|
|
59543
|
+
if (isLinear) {
|
|
59544
|
+
settleId = quoteId;
|
|
59545
|
+
}
|
|
59546
|
+
else {
|
|
59547
|
+
settleId = baseId;
|
|
59548
|
+
}
|
|
59549
|
+
settle = this.safeCurrencyCode(settleId);
|
|
59550
|
+
}
|
|
59231
59551
|
const base = this.safeCurrencyCode(baseId);
|
|
59232
59552
|
const quote = this.safeCurrencyCode(quoteId);
|
|
59553
|
+
let symbol = base + '/' + quote;
|
|
59554
|
+
if (settle !== undefined) {
|
|
59555
|
+
symbol += ':' + settle;
|
|
59556
|
+
}
|
|
59233
59557
|
const filters = this.safeValue(market, 'filters', []);
|
|
59234
59558
|
const filtersByType = this.indexBy(filters, 'filterType');
|
|
59235
59559
|
const status = this.safeString(market, 'status');
|
|
@@ -59239,27 +59563,36 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59239
59563
|
const defaultAmountPrecision = this.safeString(market, 'quantityPrecision');
|
|
59240
59564
|
const pricePrecision = this.safeString(priceFilter, 'priceScale', defaultPricePrecision);
|
|
59241
59565
|
const amountPrecision = this.safeString(amountFilter, 'volumeScale', defaultAmountPrecision);
|
|
59566
|
+
const multiplier = this.safeString(market, 'multiplier');
|
|
59567
|
+
let maxQuantity = this.safeNumber(amountFilter, 'maxQty');
|
|
59568
|
+
if (maxQuantity === undefined) {
|
|
59569
|
+
maxQuantity = this.safeNumber(market, 'maxValidOrder');
|
|
59570
|
+
}
|
|
59571
|
+
let minCost = this.safeNumber(amountFilter, 'minVal');
|
|
59572
|
+
if (minCost === undefined) {
|
|
59573
|
+
minCost = this.safeNumber(market, 'minOrderMoney');
|
|
59574
|
+
}
|
|
59242
59575
|
return {
|
|
59243
59576
|
'id': id,
|
|
59244
59577
|
'lowercaseId': lowercaseId,
|
|
59245
|
-
'symbol':
|
|
59578
|
+
'symbol': symbol,
|
|
59246
59579
|
'base': base,
|
|
59247
59580
|
'quote': quote,
|
|
59248
|
-
'settle':
|
|
59581
|
+
'settle': settle,
|
|
59249
59582
|
'baseId': baseId,
|
|
59250
59583
|
'quoteId': quoteId,
|
|
59251
|
-
'settleId':
|
|
59252
|
-
'type':
|
|
59253
|
-
'spot':
|
|
59584
|
+
'settleId': settleId,
|
|
59585
|
+
'type': type,
|
|
59586
|
+
'spot': (type === 'spot'),
|
|
59254
59587
|
'margin': false,
|
|
59255
|
-
'swap':
|
|
59588
|
+
'swap': isContract,
|
|
59256
59589
|
'future': false,
|
|
59257
59590
|
'option': false,
|
|
59258
59591
|
'active': (status === 'TRADING'),
|
|
59259
|
-
'contract':
|
|
59260
|
-
'linear':
|
|
59261
|
-
'inverse':
|
|
59262
|
-
'contractSize':
|
|
59592
|
+
'contract': isContract,
|
|
59593
|
+
'linear': isLinear,
|
|
59594
|
+
'inverse': isInverse,
|
|
59595
|
+
'contractSize': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(multiplier)),
|
|
59263
59596
|
'expiry': undefined,
|
|
59264
59597
|
'expiryDatetime': undefined,
|
|
59265
59598
|
'strike': undefined,
|
|
@@ -59275,14 +59608,14 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59275
59608
|
},
|
|
59276
59609
|
'amount': {
|
|
59277
59610
|
'min': this.safeNumber(amountFilter, 'minQty'),
|
|
59278
|
-
'max':
|
|
59611
|
+
'max': maxQuantity,
|
|
59279
59612
|
},
|
|
59280
59613
|
'price': {
|
|
59281
59614
|
'min': this.safeNumber(priceFilter, 'minPrice'),
|
|
59282
59615
|
'max': this.safeNumber(priceFilter, 'maxPrice'),
|
|
59283
59616
|
},
|
|
59284
59617
|
'cost': {
|
|
59285
|
-
'min':
|
|
59618
|
+
'min': minCost,
|
|
59286
59619
|
'max': undefined,
|
|
59287
59620
|
},
|
|
59288
59621
|
},
|
|
@@ -59291,18 +59624,64 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59291
59624
|
};
|
|
59292
59625
|
}
|
|
59293
59626
|
parseBalance(response) {
|
|
59627
|
+
//
|
|
59628
|
+
// spot
|
|
59629
|
+
//
|
|
59630
|
+
// {
|
|
59631
|
+
// "makerCommission":0,
|
|
59632
|
+
// "takerCommission":0,
|
|
59633
|
+
// "buyerCommission":0,
|
|
59634
|
+
// "sellerCommission":0,
|
|
59635
|
+
// "updateTime":null,
|
|
59636
|
+
// "balances":[
|
|
59637
|
+
// {"asset":"sbr","free":"0","locked":"0"},
|
|
59638
|
+
// {"asset":"ksm","free":"0","locked":"0"},
|
|
59639
|
+
// {"asset":"neo3s","free":"0","locked":"0"},
|
|
59640
|
+
// ],
|
|
59641
|
+
// "canTrade":false,
|
|
59642
|
+
// "canWithdraw":false,
|
|
59643
|
+
// "canDeposit":false
|
|
59644
|
+
// }
|
|
59645
|
+
//
|
|
59646
|
+
// swap
|
|
59647
|
+
//
|
|
59648
|
+
// {
|
|
59649
|
+
// "account":[
|
|
59650
|
+
// {
|
|
59651
|
+
// "marginCoin":"USDT",
|
|
59652
|
+
// "coinPrecious":4,
|
|
59653
|
+
// "accountNormal":1010.4043400372839856,
|
|
59654
|
+
// "accountLock":2.9827889600000006,
|
|
59655
|
+
// "partPositionNormal":0,
|
|
59656
|
+
// "totalPositionNormal":0,
|
|
59657
|
+
// "achievedAmount":0,
|
|
59658
|
+
// "unrealizedAmount":0,
|
|
59659
|
+
// "totalMarginRate":0,
|
|
59660
|
+
// "totalEquity":1010.4043400372839856,
|
|
59661
|
+
// "partEquity":0,
|
|
59662
|
+
// "totalCost":0,
|
|
59663
|
+
// "sumMarginRate":0,
|
|
59664
|
+
// "sumOpenRealizedAmount":0,
|
|
59665
|
+
// "canUseTrialFund":0,
|
|
59666
|
+
// "sumMaintenanceMargin":null,
|
|
59667
|
+
// "futureModel":null,
|
|
59668
|
+
// "positionVos":[]
|
|
59669
|
+
// }
|
|
59670
|
+
// ]
|
|
59671
|
+
// }
|
|
59672
|
+
//
|
|
59294
59673
|
const result = {
|
|
59295
59674
|
'info': response,
|
|
59296
59675
|
};
|
|
59297
59676
|
const timestamp = this.safeInteger(response, 'updateTime');
|
|
59298
|
-
const balances = this.
|
|
59677
|
+
const balances = this.safeValue2(response, 'balances', 'account', []);
|
|
59299
59678
|
for (let i = 0; i < balances.length; i++) {
|
|
59300
59679
|
const balance = balances[i];
|
|
59301
|
-
const currencyId = this.
|
|
59680
|
+
const currencyId = this.safeString2(balance, 'asset', 'marginCoin');
|
|
59302
59681
|
const code = this.safeCurrencyCode(currencyId);
|
|
59303
59682
|
const account = this.account();
|
|
59304
|
-
account['free'] = this.
|
|
59305
|
-
account['used'] = this.
|
|
59683
|
+
account['free'] = this.safeString2(balance, 'free', 'accountNormal');
|
|
59684
|
+
account['used'] = this.safeString2(balance, 'locked', 'accountLock');
|
|
59306
59685
|
result[code] = account;
|
|
59307
59686
|
}
|
|
59308
59687
|
result['timestamp'] = timestamp;
|
|
@@ -59314,35 +59693,122 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59314
59693
|
* @method
|
|
59315
59694
|
* @name bitrue#fetchBalance
|
|
59316
59695
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
59696
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#account-information-user_data
|
|
59697
|
+
* @see https://www.bitrue.com/api-docs#account-information-v2-user_data-hmac-sha256
|
|
59698
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#account-information-v2-user_data-hmac-sha256
|
|
59317
59699
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59700
|
+
* @param {string} [params.type] 'future', 'delivery', 'spot', 'swap'
|
|
59701
|
+
* @param {string} [params.subType] 'linear', 'inverse'
|
|
59318
59702
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
59319
59703
|
*/
|
|
59320
59704
|
await this.loadMarkets();
|
|
59321
|
-
|
|
59322
|
-
|
|
59323
|
-
|
|
59324
|
-
|
|
59325
|
-
|
|
59326
|
-
|
|
59327
|
-
|
|
59328
|
-
|
|
59329
|
-
|
|
59330
|
-
|
|
59331
|
-
|
|
59332
|
-
|
|
59333
|
-
|
|
59334
|
-
|
|
59335
|
-
|
|
59336
|
-
|
|
59337
|
-
|
|
59338
|
-
|
|
59339
|
-
|
|
59705
|
+
let type = undefined;
|
|
59706
|
+
[type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
59707
|
+
let subType = undefined;
|
|
59708
|
+
[subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
|
|
59709
|
+
let response = undefined;
|
|
59710
|
+
let result = undefined;
|
|
59711
|
+
if (type === 'swap') {
|
|
59712
|
+
if (subType !== undefined && subType === 'inverse') {
|
|
59713
|
+
response = await this.dapiV2PrivateGetAccount(params);
|
|
59714
|
+
result = this.safeValue(response, 'data', {});
|
|
59715
|
+
//
|
|
59716
|
+
// {
|
|
59717
|
+
// "code":"0",
|
|
59718
|
+
// "msg":"Success",
|
|
59719
|
+
// "data":{
|
|
59720
|
+
// "account":[
|
|
59721
|
+
// {
|
|
59722
|
+
// "marginCoin":"USD",
|
|
59723
|
+
// "coinPrecious":4,
|
|
59724
|
+
// "accountNormal":1010.4043400372839856,
|
|
59725
|
+
// "accountLock":2.9827889600000006,
|
|
59726
|
+
// "partPositionNormal":0,
|
|
59727
|
+
// "totalPositionNormal":0,
|
|
59728
|
+
// "achievedAmount":0,
|
|
59729
|
+
// "unrealizedAmount":0,
|
|
59730
|
+
// "totalMarginRate":0,
|
|
59731
|
+
// "totalEquity":1010.4043400372839856,
|
|
59732
|
+
// "partEquity":0,
|
|
59733
|
+
// "totalCost":0,
|
|
59734
|
+
// "sumMarginRate":0,
|
|
59735
|
+
// "sumOpenRealizedAmount":0,
|
|
59736
|
+
// "canUseTrialFund":0,
|
|
59737
|
+
// "sumMaintenanceMargin":null,
|
|
59738
|
+
// "futureModel":null,
|
|
59739
|
+
// "positionVos":[]
|
|
59740
|
+
// }
|
|
59741
|
+
// ]
|
|
59742
|
+
// }
|
|
59743
|
+
// }
|
|
59744
|
+
//
|
|
59745
|
+
}
|
|
59746
|
+
else {
|
|
59747
|
+
response = await this.fapiV2PrivateGetAccount(params);
|
|
59748
|
+
result = this.safeValue(response, 'data', {});
|
|
59749
|
+
//
|
|
59750
|
+
// {
|
|
59751
|
+
// "code":"0",
|
|
59752
|
+
// "msg":"Success",
|
|
59753
|
+
// "data":{
|
|
59754
|
+
// "account":[
|
|
59755
|
+
// {
|
|
59756
|
+
// "marginCoin":"USDT",
|
|
59757
|
+
// "coinPrecious":4,
|
|
59758
|
+
// "accountNormal":1010.4043400372839856,
|
|
59759
|
+
// "accountLock":2.9827889600000006,
|
|
59760
|
+
// "partPositionNormal":0,
|
|
59761
|
+
// "totalPositionNormal":0,
|
|
59762
|
+
// "achievedAmount":0,
|
|
59763
|
+
// "unrealizedAmount":0,
|
|
59764
|
+
// "totalMarginRate":0,
|
|
59765
|
+
// "totalEquity":1010.4043400372839856,
|
|
59766
|
+
// "partEquity":0,
|
|
59767
|
+
// "totalCost":0,
|
|
59768
|
+
// "sumMarginRate":0,
|
|
59769
|
+
// "sumOpenRealizedAmount":0,
|
|
59770
|
+
// "canUseTrialFund":0,
|
|
59771
|
+
// "sumMaintenanceMargin":null,
|
|
59772
|
+
// "futureModel":null,
|
|
59773
|
+
// "positionVos":[]
|
|
59774
|
+
// }
|
|
59775
|
+
// ]
|
|
59776
|
+
// }
|
|
59777
|
+
// }
|
|
59778
|
+
//
|
|
59779
|
+
}
|
|
59780
|
+
}
|
|
59781
|
+
else {
|
|
59782
|
+
response = await this.spotV1PrivateGetAccount(params);
|
|
59783
|
+
result = response;
|
|
59784
|
+
//
|
|
59785
|
+
// {
|
|
59786
|
+
// "makerCommission":0,
|
|
59787
|
+
// "takerCommission":0,
|
|
59788
|
+
// "buyerCommission":0,
|
|
59789
|
+
// "sellerCommission":0,
|
|
59790
|
+
// "updateTime":null,
|
|
59791
|
+
// "balances":[
|
|
59792
|
+
// {"asset":"sbr","free":"0","locked":"0"},
|
|
59793
|
+
// {"asset":"ksm","free":"0","locked":"0"},
|
|
59794
|
+
// {"asset":"neo3s","free":"0","locked":"0"},
|
|
59795
|
+
// ],
|
|
59796
|
+
// "canTrade":false,
|
|
59797
|
+
// "canWithdraw":false,
|
|
59798
|
+
// "canDeposit":false
|
|
59799
|
+
// }
|
|
59800
|
+
//
|
|
59801
|
+
}
|
|
59802
|
+
return this.parseBalance(result);
|
|
59340
59803
|
}
|
|
59341
59804
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
59342
59805
|
/**
|
|
59343
59806
|
* @method
|
|
59344
59807
|
* @name bitrue#fetchOrderBook
|
|
59345
59808
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
59809
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#order-book
|
|
59810
|
+
* @see https://www.bitrue.com/api-docs#order-book
|
|
59811
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#order-book
|
|
59346
59812
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
59347
59813
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
59348
59814
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
@@ -59350,13 +59816,41 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59350
59816
|
*/
|
|
59351
59817
|
await this.loadMarkets();
|
|
59352
59818
|
const market = this.market(symbol);
|
|
59353
|
-
|
|
59354
|
-
|
|
59355
|
-
|
|
59356
|
-
|
|
59357
|
-
|
|
59819
|
+
let response = undefined;
|
|
59820
|
+
if (market['swap']) {
|
|
59821
|
+
const request = {
|
|
59822
|
+
'contractName': market['id'],
|
|
59823
|
+
};
|
|
59824
|
+
if (limit !== undefined) {
|
|
59825
|
+
if (limit > 100) {
|
|
59826
|
+
limit = 100;
|
|
59827
|
+
}
|
|
59828
|
+
request['limit'] = limit; // default 100, max 100, see https://www.bitrue.com/api-docs#order-book
|
|
59829
|
+
}
|
|
59830
|
+
if (market['linear']) {
|
|
59831
|
+
response = await this.fapiV1PublicGetDepth(this.extend(request, params));
|
|
59832
|
+
}
|
|
59833
|
+
else if (market['inverse']) {
|
|
59834
|
+
response = await this.dapiV1PublicGetDepth(this.extend(request, params));
|
|
59835
|
+
}
|
|
59836
|
+
}
|
|
59837
|
+
else if (market['spot']) {
|
|
59838
|
+
const request = {
|
|
59839
|
+
'symbol': market['id'],
|
|
59840
|
+
};
|
|
59841
|
+
if (limit !== undefined) {
|
|
59842
|
+
if (limit > 1000) {
|
|
59843
|
+
limit = 1000;
|
|
59844
|
+
}
|
|
59845
|
+
request['limit'] = limit; // default 100, max 1000, see https://github.com/Bitrue-exchange/bitrue-official-api-docs#order-book
|
|
59846
|
+
}
|
|
59847
|
+
response = await this.spotV1PublicGetDepth(this.extend(request, params));
|
|
59848
|
+
}
|
|
59849
|
+
else {
|
|
59850
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderBook only support spot & swap markets');
|
|
59358
59851
|
}
|
|
59359
|
-
|
|
59852
|
+
//
|
|
59853
|
+
// spot
|
|
59360
59854
|
//
|
|
59361
59855
|
// {
|
|
59362
59856
|
// "lastUpdateId":1635474910177,
|
|
@@ -59372,7 +59866,16 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59372
59866
|
// ]
|
|
59373
59867
|
// }
|
|
59374
59868
|
//
|
|
59375
|
-
|
|
59869
|
+
// swap
|
|
59870
|
+
//
|
|
59871
|
+
// {
|
|
59872
|
+
// "asks": [[34916.5, 2582], [34916.6, 2193], [34916.7, 2629], [34916.8, 3478], [34916.9, 2718]],
|
|
59873
|
+
// "bids": [[34916.4, 92065], [34916.3, 25703], [34916.2, 37259], [34916.1, 26446], [34916, 44456]],
|
|
59874
|
+
// "time": 1699338305000
|
|
59875
|
+
// }
|
|
59876
|
+
//
|
|
59877
|
+
const timestamp = this.safeInteger(response, 'time');
|
|
59878
|
+
const orderbook = this.parseOrderBook(response, symbol, timestamp);
|
|
59376
59879
|
orderbook['nonce'] = this.safeInteger(response, 'lastUpdateId');
|
|
59377
59880
|
return orderbook;
|
|
59378
59881
|
}
|
|
@@ -59391,39 +59894,56 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59391
59894
|
// fetchTicker
|
|
59392
59895
|
//
|
|
59393
59896
|
// {
|
|
59394
|
-
// "
|
|
59395
|
-
// "
|
|
59396
|
-
// "
|
|
59397
|
-
// "
|
|
59398
|
-
// "
|
|
59399
|
-
// "
|
|
59400
|
-
// "
|
|
59401
|
-
// "
|
|
59402
|
-
// "
|
|
59403
|
-
// "
|
|
59897
|
+
// "symbol": "BNBBTC",
|
|
59898
|
+
// "priceChange": "0.000248",
|
|
59899
|
+
// "priceChangePercent": "3.5500",
|
|
59900
|
+
// "weightedAvgPrice": null,
|
|
59901
|
+
// "prevClosePrice": null,
|
|
59902
|
+
// "lastPrice": "0.007226",
|
|
59903
|
+
// "lastQty": null,
|
|
59904
|
+
// "bidPrice": "0.007208",
|
|
59905
|
+
// "askPrice": "0.007240",
|
|
59906
|
+
// "openPrice": "0.006978",
|
|
59907
|
+
// "highPrice": "0.007295",
|
|
59908
|
+
// "lowPrice": "0.006935",
|
|
59909
|
+
// "volume": "11749.86",
|
|
59910
|
+
// "quoteVolume": "84.1066211",
|
|
59911
|
+
// "openTime": 0,
|
|
59912
|
+
// "closeTime": 0,
|
|
59913
|
+
// "firstId": 0,
|
|
59914
|
+
// "lastId": 0,
|
|
59915
|
+
// "count": 0
|
|
59404
59916
|
// }
|
|
59405
59917
|
//
|
|
59406
59918
|
const symbol = this.safeSymbol(undefined, market);
|
|
59407
|
-
const last = this.
|
|
59919
|
+
const last = this.safeString2(ticker, 'lastPrice', 'last');
|
|
59920
|
+
const timestamp = this.safeInteger(ticker, 'time');
|
|
59921
|
+
let percentage = undefined;
|
|
59922
|
+
if (market['swap']) {
|
|
59923
|
+
percentage = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(this.safeString(ticker, 'rose'), '100');
|
|
59924
|
+
}
|
|
59925
|
+
else {
|
|
59926
|
+
percentage = this.safeString(ticker, 'priceChangePercent');
|
|
59927
|
+
}
|
|
59408
59928
|
return this.safeTicker({
|
|
59409
59929
|
'symbol': symbol,
|
|
59410
|
-
'timestamp':
|
|
59411
|
-
'datetime':
|
|
59412
|
-
'high': this.
|
|
59413
|
-
'low': this.
|
|
59414
|
-
'bid': this.safeString2(ticker, '
|
|
59930
|
+
'timestamp': timestamp,
|
|
59931
|
+
'datetime': this.iso8601(timestamp),
|
|
59932
|
+
'high': this.safeString2(ticker, 'highPrice', 'high'),
|
|
59933
|
+
'low': this.safeString2(ticker, 'lowPrice', 'low'),
|
|
59934
|
+
'bid': this.safeString2(ticker, 'bidPrice', 'buy'),
|
|
59415
59935
|
'bidVolume': this.safeString(ticker, 'bidQty'),
|
|
59416
|
-
'ask': this.safeString2(ticker, '
|
|
59936
|
+
'ask': this.safeString2(ticker, 'askPrice', 'sell'),
|
|
59417
59937
|
'askVolume': this.safeString(ticker, 'askQty'),
|
|
59418
|
-
'vwap':
|
|
59419
|
-
'open':
|
|
59938
|
+
'vwap': this.safeString(ticker, 'weightedAvgPrice'),
|
|
59939
|
+
'open': this.safeString(ticker, 'openPrice'),
|
|
59420
59940
|
'close': last,
|
|
59421
59941
|
'last': last,
|
|
59422
59942
|
'previousClose': undefined,
|
|
59423
|
-
'change':
|
|
59424
|
-
'percentage':
|
|
59943
|
+
'change': this.safeString(ticker, 'priceChange'),
|
|
59944
|
+
'percentage': percentage,
|
|
59425
59945
|
'average': undefined,
|
|
59426
|
-
'baseVolume': this.
|
|
59946
|
+
'baseVolume': this.safeString2(ticker, 'volume', 'vol'),
|
|
59427
59947
|
'quoteVolume': this.safeString(ticker, 'quoteVolume'),
|
|
59428
59948
|
'info': ticker,
|
|
59429
59949
|
}, market);
|
|
@@ -59433,52 +59953,87 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59433
59953
|
* @method
|
|
59434
59954
|
* @name bitrue#fetchTicker
|
|
59435
59955
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
59956
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#24hr-ticker-price-change-statistics
|
|
59957
|
+
* @see https://www.bitrue.com/api-docs#ticker
|
|
59958
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker
|
|
59436
59959
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
59437
59960
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59438
59961
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
59439
59962
|
*/
|
|
59440
59963
|
await this.loadMarkets();
|
|
59441
59964
|
const market = this.market(symbol);
|
|
59442
|
-
|
|
59443
|
-
|
|
59444
|
-
|
|
59445
|
-
|
|
59446
|
-
|
|
59447
|
-
|
|
59448
|
-
|
|
59965
|
+
let response = undefined;
|
|
59966
|
+
let data = undefined;
|
|
59967
|
+
if (market['swap']) {
|
|
59968
|
+
const request = {
|
|
59969
|
+
'contractName': market['id'],
|
|
59970
|
+
};
|
|
59971
|
+
if (market['linear']) {
|
|
59972
|
+
response = await this.fapiV1PublicGetTicker(this.extend(request, params));
|
|
59973
|
+
}
|
|
59974
|
+
else if (market['inverse']) {
|
|
59975
|
+
response = await this.dapiV1PublicGetTicker(this.extend(request, params));
|
|
59976
|
+
}
|
|
59977
|
+
data = response;
|
|
59978
|
+
}
|
|
59979
|
+
else if (market['spot']) {
|
|
59980
|
+
const request = {
|
|
59981
|
+
'symbol': market['id'],
|
|
59982
|
+
};
|
|
59983
|
+
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
59984
|
+
data = this.safeValue(response, 0, {});
|
|
59985
|
+
}
|
|
59986
|
+
else {
|
|
59987
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTicker only support spot & swap markets');
|
|
59988
|
+
}
|
|
59989
|
+
//
|
|
59990
|
+
// spot
|
|
59991
|
+
//
|
|
59992
|
+
// [{
|
|
59993
|
+
// symbol: 'BTCUSDT',
|
|
59994
|
+
// priceChange: '105.20',
|
|
59995
|
+
// priceChangePercent: '0.3000',
|
|
59996
|
+
// weightedAvgPrice: null,
|
|
59997
|
+
// prevClosePrice: null,
|
|
59998
|
+
// lastPrice: '34905.21',
|
|
59999
|
+
// lastQty: null,
|
|
60000
|
+
// bidPrice: '34905.21',
|
|
60001
|
+
// askPrice: '34905.22',
|
|
60002
|
+
// openPrice: '34800.01',
|
|
60003
|
+
// highPrice: '35276.33',
|
|
60004
|
+
// lowPrice: '34787.51',
|
|
60005
|
+
// volume: '12549.6481',
|
|
60006
|
+
// quoteVolume: '439390492.917',
|
|
60007
|
+
// openTime: '0',
|
|
60008
|
+
// closeTime: '0',
|
|
60009
|
+
// firstId: '0',
|
|
60010
|
+
// lastId: '0',
|
|
60011
|
+
// count: '0'
|
|
60012
|
+
// }]
|
|
60013
|
+
//
|
|
60014
|
+
// swap
|
|
59449
60015
|
//
|
|
59450
60016
|
// {
|
|
59451
|
-
// "
|
|
59452
|
-
// "
|
|
59453
|
-
// "
|
|
59454
|
-
//
|
|
59455
|
-
//
|
|
59456
|
-
//
|
|
59457
|
-
//
|
|
59458
|
-
//
|
|
59459
|
-
// "percentChange":"-0.001432",
|
|
59460
|
-
// "baseVolume":"338287",
|
|
59461
|
-
// "quoteVolume":"415013.244366",
|
|
59462
|
-
// "isFrozen":"0",
|
|
59463
|
-
// "high24hr":"1.370087",
|
|
59464
|
-
// "low24hr":"1.370087"
|
|
59465
|
-
// }
|
|
59466
|
-
// }
|
|
60017
|
+
// "high": "35296",
|
|
60018
|
+
// "vol": "779308354",
|
|
60019
|
+
// "last": "34884.1",
|
|
60020
|
+
// "low": "34806.7",
|
|
60021
|
+
// "buy": 34883.9,
|
|
60022
|
+
// "sell": 34884,
|
|
60023
|
+
// "rose": "-0.0027957315",
|
|
60024
|
+
// "time": 1699348013000
|
|
59467
60025
|
// }
|
|
59468
60026
|
//
|
|
59469
|
-
|
|
59470
|
-
const id = uppercaseBaseId + '_' + uppercaseQuoteId;
|
|
59471
|
-
const ticker = this.safeValue(data, id);
|
|
59472
|
-
if (ticker === undefined) {
|
|
59473
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchTicker() could not find the ticker for ' + market['symbol']);
|
|
59474
|
-
}
|
|
59475
|
-
return this.parseTicker(ticker, market);
|
|
60027
|
+
return this.parseTicker(data, market);
|
|
59476
60028
|
}
|
|
59477
60029
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
59478
60030
|
/**
|
|
59479
60031
|
* @method
|
|
59480
60032
|
* @name bitrue#fetchOHLCV
|
|
59481
60033
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
60034
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#kline-data
|
|
60035
|
+
* @see https://www.bitrue.com/api-docs#kline-candlestick-data
|
|
60036
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#kline-candlestick-data
|
|
59482
60037
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
59483
60038
|
* @param {string} timeframe the length of time each candle represents
|
|
59484
60039
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -59488,14 +60043,54 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59488
60043
|
*/
|
|
59489
60044
|
await this.loadMarkets();
|
|
59490
60045
|
const market = this.market(symbol);
|
|
59491
|
-
const
|
|
59492
|
-
|
|
59493
|
-
|
|
59494
|
-
|
|
59495
|
-
|
|
59496
|
-
request
|
|
60046
|
+
const timeframes = this.safeValue(this.options, 'timeframes', {});
|
|
60047
|
+
let response = undefined;
|
|
60048
|
+
let data = undefined;
|
|
60049
|
+
if (market['swap']) {
|
|
60050
|
+
const timeframesFuture = this.safeValue(timeframes, 'future', {});
|
|
60051
|
+
const request = {
|
|
60052
|
+
'contractName': market['id'],
|
|
60053
|
+
// 1min / 5min / 15min / 30min / 1h / 1day / 1week / 1month
|
|
60054
|
+
'interval': this.safeString(timeframesFuture, timeframe, '1min'),
|
|
60055
|
+
};
|
|
60056
|
+
if (limit !== undefined) {
|
|
60057
|
+
if (limit > 300) {
|
|
60058
|
+
limit = 300;
|
|
60059
|
+
}
|
|
60060
|
+
request['limit'] = limit;
|
|
60061
|
+
}
|
|
60062
|
+
if (market['linear']) {
|
|
60063
|
+
response = await this.fapiV1PublicGetKlines(this.extend(request, params));
|
|
60064
|
+
}
|
|
60065
|
+
else if (market['inverse']) {
|
|
60066
|
+
response = await this.dapiV1PublicGetKlines(this.extend(request, params));
|
|
60067
|
+
}
|
|
60068
|
+
data = response;
|
|
60069
|
+
}
|
|
60070
|
+
else if (market['spot']) {
|
|
60071
|
+
const timeframesSpot = this.safeValue(timeframes, 'spot', {});
|
|
60072
|
+
const request = {
|
|
60073
|
+
'symbol': market['id'],
|
|
60074
|
+
// 1m / 5m / 15m / 30m / 1H / 2H / 4H / 12H / 1D / 1W
|
|
60075
|
+
'scale': this.safeString(timeframesSpot, timeframe, '1m'),
|
|
60076
|
+
};
|
|
60077
|
+
if (limit !== undefined) {
|
|
60078
|
+
if (limit > 1440) {
|
|
60079
|
+
limit = 1440;
|
|
60080
|
+
}
|
|
60081
|
+
request['limit'] = limit;
|
|
60082
|
+
}
|
|
60083
|
+
if (since !== undefined) {
|
|
60084
|
+
request['fromIdx'] = since;
|
|
60085
|
+
}
|
|
60086
|
+
response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
|
|
60087
|
+
data = this.safeValue(response, 'data', []);
|
|
60088
|
+
}
|
|
60089
|
+
else {
|
|
60090
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOHLCV only support spot & swap markets');
|
|
59497
60091
|
}
|
|
59498
|
-
|
|
60092
|
+
//
|
|
60093
|
+
// spot
|
|
59499
60094
|
//
|
|
59500
60095
|
// {
|
|
59501
60096
|
// "symbol":"BTCUSDT",
|
|
@@ -59513,10 +60108,24 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59513
60108
|
// ]
|
|
59514
60109
|
// }
|
|
59515
60110
|
//
|
|
59516
|
-
|
|
60111
|
+
// swap
|
|
60112
|
+
//
|
|
60113
|
+
// [
|
|
60114
|
+
// {
|
|
60115
|
+
// "high": "35360.7",
|
|
60116
|
+
// "vol": "110288",
|
|
60117
|
+
// "low": "35347.9",
|
|
60118
|
+
// "idx": 1699411680000,
|
|
60119
|
+
// "close": "35347.9",
|
|
60120
|
+
// "open": "35349.4"
|
|
60121
|
+
// }
|
|
60122
|
+
// ]
|
|
60123
|
+
//
|
|
59517
60124
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
59518
60125
|
}
|
|
59519
60126
|
parseOHLCV(ohlcv, market = undefined) {
|
|
60127
|
+
//
|
|
60128
|
+
// spot
|
|
59520
60129
|
//
|
|
59521
60130
|
// {
|
|
59522
60131
|
// "i":"1660825020",
|
|
@@ -59528,13 +60137,28 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59528
60137
|
// "o":"23508.34"
|
|
59529
60138
|
// }
|
|
59530
60139
|
//
|
|
60140
|
+
// swap
|
|
60141
|
+
//
|
|
60142
|
+
// {
|
|
60143
|
+
// "high": "35360.7",
|
|
60144
|
+
// "vol": "110288",
|
|
60145
|
+
// "low": "35347.9",
|
|
60146
|
+
// "idx": 1699411680000,
|
|
60147
|
+
// "close": "35347.9",
|
|
60148
|
+
// "open": "35349.4"
|
|
60149
|
+
// }
|
|
60150
|
+
//
|
|
60151
|
+
let timestamp = this.safeTimestamp(ohlcv, 'i');
|
|
60152
|
+
if (timestamp === undefined) {
|
|
60153
|
+
timestamp = this.safeInteger(ohlcv, 'idx');
|
|
60154
|
+
}
|
|
59531
60155
|
return [
|
|
59532
|
-
|
|
59533
|
-
this.
|
|
59534
|
-
this.
|
|
59535
|
-
this.
|
|
59536
|
-
this.
|
|
59537
|
-
this.
|
|
60156
|
+
timestamp,
|
|
60157
|
+
this.safeNumber2(ohlcv, 'o', 'open'),
|
|
60158
|
+
this.safeNumber2(ohlcv, 'h', 'high'),
|
|
60159
|
+
this.safeNumber2(ohlcv, 'l', 'low'),
|
|
60160
|
+
this.safeNumber2(ohlcv, 'c', 'close'),
|
|
60161
|
+
this.safeNumber2(ohlcv, 'v', 'vol'),
|
|
59538
60162
|
];
|
|
59539
60163
|
}
|
|
59540
60164
|
async fetchBidsAsks(symbols = undefined, params = {}) {
|
|
@@ -59543,20 +60167,40 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59543
60167
|
* @name bitrue#fetchBidsAsks
|
|
59544
60168
|
* @description fetches the bid and ask price and volume for multiple markets
|
|
59545
60169
|
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker
|
|
60170
|
+
* @see https://www.bitrue.com/api-docs#ticker
|
|
60171
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker
|
|
59546
60172
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
59547
60173
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59548
60174
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
59549
60175
|
*/
|
|
59550
60176
|
await this.loadMarkets();
|
|
59551
|
-
symbols = this.marketSymbols(symbols);
|
|
59552
|
-
|
|
59553
|
-
const
|
|
59554
|
-
|
|
59555
|
-
|
|
59556
|
-
|
|
59557
|
-
|
|
60177
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
60178
|
+
const first = this.safeString(symbols, 0);
|
|
60179
|
+
const market = this.market(first);
|
|
60180
|
+
let response = undefined;
|
|
60181
|
+
if (market['swap']) {
|
|
60182
|
+
const request = {
|
|
60183
|
+
'contractName': market['id'],
|
|
60184
|
+
};
|
|
60185
|
+
if (market['linear']) {
|
|
60186
|
+
response = await this.fapiV1PublicGetTicker(this.extend(request, params));
|
|
60187
|
+
}
|
|
60188
|
+
else if (market['inverse']) {
|
|
60189
|
+
response = await this.dapiV1PublicGetTicker(this.extend(request, params));
|
|
60190
|
+
}
|
|
60191
|
+
}
|
|
60192
|
+
else if (market['spot']) {
|
|
60193
|
+
const request = {
|
|
60194
|
+
'symbol': market['id'],
|
|
60195
|
+
};
|
|
60196
|
+
response = await this.spotV1PublicGetTickerBookTicker(this.extend(request, params));
|
|
60197
|
+
}
|
|
60198
|
+
else {
|
|
60199
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchBidsAsks only support spot & swap markets');
|
|
59558
60200
|
}
|
|
59559
|
-
|
|
60201
|
+
//
|
|
60202
|
+
// spot
|
|
60203
|
+
//
|
|
59560
60204
|
// {
|
|
59561
60205
|
// "symbol": "LTCBTC",
|
|
59562
60206
|
// "bidPrice": "4.00000000",
|
|
@@ -59564,6 +60208,20 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59564
60208
|
// "askPrice": "4.00000200",
|
|
59565
60209
|
// "askQty": "9.00000000"
|
|
59566
60210
|
// }
|
|
60211
|
+
//
|
|
60212
|
+
// swap
|
|
60213
|
+
//
|
|
60214
|
+
// {
|
|
60215
|
+
// "high": "35296",
|
|
60216
|
+
// "vol": "779308354",
|
|
60217
|
+
// "last": "34884.1",
|
|
60218
|
+
// "low": "34806.7",
|
|
60219
|
+
// "buy": 34883.9,
|
|
60220
|
+
// "sell": 34884,
|
|
60221
|
+
// "rose": "-0.0027957315",
|
|
60222
|
+
// "time": 1699348013000
|
|
60223
|
+
// }
|
|
60224
|
+
//
|
|
59567
60225
|
const data = {};
|
|
59568
60226
|
data[market['id']] = response;
|
|
59569
60227
|
return this.parseTickers(data, symbols);
|
|
@@ -59573,65 +60231,102 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59573
60231
|
* @method
|
|
59574
60232
|
* @name bitrue#fetchTickers
|
|
59575
60233
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
60234
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#24hr-ticker-price-change-statistics
|
|
60235
|
+
* @see https://www.bitrue.com/api-docs#ticker
|
|
60236
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker
|
|
59576
60237
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
59577
60238
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59578
60239
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
59579
60240
|
*/
|
|
59580
60241
|
await this.loadMarkets();
|
|
59581
|
-
|
|
59582
|
-
|
|
59583
|
-
|
|
59584
|
-
const
|
|
60242
|
+
symbols = this.marketSymbols(symbols);
|
|
60243
|
+
let response = undefined;
|
|
60244
|
+
let data = undefined;
|
|
60245
|
+
const request = {};
|
|
60246
|
+
let type = undefined;
|
|
60247
|
+
if (symbols !== undefined) {
|
|
60248
|
+
const first = this.safeString(symbols, 0);
|
|
60249
|
+
const market = this.market(first);
|
|
60250
|
+
if (market['swap']) {
|
|
60251
|
+
request['contractName'] = market['id'];
|
|
60252
|
+
if (market['linear']) {
|
|
60253
|
+
response = await this.fapiV1PublicGetTicker(this.extend(request, params));
|
|
60254
|
+
}
|
|
60255
|
+
else if (market['inverse']) {
|
|
60256
|
+
response = await this.dapiV1PublicGetTicker(this.extend(request, params));
|
|
60257
|
+
}
|
|
60258
|
+
response['symbol'] = market['id'];
|
|
60259
|
+
data = [response];
|
|
60260
|
+
}
|
|
60261
|
+
else if (market['spot']) {
|
|
60262
|
+
request['symbol'] = market['id'];
|
|
60263
|
+
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
60264
|
+
data = response;
|
|
60265
|
+
}
|
|
60266
|
+
else {
|
|
60267
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers only support spot & swap markets');
|
|
60268
|
+
}
|
|
60269
|
+
}
|
|
60270
|
+
else {
|
|
60271
|
+
[type, params] = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
|
|
60272
|
+
if (type !== 'spot') {
|
|
60273
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers only support spot when symbols is not set');
|
|
60274
|
+
}
|
|
60275
|
+
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
60276
|
+
data = response;
|
|
60277
|
+
}
|
|
60278
|
+
//
|
|
60279
|
+
// spot
|
|
60280
|
+
//
|
|
60281
|
+
// [{
|
|
60282
|
+
// symbol: 'BTCUSDT',
|
|
60283
|
+
// priceChange: '105.20',
|
|
60284
|
+
// priceChangePercent: '0.3000',
|
|
60285
|
+
// weightedAvgPrice: null,
|
|
60286
|
+
// prevClosePrice: null,
|
|
60287
|
+
// lastPrice: '34905.21',
|
|
60288
|
+
// lastQty: null,
|
|
60289
|
+
// bidPrice: '34905.21',
|
|
60290
|
+
// askPrice: '34905.22',
|
|
60291
|
+
// openPrice: '34800.01',
|
|
60292
|
+
// highPrice: '35276.33',
|
|
60293
|
+
// lowPrice: '34787.51',
|
|
60294
|
+
// volume: '12549.6481',
|
|
60295
|
+
// quoteVolume: '439390492.917',
|
|
60296
|
+
// openTime: '0',
|
|
60297
|
+
// closeTime: '0',
|
|
60298
|
+
// firstId: '0',
|
|
60299
|
+
// lastId: '0',
|
|
60300
|
+
// count: '0'
|
|
60301
|
+
// }]
|
|
60302
|
+
//
|
|
60303
|
+
// swap
|
|
59585
60304
|
//
|
|
59586
60305
|
// {
|
|
59587
|
-
// "
|
|
59588
|
-
// "
|
|
59589
|
-
// "
|
|
59590
|
-
//
|
|
59591
|
-
//
|
|
59592
|
-
//
|
|
59593
|
-
//
|
|
59594
|
-
//
|
|
59595
|
-
// "percentChange":"-0.001432",
|
|
59596
|
-
// "baseVolume":"338287",
|
|
59597
|
-
// "quoteVolume":"415013.244366",
|
|
59598
|
-
// "isFrozen":"0",
|
|
59599
|
-
// "high24hr":"1.370087",
|
|
59600
|
-
// "low24hr":"1.370087"
|
|
59601
|
-
// }
|
|
59602
|
-
// }
|
|
60306
|
+
// "high": "35296",
|
|
60307
|
+
// "vol": "779308354",
|
|
60308
|
+
// "last": "34884.1",
|
|
60309
|
+
// "low": "34806.7",
|
|
60310
|
+
// "buy": 34883.9,
|
|
60311
|
+
// "sell": 34884,
|
|
60312
|
+
// "rose": "-0.0027957315",
|
|
60313
|
+
// "time": 1699348013000
|
|
59603
60314
|
// }
|
|
59604
60315
|
//
|
|
59605
|
-
const data = this.safeValue(response, 'data', {});
|
|
59606
60316
|
// the exchange returns market ids with an underscore from the tickers endpoint
|
|
59607
60317
|
// the market ids do not have an underscore, so it has to be removed
|
|
59608
60318
|
// https://github.com/ccxt/ccxt/issues/13856
|
|
59609
60319
|
const tickers = {};
|
|
59610
|
-
|
|
59611
|
-
|
|
59612
|
-
const
|
|
59613
|
-
tickers[
|
|
60320
|
+
for (let i = 0; i < data.length; i++) {
|
|
60321
|
+
const ticker = this.safeValue(data, i, {});
|
|
60322
|
+
const market = this.market(this.safeValue(ticker, 'symbol'));
|
|
60323
|
+
tickers[market['id']] = ticker;
|
|
59614
60324
|
}
|
|
59615
60325
|
return this.parseTickers(tickers, symbols);
|
|
59616
60326
|
}
|
|
59617
60327
|
parseTrade(trade, market = undefined) {
|
|
59618
60328
|
//
|
|
59619
|
-
//
|
|
59620
|
-
// - "T" is timestamp of *api-call* not trades. Use more expensive v1PublicGetHistoricalTrades if actual timestamp of trades matter
|
|
59621
|
-
// - Trades are aggregated by timestamp, price, and side. But "m" is always True. Use method above if side of trades matter
|
|
59622
|
-
//
|
|
59623
|
-
// {
|
|
59624
|
-
// "a": 26129, // Aggregate tradeId
|
|
59625
|
-
// "p": "0.01633102", // Price
|
|
59626
|
-
// "q": "4.70443515", // Quantity
|
|
59627
|
-
// "f": 27781, // First tradeId
|
|
59628
|
-
// "l": 27781, // Last tradeId
|
|
59629
|
-
// "T": 1498793709153, // Timestamp of *Api-call* not trade!
|
|
59630
|
-
// "m": true, // Was the buyer the maker? // Always True -> ignore it and leave side undefined
|
|
59631
|
-
// "M": true // Was the trade the best price match?
|
|
59632
|
-
// }
|
|
59633
|
-
//
|
|
59634
|
-
// recent public trades and old public trades
|
|
60329
|
+
// fetchTrades
|
|
59635
60330
|
//
|
|
59636
60331
|
// {
|
|
59637
60332
|
// "id": 28457,
|
|
@@ -59642,7 +60337,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59642
60337
|
// "isBestMatch": true
|
|
59643
60338
|
// }
|
|
59644
60339
|
//
|
|
59645
|
-
//
|
|
60340
|
+
// fetchTrades - spot
|
|
59646
60341
|
//
|
|
59647
60342
|
// {
|
|
59648
60343
|
// "symbol":"USDCUSDT",
|
|
@@ -59659,14 +60354,32 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59659
60354
|
// "isBestMatch":true
|
|
59660
60355
|
// }
|
|
59661
60356
|
//
|
|
59662
|
-
|
|
59663
|
-
|
|
59664
|
-
|
|
59665
|
-
|
|
60357
|
+
// fetchTrades - future
|
|
60358
|
+
//
|
|
60359
|
+
// {
|
|
60360
|
+
// "tradeId":12,
|
|
60361
|
+
// "price":0.9,
|
|
60362
|
+
// "qty":1,
|
|
60363
|
+
// "amount":9,
|
|
60364
|
+
// "contractName":"E-SAND-USDT",
|
|
60365
|
+
// "side":"BUY",
|
|
60366
|
+
// "fee":"0.0018",
|
|
60367
|
+
// "bidId":1558124009467904992,
|
|
60368
|
+
// "askId":1558124043827644908,
|
|
60369
|
+
// "bidUserId":10294,
|
|
60370
|
+
// "askUserId":10467,
|
|
60371
|
+
// "isBuyer":true,
|
|
60372
|
+
// "isMaker":true,
|
|
60373
|
+
// "ctime":1678426306000
|
|
60374
|
+
// }
|
|
60375
|
+
//
|
|
60376
|
+
const timestamp = this.safeInteger2(trade, 'ctime', 'time');
|
|
60377
|
+
const priceString = this.safeString(trade, 'price');
|
|
60378
|
+
const amountString = this.safeString(trade, 'qty');
|
|
60379
|
+
const marketId = this.safeString2(trade, 'symbol', 'contractName');
|
|
59666
60380
|
const symbol = this.safeSymbol(marketId, market);
|
|
59667
60381
|
const orderId = this.safeString(trade, 'orderId');
|
|
59668
|
-
|
|
59669
|
-
id = this.safeString2(trade, 'id', 'tradeId', id);
|
|
60382
|
+
const id = this.safeString2(trade, 'id', 'tradeId');
|
|
59670
60383
|
let side = undefined;
|
|
59671
60384
|
const buyerMaker = this.safeValue(trade, 'isBuyerMaker'); // ignore "m" until Bitrue fixes api
|
|
59672
60385
|
const isBuyer = this.safeValue(trade, 'isBuyer');
|
|
@@ -59679,12 +60392,12 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59679
60392
|
let fee = undefined;
|
|
59680
60393
|
if ('commission' in trade) {
|
|
59681
60394
|
fee = {
|
|
59682
|
-
'cost': this.
|
|
60395
|
+
'cost': this.safeString2(trade, 'commission', 'fee'),
|
|
59683
60396
|
'currency': this.safeCurrencyCode(this.safeString(trade, 'commissionAssert')),
|
|
59684
60397
|
};
|
|
59685
60398
|
}
|
|
59686
60399
|
let takerOrMaker = undefined;
|
|
59687
|
-
const isMaker = this.
|
|
60400
|
+
const isMaker = this.safeValue(trade, 'isMaker');
|
|
59688
60401
|
if (isMaker !== undefined) {
|
|
59689
60402
|
takerOrMaker = isMaker ? 'maker' : 'taker';
|
|
59690
60403
|
}
|
|
@@ -59709,6 +60422,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59709
60422
|
* @method
|
|
59710
60423
|
* @name bitrue#fetchTrades
|
|
59711
60424
|
* @description get the list of most recent trades for a particular symbol
|
|
60425
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#recent-trades-list
|
|
59712
60426
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
59713
60427
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
59714
60428
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -59717,41 +60431,22 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59717
60431
|
*/
|
|
59718
60432
|
await this.loadMarkets();
|
|
59719
60433
|
const market = this.market(symbol);
|
|
59720
|
-
|
|
59721
|
-
|
|
59722
|
-
|
|
59723
|
-
|
|
59724
|
-
|
|
59725
|
-
|
|
59726
|
-
|
|
60434
|
+
let response = undefined;
|
|
60435
|
+
if (market['spot']) {
|
|
60436
|
+
const request = {
|
|
60437
|
+
'symbol': market['id'],
|
|
60438
|
+
// 'limit': 100, // default 100, max = 1000
|
|
60439
|
+
};
|
|
60440
|
+
if (limit !== undefined) {
|
|
60441
|
+
request['limit'] = limit; // default 100, max 1000
|
|
60442
|
+
}
|
|
60443
|
+
response = await this.spotV1PublicGetTrades(this.extend(request, params));
|
|
60444
|
+
}
|
|
60445
|
+
else {
|
|
60446
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTrades only support spot markets');
|
|
59727
60447
|
}
|
|
59728
60448
|
//
|
|
59729
|
-
//
|
|
59730
|
-
// - default limit (500) applies only if no other parameters set, trades up
|
|
59731
|
-
// to the maximum limit may be returned to satisfy other parameters
|
|
59732
|
-
// - if both limit and time window is set and time window contains more
|
|
59733
|
-
// trades than the limit then the last trades from the window are returned
|
|
59734
|
-
// - 'tradeId' accepted and returned by this method is "aggregate" trade id
|
|
59735
|
-
// which is different from actual trade id
|
|
59736
|
-
// - setting both fromId and time window results in error
|
|
59737
|
-
const response = await this[method](this.extend(request, params));
|
|
59738
|
-
//
|
|
59739
|
-
// aggregate trades
|
|
59740
|
-
//
|
|
59741
|
-
// [
|
|
59742
|
-
// {
|
|
59743
|
-
// "a": 26129, // Aggregate tradeId
|
|
59744
|
-
// "p": "0.01633102", // Price
|
|
59745
|
-
// "q": "4.70443515", // Quantity
|
|
59746
|
-
// "f": 27781, // First tradeId
|
|
59747
|
-
// "l": 27781, // Last tradeId
|
|
59748
|
-
// "T": 1498793709153, // Timestamp
|
|
59749
|
-
// "m": true, // Was the buyer the maker?
|
|
59750
|
-
// "M": true // Was the trade the best price match?
|
|
59751
|
-
// }
|
|
59752
|
-
// ]
|
|
59753
|
-
//
|
|
59754
|
-
// recent public trades and historical public trades
|
|
60449
|
+
// spot
|
|
59755
60450
|
//
|
|
59756
60451
|
// [
|
|
59757
60452
|
// {
|
|
@@ -59768,6 +60463,8 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59768
60463
|
}
|
|
59769
60464
|
parseOrderStatus(status) {
|
|
59770
60465
|
const statuses = {
|
|
60466
|
+
'INIT': 'open',
|
|
60467
|
+
'PENDING_CREATE': 'open',
|
|
59771
60468
|
'NEW': 'open',
|
|
59772
60469
|
'PARTIALLY_FILLED': 'open',
|
|
59773
60470
|
'FILLED': 'closed',
|
|
@@ -59780,7 +60477,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59780
60477
|
}
|
|
59781
60478
|
parseOrder(order, market = undefined) {
|
|
59782
60479
|
//
|
|
59783
|
-
// createOrder
|
|
60480
|
+
// createOrder - spot
|
|
59784
60481
|
//
|
|
59785
60482
|
// {
|
|
59786
60483
|
// "symbol":"USDCUSDT",
|
|
@@ -59789,7 +60486,13 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59789
60486
|
// "transactTime":1635551031276
|
|
59790
60487
|
// }
|
|
59791
60488
|
//
|
|
59792
|
-
//
|
|
60489
|
+
// createOrder - future
|
|
60490
|
+
//
|
|
60491
|
+
// {
|
|
60492
|
+
// "orderId":1690615676032452985,
|
|
60493
|
+
// }
|
|
60494
|
+
//
|
|
60495
|
+
// fetchOrders - spot
|
|
59793
60496
|
//
|
|
59794
60497
|
// {
|
|
59795
60498
|
// "symbol":"USDCUSDT",
|
|
@@ -59810,7 +60513,24 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59810
60513
|
// "isWorking":false
|
|
59811
60514
|
// }
|
|
59812
60515
|
//
|
|
59813
|
-
|
|
60516
|
+
// fetchOrders - future
|
|
60517
|
+
//
|
|
60518
|
+
// {
|
|
60519
|
+
// "orderId":1917641,
|
|
60520
|
+
// "price":100,
|
|
60521
|
+
// "origQty":10,
|
|
60522
|
+
// "origAmount":10,
|
|
60523
|
+
// "executedQty":1,
|
|
60524
|
+
// "avgPrice":10000,
|
|
60525
|
+
// "status":"INIT",
|
|
60526
|
+
// "type":"LIMIT",
|
|
60527
|
+
// "side":"BUY",
|
|
60528
|
+
// "action":"OPEN",
|
|
60529
|
+
// "transactTime":1686716571425
|
|
60530
|
+
// "clientOrderId":4949299210
|
|
60531
|
+
// }
|
|
60532
|
+
//
|
|
60533
|
+
const status = this.parseOrderStatus(this.safeString2(order, 'status', 'orderStatus'));
|
|
59814
60534
|
const marketId = this.safeString(order, 'symbol');
|
|
59815
60535
|
const symbol = this.safeSymbol(marketId, market);
|
|
59816
60536
|
const filled = this.safeString(order, 'executedQty');
|
|
@@ -59845,7 +60565,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59845
60565
|
const fills = this.safeValue(order, 'fills', []);
|
|
59846
60566
|
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
59847
60567
|
const timeInForce = this.safeString(order, 'timeInForce');
|
|
59848
|
-
const postOnly = (type === 'limit_maker') || (timeInForce === 'GTX');
|
|
60568
|
+
const postOnly = (type === 'limit_maker') || (timeInForce === 'GTX') || (type === 'post_only');
|
|
59849
60569
|
if (type === 'limit_maker') {
|
|
59850
60570
|
type = 'limit';
|
|
59851
60571
|
}
|
|
@@ -59881,16 +60601,21 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59881
60601
|
* @method
|
|
59882
60602
|
* @name bitrue#createOrder
|
|
59883
60603
|
* @description create a trade order
|
|
59884
|
-
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#
|
|
60604
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#recent-trades-list
|
|
60605
|
+
* @see https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256
|
|
60606
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256
|
|
59885
60607
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
59886
60608
|
* @param {string} type 'market' or 'limit'
|
|
59887
60609
|
* @param {string} side 'buy' or 'sell'
|
|
59888
60610
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
59889
60611
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
59890
60612
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59891
|
-
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
60613
|
+
* @param {float} [params.triggerPrice] *spot only* the price at which a trigger order is triggered at
|
|
59892
60614
|
* @param {string} [params.clientOrderId] a unique id for the order, automatically generated if not sent
|
|
59893
|
-
*
|
|
60615
|
+
* @param {decimal} [params.leverage] in future order, the leverage value of the order should consistent with the user contract configuration, default is 1
|
|
60616
|
+
* @param {string} [params.timeInForce] 'fok', 'ioc' or 'po'
|
|
60617
|
+
* @param {bool} [params.postOnly] default false
|
|
60618
|
+
* @param {bool} [params.reduceOnly] default false
|
|
59894
60619
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
59895
60620
|
* @param {decimal} [params.icebergQty]
|
|
59896
60621
|
* @param {long} [params.recvWindow]
|
|
@@ -59898,54 +60623,125 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59898
60623
|
*/
|
|
59899
60624
|
await this.loadMarkets();
|
|
59900
60625
|
const market = this.market(symbol);
|
|
60626
|
+
let response = undefined;
|
|
60627
|
+
let data = undefined;
|
|
59901
60628
|
const uppercaseType = type.toUpperCase();
|
|
59902
|
-
const validOrderTypes = this.safeValue(market['info'], 'orderTypes');
|
|
59903
|
-
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
59904
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' ' + type + ' is not a valid order type in market ' + symbol);
|
|
59905
|
-
}
|
|
59906
60629
|
const request = {
|
|
59907
|
-
'symbol': market['id'],
|
|
59908
60630
|
'side': side.toUpperCase(),
|
|
59909
60631
|
'type': uppercaseType,
|
|
59910
60632
|
// 'timeInForce': '',
|
|
59911
|
-
'quantity': this.amountToPrecision(symbol, amount),
|
|
59912
60633
|
// 'price': this.priceToPrecision (symbol, price),
|
|
59913
60634
|
// 'newClientOrderId': clientOrderId, // automatically generated if not sent
|
|
59914
60635
|
// 'stopPrice': this.priceToPrecision (symbol, 'stopPrice'),
|
|
59915
60636
|
// 'icebergQty': this.amountToPrecision (symbol, icebergQty),
|
|
59916
60637
|
};
|
|
59917
|
-
const clientOrderId = this.safeString2(params, 'newClientOrderId', 'clientOrderId');
|
|
59918
|
-
if (clientOrderId !== undefined) {
|
|
59919
|
-
params = this.omit(params, ['newClientOrderId', 'clientOrderId']);
|
|
59920
|
-
request['newClientOrderId'] = clientOrderId;
|
|
59921
|
-
}
|
|
59922
60638
|
if (uppercaseType === 'LIMIT') {
|
|
59923
60639
|
if (price === undefined) {
|
|
59924
60640
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument');
|
|
59925
60641
|
}
|
|
59926
60642
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
59927
60643
|
}
|
|
59928
|
-
|
|
59929
|
-
|
|
59930
|
-
|
|
59931
|
-
|
|
60644
|
+
if (market['swap']) {
|
|
60645
|
+
const isMarket = uppercaseType === 'MARKET';
|
|
60646
|
+
const timeInForce = this.safeStringLower(params, 'timeInForce');
|
|
60647
|
+
const postOnly = this.isPostOnly(isMarket, undefined, params);
|
|
60648
|
+
if (postOnly) {
|
|
60649
|
+
request['type'] = 'POST_ONLY';
|
|
60650
|
+
}
|
|
60651
|
+
else if (timeInForce === 'fok') {
|
|
60652
|
+
request['type'] = 'FOK';
|
|
60653
|
+
}
|
|
60654
|
+
else if (timeInForce === 'ioc') {
|
|
60655
|
+
request['type'] = 'IOC';
|
|
60656
|
+
}
|
|
60657
|
+
request['contractName'] = market['id'];
|
|
60658
|
+
if (isMarket && (side === 'buy') && (this.options['createMarketBuyOrderRequiresPrice'])) {
|
|
60659
|
+
const cost = this.safeString(params, 'cost');
|
|
60660
|
+
params = this.omit(params, 'cost');
|
|
60661
|
+
if (price === undefined && cost === undefined) {
|
|
60662
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument with swap market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
|
|
60663
|
+
}
|
|
60664
|
+
else {
|
|
60665
|
+
const amountString = this.numberToString(amount);
|
|
60666
|
+
const priceString = this.numberToString(price);
|
|
60667
|
+
const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
60668
|
+
amount = (cost !== undefined) ? cost : quoteAmount;
|
|
60669
|
+
request['amount'] = this.costToPrecision(symbol, amount);
|
|
60670
|
+
request['volume'] = this.costToPrecision(symbol, amount);
|
|
60671
|
+
}
|
|
60672
|
+
}
|
|
60673
|
+
else {
|
|
60674
|
+
request['amount'] = this.parseToNumeric(amount);
|
|
60675
|
+
request['volume'] = this.parseToNumeric(amount);
|
|
60676
|
+
}
|
|
60677
|
+
request['positionType'] = 1;
|
|
60678
|
+
const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
60679
|
+
request['open'] = reduceOnly ? 'CLOSE' : 'OPEN';
|
|
60680
|
+
const leverage = this.safeString(params, 'leverage', '1');
|
|
60681
|
+
request['leverage'] = this.parseToNumeric(leverage);
|
|
60682
|
+
params = this.omit(params, ['leverage', 'reduceOnly', 'reduce_only', 'timeInForce']);
|
|
60683
|
+
if (market['linear']) {
|
|
60684
|
+
response = await this.fapiV2PrivatePostOrder(this.extend(request, params));
|
|
60685
|
+
}
|
|
60686
|
+
else if (market['inverse']) {
|
|
60687
|
+
response = await this.dapiV2PrivatePostOrder(this.extend(request, params));
|
|
60688
|
+
}
|
|
60689
|
+
data = this.safeValue(response, 'data', {});
|
|
60690
|
+
}
|
|
60691
|
+
else if (market['spot']) {
|
|
60692
|
+
request['symbol'] = market['id'];
|
|
60693
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
60694
|
+
const validOrderTypes = this.safeValue(market['info'], 'orderTypes');
|
|
60695
|
+
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
60696
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' ' + type + ' is not a valid order type in market ' + symbol);
|
|
60697
|
+
}
|
|
60698
|
+
const clientOrderId = this.safeString2(params, 'newClientOrderId', 'clientOrderId');
|
|
60699
|
+
if (clientOrderId !== undefined) {
|
|
60700
|
+
params = this.omit(params, ['newClientOrderId', 'clientOrderId']);
|
|
60701
|
+
request['newClientOrderId'] = clientOrderId;
|
|
60702
|
+
}
|
|
60703
|
+
const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
60704
|
+
if (stopPrice !== undefined) {
|
|
60705
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice']);
|
|
60706
|
+
request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
60707
|
+
}
|
|
60708
|
+
response = await this.spotV1PrivatePostOrder(this.extend(request, params));
|
|
60709
|
+
data = response;
|
|
60710
|
+
}
|
|
60711
|
+
else {
|
|
60712
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrder only support spot & swap markets');
|
|
59932
60713
|
}
|
|
59933
|
-
|
|
60714
|
+
//
|
|
60715
|
+
// spot
|
|
59934
60716
|
//
|
|
59935
60717
|
// {
|
|
59936
|
-
// "symbol":"
|
|
59937
|
-
// "orderId":
|
|
59938
|
-
// "
|
|
59939
|
-
// "
|
|
60718
|
+
// "symbol": "BTCUSDT",
|
|
60719
|
+
// "orderId": 307650651173648896,
|
|
60720
|
+
// "orderIdStr": "307650651173648896",
|
|
60721
|
+
// "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
|
|
60722
|
+
// "transactTime": 1507725176595
|
|
59940
60723
|
// }
|
|
59941
60724
|
//
|
|
59942
|
-
|
|
60725
|
+
// swap
|
|
60726
|
+
//
|
|
60727
|
+
// {
|
|
60728
|
+
// "code": "0",
|
|
60729
|
+
// "msg": "Success",
|
|
60730
|
+
// "data": {
|
|
60731
|
+
// "orderId": 1690615676032452985
|
|
60732
|
+
// }
|
|
60733
|
+
// }
|
|
60734
|
+
//
|
|
60735
|
+
return this.parseOrder(data, market);
|
|
59943
60736
|
}
|
|
59944
60737
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
59945
60738
|
/**
|
|
59946
60739
|
* @method
|
|
59947
60740
|
* @name bitrue#fetchOrder
|
|
59948
60741
|
* @description fetches information on an order made by the user
|
|
60742
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#query-order-user_data
|
|
60743
|
+
* @see https://www.bitrue.com/api-docs#query-order-user_data-hmac-sha256
|
|
60744
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#query-order-user_data-hmac-sha256
|
|
59949
60745
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
59950
60746
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
59951
60747
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -59955,25 +60751,92 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59955
60751
|
}
|
|
59956
60752
|
await this.loadMarkets();
|
|
59957
60753
|
const market = this.market(symbol);
|
|
59958
|
-
const
|
|
59959
|
-
|
|
59960
|
-
|
|
59961
|
-
|
|
59962
|
-
|
|
59963
|
-
|
|
60754
|
+
const origClientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
|
|
60755
|
+
params = this.omit(params, ['origClientOrderId', 'clientOrderId']);
|
|
60756
|
+
let response = undefined;
|
|
60757
|
+
let data = undefined;
|
|
60758
|
+
const request = {};
|
|
60759
|
+
if (origClientOrderId === undefined) {
|
|
60760
|
+
request['orderId'] = id;
|
|
59964
60761
|
}
|
|
59965
60762
|
else {
|
|
59966
|
-
|
|
60763
|
+
if (market['swap']) {
|
|
60764
|
+
request['clientOrderId'] = origClientOrderId;
|
|
60765
|
+
}
|
|
60766
|
+
else {
|
|
60767
|
+
request['origClientOrderId'] = origClientOrderId;
|
|
60768
|
+
}
|
|
59967
60769
|
}
|
|
59968
|
-
|
|
59969
|
-
|
|
59970
|
-
|
|
60770
|
+
if (market['swap']) {
|
|
60771
|
+
request['contractName'] = market['id'];
|
|
60772
|
+
if (market['linear']) {
|
|
60773
|
+
response = await this.fapiV2PrivateGetOrder(this.extend(request, params));
|
|
60774
|
+
}
|
|
60775
|
+
else if (market['inverse']) {
|
|
60776
|
+
response = await this.dapiV2PrivateGetOrder(this.extend(request, params));
|
|
60777
|
+
}
|
|
60778
|
+
data = this.safeValue(response, 'data', {});
|
|
60779
|
+
}
|
|
60780
|
+
else if (market['spot']) {
|
|
60781
|
+
request['orderId'] = id; // spot market id is mandatory
|
|
60782
|
+
request['symbol'] = market['id'];
|
|
60783
|
+
response = await this.spotV1PrivateGetOrder(this.extend(request, params));
|
|
60784
|
+
data = response;
|
|
60785
|
+
}
|
|
60786
|
+
else {
|
|
60787
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder only support spot & swap markets');
|
|
60788
|
+
}
|
|
60789
|
+
//
|
|
60790
|
+
// spot
|
|
60791
|
+
//
|
|
60792
|
+
// {
|
|
60793
|
+
// "symbol": "LTCBTC",
|
|
60794
|
+
// "orderId": 1,
|
|
60795
|
+
// "clientOrderId": "myOrder1",
|
|
60796
|
+
// "price": "0.1",
|
|
60797
|
+
// "origQty": "1.0",
|
|
60798
|
+
// "executedQty": "0.0",
|
|
60799
|
+
// "cummulativeQuoteQty": "0.0",
|
|
60800
|
+
// "status": "NEW",
|
|
60801
|
+
// "timeInForce": "GTC",
|
|
60802
|
+
// "type": "LIMIT",
|
|
60803
|
+
// "side": "BUY",
|
|
60804
|
+
// "stopPrice": "0.0",
|
|
60805
|
+
// "icebergQty": "0.0",
|
|
60806
|
+
// "time": 1499827319559,
|
|
60807
|
+
// "updateTime": 1499827319559,
|
|
60808
|
+
// "isWorking": true
|
|
60809
|
+
// }
|
|
60810
|
+
//
|
|
60811
|
+
// swap
|
|
60812
|
+
//
|
|
60813
|
+
// {
|
|
60814
|
+
// "code":0,
|
|
60815
|
+
// "msg":"success",
|
|
60816
|
+
// "data":{
|
|
60817
|
+
// "orderId":1917641,
|
|
60818
|
+
// "price":100,
|
|
60819
|
+
// "origQty":10,
|
|
60820
|
+
// "origAmount":10,
|
|
60821
|
+
// "executedQty":1,
|
|
60822
|
+
// "avgPrice":10000,
|
|
60823
|
+
// "status":"INIT",
|
|
60824
|
+
// "type":"LIMIT",
|
|
60825
|
+
// "side":"BUY",
|
|
60826
|
+
// "action":"OPEN",
|
|
60827
|
+
// "transactTime":1686716571425
|
|
60828
|
+
// "clientOrderId":4949299210
|
|
60829
|
+
// }
|
|
60830
|
+
// }
|
|
60831
|
+
//
|
|
60832
|
+
return this.parseOrder(data, market);
|
|
59971
60833
|
}
|
|
59972
60834
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
59973
60835
|
/**
|
|
59974
60836
|
* @method
|
|
59975
60837
|
* @name bitrue#fetchClosedOrders
|
|
59976
60838
|
* @description fetches information on multiple closed orders made by the user
|
|
60839
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#all-orders-user_data
|
|
59977
60840
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
59978
60841
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
59979
60842
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -59985,6 +60848,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59985
60848
|
}
|
|
59986
60849
|
await this.loadMarkets();
|
|
59987
60850
|
const market = this.market(symbol);
|
|
60851
|
+
if (!market['spot']) {
|
|
60852
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchClosedOrders only support spot markets');
|
|
60853
|
+
}
|
|
59988
60854
|
const request = {
|
|
59989
60855
|
'symbol': market['id'],
|
|
59990
60856
|
// 'orderId': 123445, // long
|
|
@@ -59998,7 +60864,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59998
60864
|
if (limit !== undefined) {
|
|
59999
60865
|
request['limit'] = limit; // default 100, max 1000
|
|
60000
60866
|
}
|
|
60001
|
-
const response = await this.
|
|
60867
|
+
const response = await this.spotV1PrivateGetAllOrders(this.extend(request, params));
|
|
60002
60868
|
//
|
|
60003
60869
|
// [
|
|
60004
60870
|
// {
|
|
@@ -60028,6 +60894,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60028
60894
|
* @method
|
|
60029
60895
|
* @name bitrue#fetchOpenOrders
|
|
60030
60896
|
* @description fetch all unfilled currently open orders
|
|
60897
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#current-open-orders-user_data
|
|
60898
|
+
* @see https://www.bitrue.com/api-docs#current-all-open-orders-user_data-hmac-sha256
|
|
60899
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#current-all-open-orders-user_data-hmac-sha256
|
|
60031
60900
|
* @param {string} symbol unified market symbol
|
|
60032
60901
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
60033
60902
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -60039,10 +60908,29 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60039
60908
|
}
|
|
60040
60909
|
await this.loadMarkets();
|
|
60041
60910
|
const market = this.market(symbol);
|
|
60042
|
-
|
|
60043
|
-
|
|
60044
|
-
};
|
|
60045
|
-
|
|
60911
|
+
let response = undefined;
|
|
60912
|
+
let data = undefined;
|
|
60913
|
+
const request = {};
|
|
60914
|
+
if (market['swap']) {
|
|
60915
|
+
request['contractName'] = market['id'];
|
|
60916
|
+
if (market['linear']) {
|
|
60917
|
+
response = await this.fapiV2PrivateGetOpenOrders(this.extend(request, params));
|
|
60918
|
+
}
|
|
60919
|
+
else if (market['inverse']) {
|
|
60920
|
+
response = await this.dapiV2PrivateGetOpenOrders(this.extend(request, params));
|
|
60921
|
+
}
|
|
60922
|
+
data = this.safeValue(response, 'data', []);
|
|
60923
|
+
}
|
|
60924
|
+
else if (market['spot']) {
|
|
60925
|
+
request['symbol'] = market['id'];
|
|
60926
|
+
response = await this.spotV1PrivateGetOpenOrders(this.extend(request, params));
|
|
60927
|
+
data = response;
|
|
60928
|
+
}
|
|
60929
|
+
else {
|
|
60930
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders only support spot & swap markets');
|
|
60931
|
+
}
|
|
60932
|
+
//
|
|
60933
|
+
// spot
|
|
60046
60934
|
//
|
|
60047
60935
|
// [
|
|
60048
60936
|
// {
|
|
@@ -60065,13 +60953,38 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60065
60953
|
// }
|
|
60066
60954
|
// ]
|
|
60067
60955
|
//
|
|
60068
|
-
|
|
60956
|
+
// swap
|
|
60957
|
+
//
|
|
60958
|
+
// {
|
|
60959
|
+
// "code": "0",
|
|
60960
|
+
// "msg": "Success",
|
|
60961
|
+
// "data": [{
|
|
60962
|
+
// "orderId": 1917641,
|
|
60963
|
+
// "clientOrderId": "2488514315",
|
|
60964
|
+
// "price": 100,
|
|
60965
|
+
// "origQty": 10,
|
|
60966
|
+
// "origAmount": 10,
|
|
60967
|
+
// "executedQty": 1,
|
|
60968
|
+
// "avgPrice": 12451,
|
|
60969
|
+
// "status": "INIT",
|
|
60970
|
+
// "type": "LIMIT",
|
|
60971
|
+
// "side": "BUY",
|
|
60972
|
+
// "action": "OPEN",
|
|
60973
|
+
// "transactTime": 1686717303975
|
|
60974
|
+
// }
|
|
60975
|
+
// ]
|
|
60976
|
+
// }
|
|
60977
|
+
//
|
|
60978
|
+
return this.parseOrders(data, market, since, limit);
|
|
60069
60979
|
}
|
|
60070
60980
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
60071
60981
|
/**
|
|
60072
60982
|
* @method
|
|
60073
60983
|
* @name bitrue#cancelOrder
|
|
60074
60984
|
* @description cancels an open order
|
|
60985
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#cancel-order-trade
|
|
60986
|
+
* @see https://www.bitrue.com/api-docs#cancel-order-trade-hmac-sha256
|
|
60987
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#cancel-order-trade-hmac-sha256
|
|
60075
60988
|
* @param {string} id order id
|
|
60076
60989
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
60077
60990
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
@@ -60083,20 +60996,41 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60083
60996
|
await this.loadMarkets();
|
|
60084
60997
|
const market = this.market(symbol);
|
|
60085
60998
|
const origClientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
// "newClientOrderId": id,
|
|
60091
|
-
};
|
|
60999
|
+
params = this.omit(params, ['origClientOrderId', 'clientOrderId']);
|
|
61000
|
+
let response = undefined;
|
|
61001
|
+
let data = undefined;
|
|
61002
|
+
const request = {};
|
|
60092
61003
|
if (origClientOrderId === undefined) {
|
|
60093
61004
|
request['orderId'] = id;
|
|
60094
61005
|
}
|
|
60095
61006
|
else {
|
|
60096
|
-
|
|
61007
|
+
if (market['swap']) {
|
|
61008
|
+
request['clientOrderId'] = origClientOrderId;
|
|
61009
|
+
}
|
|
61010
|
+
else {
|
|
61011
|
+
request['origClientOrderId'] = origClientOrderId;
|
|
61012
|
+
}
|
|
61013
|
+
}
|
|
61014
|
+
if (market['swap']) {
|
|
61015
|
+
request['contractName'] = market['id'];
|
|
61016
|
+
if (market['linear']) {
|
|
61017
|
+
response = await this.fapiV2PrivatePostCancel(this.extend(request, params));
|
|
61018
|
+
}
|
|
61019
|
+
else if (market['inverse']) {
|
|
61020
|
+
response = await this.dapiV2PrivatePostCancel(this.extend(request, params));
|
|
61021
|
+
}
|
|
61022
|
+
data = this.safeValue(response, 'data', {});
|
|
60097
61023
|
}
|
|
60098
|
-
|
|
60099
|
-
|
|
61024
|
+
else if (market['spot']) {
|
|
61025
|
+
request['symbol'] = market['id'];
|
|
61026
|
+
response = await this.spotV1PrivateDeleteOrder(this.extend(request, params));
|
|
61027
|
+
data = response;
|
|
61028
|
+
}
|
|
61029
|
+
else {
|
|
61030
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder only support spot & swap markets');
|
|
61031
|
+
}
|
|
61032
|
+
//
|
|
61033
|
+
// spot
|
|
60100
61034
|
//
|
|
60101
61035
|
// {
|
|
60102
61036
|
// "symbol": "LTCBTC",
|
|
@@ -60105,43 +61039,111 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60105
61039
|
// "clientOrderId": "cancelMyOrder1"
|
|
60106
61040
|
// }
|
|
60107
61041
|
//
|
|
60108
|
-
|
|
61042
|
+
// swap
|
|
61043
|
+
//
|
|
61044
|
+
// {
|
|
61045
|
+
// "code": "0",
|
|
61046
|
+
// "msg": "Success",
|
|
61047
|
+
// "data": {
|
|
61048
|
+
// "orderId": 1690615847831143159
|
|
61049
|
+
// }
|
|
61050
|
+
// }
|
|
61051
|
+
//
|
|
61052
|
+
return this.parseOrder(data, market);
|
|
61053
|
+
}
|
|
61054
|
+
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
61055
|
+
/**
|
|
61056
|
+
* @method
|
|
61057
|
+
* @name bitrue#cancelAllOrders
|
|
61058
|
+
* @description cancel all open orders in a market
|
|
61059
|
+
* @see https://www.bitrue.com/api-docs#cancel-all-open-orders-trade-hmac-sha256
|
|
61060
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#cancel-all-open-orders-trade-hmac-sha256
|
|
61061
|
+
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
61062
|
+
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
61063
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
61064
|
+
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
61065
|
+
*/
|
|
61066
|
+
await this.loadMarkets();
|
|
61067
|
+
const market = this.market(symbol);
|
|
61068
|
+
let response = undefined;
|
|
61069
|
+
let data = undefined;
|
|
61070
|
+
if (market['swap']) {
|
|
61071
|
+
const request = {
|
|
61072
|
+
'contractName': market['id'],
|
|
61073
|
+
};
|
|
61074
|
+
if (market['linear']) {
|
|
61075
|
+
response = await this.fapiV2PrivatePostAllOpenOrders(this.extend(request, params));
|
|
61076
|
+
}
|
|
61077
|
+
else if (market['inverse']) {
|
|
61078
|
+
response = await this.dapiV2PrivatePostAllOpenOrders(this.extend(request, params));
|
|
61079
|
+
}
|
|
61080
|
+
data = this.safeValue(response, 'data', []);
|
|
61081
|
+
}
|
|
61082
|
+
else {
|
|
61083
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelAllOrders only support future markets');
|
|
61084
|
+
}
|
|
61085
|
+
//
|
|
61086
|
+
// swap
|
|
61087
|
+
//
|
|
61088
|
+
// {
|
|
61089
|
+
// 'code': '0',
|
|
61090
|
+
// 'msg': 'Success',
|
|
61091
|
+
// 'data': null
|
|
61092
|
+
// }
|
|
61093
|
+
//
|
|
61094
|
+
return this.parseOrders(data, market);
|
|
60109
61095
|
}
|
|
60110
61096
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
60111
61097
|
/**
|
|
60112
61098
|
* @method
|
|
60113
61099
|
* @name bitrue#fetchMyTrades
|
|
60114
61100
|
* @description fetch all trades made by the user
|
|
61101
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#account-trade-list-user_data
|
|
61102
|
+
* @see https://www.bitrue.com/api-docs#account-trade-list-user_data-hmac-sha256
|
|
61103
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#account-trade-list-user_data-hmac-sha256
|
|
60115
61104
|
* @param {string} symbol unified market symbol
|
|
60116
61105
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
60117
61106
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
60118
61107
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
60119
61108
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
60120
61109
|
*/
|
|
60121
|
-
const method = this.safeString(this.options, 'fetchMyTradesMethod', 'v2PrivateGetMyTrades');
|
|
60122
|
-
if ((symbol === undefined) && (method === 'v2PrivateGetMyTrades')) {
|
|
60123
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' v2PrivateGetMyTrades() requires a symbol argument');
|
|
60124
|
-
}
|
|
60125
61110
|
await this.loadMarkets();
|
|
60126
|
-
|
|
60127
|
-
|
|
60128
|
-
// 'startTime': since,
|
|
60129
|
-
// 'endTime': this.milliseconds (),
|
|
60130
|
-
// 'fromId': 12345, // trade id to fetch from, most recent trades by default
|
|
60131
|
-
// 'limit': limit, // default 100, max 1000
|
|
60132
|
-
};
|
|
60133
|
-
let market = undefined;
|
|
60134
|
-
if (symbol !== undefined) {
|
|
60135
|
-
market = this.market(symbol);
|
|
60136
|
-
request['symbol'] = market['id'];
|
|
61111
|
+
if (symbol === undefined) {
|
|
61112
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
60137
61113
|
}
|
|
61114
|
+
const market = this.market(symbol);
|
|
61115
|
+
let response = undefined;
|
|
61116
|
+
let data = undefined;
|
|
61117
|
+
const request = {};
|
|
60138
61118
|
if (since !== undefined) {
|
|
60139
61119
|
request['startTime'] = since;
|
|
60140
61120
|
}
|
|
60141
61121
|
if (limit !== undefined) {
|
|
61122
|
+
if (limit > 1000) {
|
|
61123
|
+
limit = 1000;
|
|
61124
|
+
}
|
|
60142
61125
|
request['limit'] = limit;
|
|
60143
61126
|
}
|
|
60144
|
-
|
|
61127
|
+
if (market['swap']) {
|
|
61128
|
+
request['contractName'] = market['id'];
|
|
61129
|
+
if (market['linear']) {
|
|
61130
|
+
response = await this.fapiV2PrivateGetMyTrades(this.extend(request, params));
|
|
61131
|
+
}
|
|
61132
|
+
else if (market['inverse']) {
|
|
61133
|
+
response = await this.dapiV2PrivateGetMyTrades(this.extend(request, params));
|
|
61134
|
+
}
|
|
61135
|
+
data = this.safeValue(response, 'data', []);
|
|
61136
|
+
}
|
|
61137
|
+
else if (market['spot']) {
|
|
61138
|
+
request['symbol'] = market['id'];
|
|
61139
|
+
response = await this.spotV2PrivateGetMyTrades(this.extend(request, params));
|
|
61140
|
+
data = response;
|
|
61141
|
+
}
|
|
61142
|
+
else {
|
|
61143
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades only support spot & swap markets');
|
|
61144
|
+
}
|
|
61145
|
+
//
|
|
61146
|
+
// spot
|
|
60145
61147
|
//
|
|
60146
61148
|
// [
|
|
60147
61149
|
// {
|
|
@@ -60160,13 +61162,39 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60160
61162
|
// }
|
|
60161
61163
|
// ]
|
|
60162
61164
|
//
|
|
60163
|
-
|
|
61165
|
+
// swap
|
|
61166
|
+
//
|
|
61167
|
+
// {
|
|
61168
|
+
// "code":"0",
|
|
61169
|
+
// "msg":"Success",
|
|
61170
|
+
// "data":[
|
|
61171
|
+
// {
|
|
61172
|
+
// "tradeId":12,
|
|
61173
|
+
// "price":0.9,
|
|
61174
|
+
// "qty":1,
|
|
61175
|
+
// "amount":9,
|
|
61176
|
+
// "contractName":"E-SAND-USDT",
|
|
61177
|
+
// "side":"BUY",
|
|
61178
|
+
// "fee":"0.0018",
|
|
61179
|
+
// "bidId":1558124009467904992,
|
|
61180
|
+
// "askId":1558124043827644908,
|
|
61181
|
+
// "bidUserId":10294,
|
|
61182
|
+
// "askUserId":10467,
|
|
61183
|
+
// "isBuyer":true,
|
|
61184
|
+
// "isMaker":true,
|
|
61185
|
+
// "ctime":1678426306000
|
|
61186
|
+
// }
|
|
61187
|
+
// ]
|
|
61188
|
+
// }
|
|
61189
|
+
//
|
|
61190
|
+
return this.parseTrades(data, market, since, limit);
|
|
60164
61191
|
}
|
|
60165
61192
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
60166
61193
|
/**
|
|
60167
61194
|
* @method
|
|
60168
61195
|
* @name bitrue#fetchDeposits
|
|
60169
61196
|
* @description fetch all deposits made to an account
|
|
61197
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#deposit-history--withdraw_data
|
|
60170
61198
|
* @param {string} code unified currency code
|
|
60171
61199
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
60172
61200
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -60193,7 +61221,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60193
61221
|
if (limit !== undefined) {
|
|
60194
61222
|
request['limit'] = limit;
|
|
60195
61223
|
}
|
|
60196
|
-
const response = await this.
|
|
61224
|
+
const response = await this.spotV1PrivateGetDepositHistory(this.extend(request, params));
|
|
60197
61225
|
//
|
|
60198
61226
|
// {
|
|
60199
61227
|
// "code":200,
|
|
@@ -60238,6 +61266,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60238
61266
|
* @method
|
|
60239
61267
|
* @name bitrue#fetchWithdrawals
|
|
60240
61268
|
* @description fetch all withdrawals made from an account
|
|
61269
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#withdraw-history--withdraw_data
|
|
60241
61270
|
* @param {string} code unified currency code
|
|
60242
61271
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
60243
61272
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -60264,7 +61293,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60264
61293
|
if (limit !== undefined) {
|
|
60265
61294
|
request['limit'] = limit;
|
|
60266
61295
|
}
|
|
60267
|
-
const response = await this.
|
|
61296
|
+
const response = await this.spotV1PrivateGetWithdrawHistory(this.extend(request, params));
|
|
60268
61297
|
//
|
|
60269
61298
|
// {
|
|
60270
61299
|
// "code": 200,
|
|
@@ -60428,6 +61457,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60428
61457
|
* @method
|
|
60429
61458
|
* @name bitrue#withdraw
|
|
60430
61459
|
* @description make a withdrawal
|
|
61460
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#withdraw-commit--withdraw_data
|
|
60431
61461
|
* @param {string} code unified currency code
|
|
60432
61462
|
* @param {float} amount the amount to withdraw
|
|
60433
61463
|
* @param {string} address the address to withdraw to
|
|
@@ -60439,7 +61469,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60439
61469
|
this.checkAddress(address);
|
|
60440
61470
|
await this.loadMarkets();
|
|
60441
61471
|
const currency = this.currency(code);
|
|
60442
|
-
let chainName = this.
|
|
61472
|
+
let chainName = this.safeString2(params, 'network', 'chainName');
|
|
60443
61473
|
if (chainName === undefined) {
|
|
60444
61474
|
const networks = this.safeValue(currency, 'networks', {});
|
|
60445
61475
|
const optionsNetworks = this.safeValue(this.options, 'networks', {});
|
|
@@ -60464,7 +61494,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60464
61494
|
if (tag !== undefined) {
|
|
60465
61495
|
request['tag'] = tag;
|
|
60466
61496
|
}
|
|
60467
|
-
const response = await this.
|
|
61497
|
+
const response = await this.spotV1PrivatePostWithdrawCommit(this.extend(request, params));
|
|
60468
61498
|
//
|
|
60469
61499
|
// {
|
|
60470
61500
|
// "code": 200,
|
|
@@ -60480,7 +61510,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60480
61510
|
// }
|
|
60481
61511
|
// }
|
|
60482
61512
|
//
|
|
60483
|
-
const data = this.safeValue(response, 'data');
|
|
61513
|
+
const data = this.safeValue(response, 'data', {});
|
|
60484
61514
|
return this.parseTransaction(data, currency);
|
|
60485
61515
|
}
|
|
60486
61516
|
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
@@ -60535,33 +61565,289 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60535
61565
|
* @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
60536
61566
|
*/
|
|
60537
61567
|
await this.loadMarkets();
|
|
60538
|
-
const response = await this.
|
|
61568
|
+
const response = await this.spotV1PublicGetExchangeInfo(params);
|
|
60539
61569
|
const coins = this.safeValue(response, 'coins');
|
|
60540
61570
|
return this.parseDepositWithdrawFees(coins, codes, 'coin');
|
|
60541
61571
|
}
|
|
61572
|
+
parseTransfer(transfer, currency = undefined) {
|
|
61573
|
+
//
|
|
61574
|
+
// fetchTransfers
|
|
61575
|
+
//
|
|
61576
|
+
// {
|
|
61577
|
+
// 'transferType': 'wallet_to_contract',
|
|
61578
|
+
// 'symbol': 'USDT',
|
|
61579
|
+
// 'amount': 1.0,
|
|
61580
|
+
// 'status': 1,
|
|
61581
|
+
// 'ctime': 1685404575000
|
|
61582
|
+
// }
|
|
61583
|
+
//
|
|
61584
|
+
// transfer
|
|
61585
|
+
//
|
|
61586
|
+
// {}
|
|
61587
|
+
//
|
|
61588
|
+
const transferType = this.safeString(transfer, 'transferType');
|
|
61589
|
+
let fromAccount = undefined;
|
|
61590
|
+
let toAccount = undefined;
|
|
61591
|
+
if (transferType !== undefined) {
|
|
61592
|
+
const accountSplit = transferType.split('_to_');
|
|
61593
|
+
fromAccount = this.safeString(accountSplit, 0);
|
|
61594
|
+
toAccount = this.safeString(accountSplit, 1);
|
|
61595
|
+
}
|
|
61596
|
+
const timestamp = this.safeInteger(transfer, 'ctime');
|
|
61597
|
+
return {
|
|
61598
|
+
'info': transfer,
|
|
61599
|
+
'id': undefined,
|
|
61600
|
+
'timestamp': timestamp,
|
|
61601
|
+
'datetime': this.iso8601(timestamp),
|
|
61602
|
+
'currency': this.safeString(currency, 'code'),
|
|
61603
|
+
'amount': this.safeNumber(transfer, 'amount'),
|
|
61604
|
+
'fromAccount': fromAccount,
|
|
61605
|
+
'toAccount': toAccount,
|
|
61606
|
+
'status': 'ok',
|
|
61607
|
+
};
|
|
61608
|
+
}
|
|
61609
|
+
async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
61610
|
+
/**
|
|
61611
|
+
* @method
|
|
61612
|
+
* @name bitrue#fetchTransfers
|
|
61613
|
+
* @description fetch a history of internal transfers made on an account
|
|
61614
|
+
* @see https://www.bitrue.com/api-docs#get-future-account-transfer-history-list-user_data-hmac-sha256
|
|
61615
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#get-future-account-transfer-history-list-user_data-hmac-sha256
|
|
61616
|
+
* @param {string} code unified currency code of the currency transferred
|
|
61617
|
+
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
61618
|
+
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
61619
|
+
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
61620
|
+
* @param {int} [params.until] the latest time in ms to fetch transfers for
|
|
61621
|
+
* @param {string} [params.type] transfer type wallet_to_contract or contract_to_wallet
|
|
61622
|
+
* @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
61623
|
+
*/
|
|
61624
|
+
await this.loadMarkets();
|
|
61625
|
+
const type = this.safeString2(params, 'type', 'transferType');
|
|
61626
|
+
const request = {
|
|
61627
|
+
'transferType': type,
|
|
61628
|
+
};
|
|
61629
|
+
let currency = undefined;
|
|
61630
|
+
if (code !== undefined) {
|
|
61631
|
+
currency = this.currency(code);
|
|
61632
|
+
request['coinSymbol'] = currency['id'];
|
|
61633
|
+
}
|
|
61634
|
+
if (since !== undefined) {
|
|
61635
|
+
request['beginTime'] = since;
|
|
61636
|
+
}
|
|
61637
|
+
if (limit !== undefined) {
|
|
61638
|
+
if (limit > 200) {
|
|
61639
|
+
limit = 200;
|
|
61640
|
+
}
|
|
61641
|
+
request['limit'] = limit;
|
|
61642
|
+
}
|
|
61643
|
+
const until = this.safeInteger(params, 'until');
|
|
61644
|
+
if (until !== undefined) {
|
|
61645
|
+
params = this.omit(params, 'until');
|
|
61646
|
+
request['endTime'] = until;
|
|
61647
|
+
}
|
|
61648
|
+
const response = await this.fapiV2PrivateGetFuturesTransferHistory(this.extend(request, params));
|
|
61649
|
+
//
|
|
61650
|
+
// {
|
|
61651
|
+
// 'code': '0',
|
|
61652
|
+
// 'msg': 'Success',
|
|
61653
|
+
// 'data': [{
|
|
61654
|
+
// 'transferType': 'wallet_to_contract',
|
|
61655
|
+
// 'symbol': 'USDT',
|
|
61656
|
+
// 'amount': 1.0,
|
|
61657
|
+
// 'status': 1,
|
|
61658
|
+
// 'ctime': 1685404575000
|
|
61659
|
+
// }]
|
|
61660
|
+
// }
|
|
61661
|
+
//
|
|
61662
|
+
const data = this.safeValue(response, 'data', {});
|
|
61663
|
+
return this.parseTransfers(data, currency, since, limit);
|
|
61664
|
+
}
|
|
61665
|
+
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
61666
|
+
/**
|
|
61667
|
+
* @method
|
|
61668
|
+
* @name bitrue#transfer
|
|
61669
|
+
* @description transfer currency internally between wallets on the same account
|
|
61670
|
+
* @see https://www.bitrue.com/api-docs#new-future-account-transfer-user_data-hmac-sha256
|
|
61671
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#user-commission-rate-user_data-hmac-sha256
|
|
61672
|
+
* @param {string} code unified currency code
|
|
61673
|
+
* @param {float} amount amount to transfer
|
|
61674
|
+
* @param {string} fromAccount account to transfer from
|
|
61675
|
+
* @param {string} toAccount account to transfer to
|
|
61676
|
+
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
61677
|
+
* @returns {object} a [transfer structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
61678
|
+
*/
|
|
61679
|
+
await this.loadMarkets();
|
|
61680
|
+
const currency = this.currency(code);
|
|
61681
|
+
const accountTypes = this.safeValue(this.options, 'accountsByType', {});
|
|
61682
|
+
const fromId = this.safeString(accountTypes, fromAccount, fromAccount);
|
|
61683
|
+
const toId = this.safeString(accountTypes, toAccount, toAccount);
|
|
61684
|
+
const request = {
|
|
61685
|
+
'coinSymbol': currency['id'],
|
|
61686
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
61687
|
+
'transferType': fromId + '_to_' + toId,
|
|
61688
|
+
};
|
|
61689
|
+
const response = await this.fapiV2PrivatePostFuturesTransfer(this.extend(request, params));
|
|
61690
|
+
//
|
|
61691
|
+
// {
|
|
61692
|
+
// 'code': '0',
|
|
61693
|
+
// 'msg': 'Success',
|
|
61694
|
+
// 'data': null
|
|
61695
|
+
// }
|
|
61696
|
+
//
|
|
61697
|
+
const data = this.safeValue(response, 'data', {});
|
|
61698
|
+
return this.parseTransfer(data, currency);
|
|
61699
|
+
}
|
|
61700
|
+
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
61701
|
+
/**
|
|
61702
|
+
* @method
|
|
61703
|
+
* @name bitrue#setLeverage
|
|
61704
|
+
* @description set the level of leverage for a market
|
|
61705
|
+
* @see https://www.bitrue.com/api-docs#change-initial-leverage-trade-hmac-sha256
|
|
61706
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#change-initial-leverage-trade-hmac-sha256
|
|
61707
|
+
* @param {float} leverage the rate of leverage
|
|
61708
|
+
* @param {string} symbol unified market symbol
|
|
61709
|
+
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
61710
|
+
* @returns {object} response from the exchange
|
|
61711
|
+
*/
|
|
61712
|
+
if (symbol === undefined) {
|
|
61713
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
61714
|
+
}
|
|
61715
|
+
if ((leverage < 1) || (leverage > 125)) {
|
|
61716
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' leverage should be between 1 and 125');
|
|
61717
|
+
}
|
|
61718
|
+
await this.loadMarkets();
|
|
61719
|
+
const market = this.market(symbol);
|
|
61720
|
+
let response = undefined;
|
|
61721
|
+
const request = {
|
|
61722
|
+
'contractName': market['id'],
|
|
61723
|
+
'leverage': leverage,
|
|
61724
|
+
};
|
|
61725
|
+
if (!market['swap']) {
|
|
61726
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setLeverage only support swap markets');
|
|
61727
|
+
}
|
|
61728
|
+
if (market['linear']) {
|
|
61729
|
+
response = await this.fapiV2PrivatePostLevelEdit(this.extend(request, params));
|
|
61730
|
+
}
|
|
61731
|
+
else if (market['inverse']) {
|
|
61732
|
+
response = await this.dapiV2PrivatePostLevelEdit(this.extend(request, params));
|
|
61733
|
+
}
|
|
61734
|
+
return response;
|
|
61735
|
+
}
|
|
61736
|
+
parseMarginModification(data, market = undefined) {
|
|
61737
|
+
return {
|
|
61738
|
+
'info': data,
|
|
61739
|
+
'type': undefined,
|
|
61740
|
+
'amount': undefined,
|
|
61741
|
+
'code': undefined,
|
|
61742
|
+
'symbol': market['symbol'],
|
|
61743
|
+
'status': undefined,
|
|
61744
|
+
};
|
|
61745
|
+
}
|
|
61746
|
+
async setMargin(symbol, amount, params = {}) {
|
|
61747
|
+
/**
|
|
61748
|
+
* @method
|
|
61749
|
+
* @name bitrue#setMargin
|
|
61750
|
+
* @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
|
|
61751
|
+
* @see https://www.bitrue.com/api-docs#modify-isolated-position-margin-trade-hmac-sha256
|
|
61752
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#modify-isolated-position-margin-trade-hmac-sha256
|
|
61753
|
+
* @param {string} symbol unified market symbol of the market to set margin in
|
|
61754
|
+
* @param {float} amount the amount to set the margin to
|
|
61755
|
+
* @param {object} [params] parameters specific to the bitrue api endpoint
|
|
61756
|
+
* @returns {object} A [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure}
|
|
61757
|
+
*/
|
|
61758
|
+
await this.loadMarkets();
|
|
61759
|
+
const market = this.market(symbol);
|
|
61760
|
+
if (!market['swap']) {
|
|
61761
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setMargin only support swap markets');
|
|
61762
|
+
}
|
|
61763
|
+
let response = undefined;
|
|
61764
|
+
const request = {
|
|
61765
|
+
'contractName': market['id'],
|
|
61766
|
+
'amount': this.parseToNumeric(amount),
|
|
61767
|
+
};
|
|
61768
|
+
if (market['linear']) {
|
|
61769
|
+
response = await this.fapiV2PrivatePostPositionMargin(this.extend(request, params));
|
|
61770
|
+
}
|
|
61771
|
+
else if (market['inverse']) {
|
|
61772
|
+
response = await this.dapiV2PrivatePostPositionMargin(this.extend(request, params));
|
|
61773
|
+
}
|
|
61774
|
+
//
|
|
61775
|
+
// {
|
|
61776
|
+
// "code": 0,
|
|
61777
|
+
// "msg": "success"
|
|
61778
|
+
// "data": null
|
|
61779
|
+
// }
|
|
61780
|
+
//
|
|
61781
|
+
return this.parseMarginModification(response, market);
|
|
61782
|
+
}
|
|
60542
61783
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
60543
|
-
const
|
|
60544
|
-
const
|
|
60545
|
-
|
|
61784
|
+
const type = this.safeString(api, 0);
|
|
61785
|
+
const version = this.safeString(api, 1);
|
|
61786
|
+
const access = this.safeString(api, 2);
|
|
61787
|
+
let url = undefined;
|
|
61788
|
+
if (type === 'api' && version === 'kline') {
|
|
61789
|
+
url = this.urls['api'][type];
|
|
61790
|
+
}
|
|
61791
|
+
else {
|
|
61792
|
+
url = this.urls['api'][type] + '/' + version;
|
|
61793
|
+
}
|
|
61794
|
+
url = url + '/' + this.implodeParams(path, params);
|
|
60546
61795
|
params = this.omit(params, this.extractParams(path));
|
|
60547
61796
|
if (access === 'private') {
|
|
60548
61797
|
this.checkRequiredCredentials();
|
|
60549
61798
|
const recvWindow = this.safeInteger(this.options, 'recvWindow', 5000);
|
|
60550
|
-
|
|
60551
|
-
|
|
60552
|
-
|
|
60553
|
-
|
|
60554
|
-
|
|
60555
|
-
|
|
60556
|
-
|
|
60557
|
-
|
|
60558
|
-
|
|
60559
|
-
|
|
60560
|
-
|
|
61799
|
+
if (type === 'spot') {
|
|
61800
|
+
let query = this.urlencode(this.extend({
|
|
61801
|
+
'timestamp': this.nonce(),
|
|
61802
|
+
'recvWindow': recvWindow,
|
|
61803
|
+
}, params));
|
|
61804
|
+
const signature = this.hmac(this.encode(query), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
61805
|
+
query += '&' + 'signature=' + signature;
|
|
61806
|
+
headers = {
|
|
61807
|
+
'X-MBX-APIKEY': this.apiKey,
|
|
61808
|
+
};
|
|
61809
|
+
if ((method === 'GET') || (method === 'DELETE')) {
|
|
61810
|
+
url += '?' + query;
|
|
61811
|
+
}
|
|
61812
|
+
else {
|
|
61813
|
+
body = query;
|
|
61814
|
+
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
61815
|
+
}
|
|
60561
61816
|
}
|
|
60562
61817
|
else {
|
|
60563
|
-
|
|
60564
|
-
|
|
61818
|
+
const timestamp = this.nonce().toString();
|
|
61819
|
+
let signPath = undefined;
|
|
61820
|
+
if (type === 'fapi') {
|
|
61821
|
+
signPath = '/fapi';
|
|
61822
|
+
}
|
|
61823
|
+
else if (type === 'dapi') {
|
|
61824
|
+
signPath = '/dapi';
|
|
61825
|
+
}
|
|
61826
|
+
signPath = signPath + '/' + version + '/' + path;
|
|
61827
|
+
let signMessage = timestamp + method + signPath;
|
|
61828
|
+
if (method === 'GET') {
|
|
61829
|
+
const signature = this.hmac(this.encode(signMessage), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
61830
|
+
headers = {
|
|
61831
|
+
'X-CH-APIKEY': this.apiKey,
|
|
61832
|
+
'X-CH-SIGN': signature,
|
|
61833
|
+
'X-CH-TS': timestamp,
|
|
61834
|
+
};
|
|
61835
|
+
url += '?' + this.urlencode(params);
|
|
61836
|
+
}
|
|
61837
|
+
else {
|
|
61838
|
+
const query = this.extend({
|
|
61839
|
+
'recvWindow': recvWindow,
|
|
61840
|
+
}, params);
|
|
61841
|
+
body = this.json(query);
|
|
61842
|
+
signMessage = signMessage + JSON.stringify(body);
|
|
61843
|
+
const signature = this.hmac(this.encode(signMessage), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
61844
|
+
headers = {
|
|
61845
|
+
'Content-Type': 'application/json',
|
|
61846
|
+
'X-CH-APIKEY': this.apiKey,
|
|
61847
|
+
'X-CH-SIGN': signature,
|
|
61848
|
+
'X-CH-TS': timestamp,
|
|
61849
|
+
};
|
|
61850
|
+
}
|
|
60565
61851
|
}
|
|
60566
61852
|
}
|
|
60567
61853
|
else {
|
|
@@ -79914,7 +81200,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
79914
81200
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
79915
81201
|
*/
|
|
79916
81202
|
let symbol = undefined;
|
|
79917
|
-
if (Array.isArray(symbols)) {
|
|
81203
|
+
if ((symbols !== undefined) && Array.isArray(symbols)) {
|
|
79918
81204
|
const symbolsLength = symbols.length;
|
|
79919
81205
|
if (symbolsLength > 1) {
|
|
79920
81206
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchPositions() does not accept an array with more than one symbol');
|
|
@@ -83713,12 +84999,17 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83713
84999
|
'fiat',
|
|
83714
85000
|
// 'vault',
|
|
83715
85001
|
],
|
|
85002
|
+
'v3Accounts': [
|
|
85003
|
+
'ACCOUNT_TYPE_CRYPTO',
|
|
85004
|
+
'ACCOUNT_TYPE_FIAT',
|
|
85005
|
+
],
|
|
83716
85006
|
'createMarketBuyOrderRequiresPrice': true,
|
|
83717
85007
|
'advanced': true,
|
|
83718
85008
|
'fetchMarkets': 'fetchMarketsV3',
|
|
83719
85009
|
'fetchTicker': 'fetchTickerV3',
|
|
83720
85010
|
'fetchTickers': 'fetchTickersV3',
|
|
83721
85011
|
'fetchAccounts': 'fetchAccountsV3',
|
|
85012
|
+
'fetchBalance': 'v2PrivateGetAccounts',
|
|
83722
85013
|
'user_native_currency': 'USD', // needed to get fees for v3
|
|
83723
85014
|
},
|
|
83724
85015
|
});
|
|
@@ -83728,6 +85019,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83728
85019
|
* @method
|
|
83729
85020
|
* @name coinbase#fetchTime
|
|
83730
85021
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
85022
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
|
|
83731
85023
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83732
85024
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
83733
85025
|
*/
|
|
@@ -83748,6 +85040,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83748
85040
|
* @method
|
|
83749
85041
|
* @name coinbase#fetchAccounts
|
|
83750
85042
|
* @description fetch all the accounts associated with a profile
|
|
85043
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts
|
|
85044
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
|
|
83751
85045
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83752
85046
|
* @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)
|
|
83753
85047
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
@@ -83951,6 +85245,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
83951
85245
|
* @method
|
|
83952
85246
|
* @name coinbase#createDepositAddress
|
|
83953
85247
|
* @description create a currency deposit address
|
|
85248
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-addresses#create-address
|
|
83954
85249
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
83955
85250
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83956
85251
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -84025,6 +85320,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84025
85320
|
* @method
|
|
84026
85321
|
* @name coinbase#fetchMySells
|
|
84027
85322
|
* @description fetch sells
|
|
85323
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-sells#list-sells
|
|
84028
85324
|
* @param {string} symbol not used by coinbase fetchMySells ()
|
|
84029
85325
|
* @param {int} [since] timestamp in ms of the earliest sell, default is undefined
|
|
84030
85326
|
* @param {int} [limit] max number of sells to return, default is undefined
|
|
@@ -84043,6 +85339,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84043
85339
|
* @method
|
|
84044
85340
|
* @name coinbase#fetchMyBuys
|
|
84045
85341
|
* @description fetch buys
|
|
85342
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-buys#list-buys
|
|
84046
85343
|
* @param {string} symbol not used by coinbase fetchMyBuys ()
|
|
84047
85344
|
* @param {int} [since] timestamp in ms of the earliest buy, default is undefined
|
|
84048
85345
|
* @param {int} [limit] max number of buys to return, default is undefined
|
|
@@ -84068,6 +85365,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84068
85365
|
* @method
|
|
84069
85366
|
* @name coinbase#fetchWithdrawals
|
|
84070
85367
|
* @description fetch all withdrawals made from an account
|
|
85368
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-withdrawals#list-withdrawals
|
|
84071
85369
|
* @param {string} code unified currency code
|
|
84072
85370
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
84073
85371
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -84082,6 +85380,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84082
85380
|
* @method
|
|
84083
85381
|
* @name coinbase#fetchDeposits
|
|
84084
85382
|
* @description fetch all deposits made to an account
|
|
85383
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#list-deposits
|
|
84085
85384
|
* @param {string} code unified currency code
|
|
84086
85385
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
84087
85386
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -84340,6 +85639,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84340
85639
|
* @method
|
|
84341
85640
|
* @name coinbase#fetchMarkets
|
|
84342
85641
|
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
|
|
85642
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
|
85643
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84343
85644
|
* @description retrieves data on all markets for coinbase
|
|
84344
85645
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
84345
85646
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -84563,6 +85864,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84563
85864
|
* @method
|
|
84564
85865
|
* @name coinbase#fetchCurrencies
|
|
84565
85866
|
* @description fetches all available currencies on an exchange
|
|
85867
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
|
85868
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84566
85869
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84567
85870
|
* @returns {object} an associative dictionary of currencies
|
|
84568
85871
|
*/
|
|
@@ -84638,6 +85941,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84638
85941
|
* @method
|
|
84639
85942
|
* @name coinbase#fetchTickers
|
|
84640
85943
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
85944
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
|
|
85945
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
84641
85946
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
84642
85947
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84643
85948
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -84739,6 +86044,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84739
86044
|
* @method
|
|
84740
86045
|
* @name coinbase#fetchTicker
|
|
84741
86046
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
86047
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getmarkettrades
|
|
86048
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-spot-price
|
|
86049
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-buy-price
|
|
86050
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
|
|
84742
86051
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
84743
86052
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
84744
86053
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -84929,8 +86238,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84929
86238
|
}, market);
|
|
84930
86239
|
}
|
|
84931
86240
|
parseBalance(response, params = {}) {
|
|
84932
|
-
const balances = this.
|
|
86241
|
+
const balances = this.safeValue2(response, 'data', 'accounts', []);
|
|
84933
86242
|
const accounts = this.safeValue(params, 'type', this.options['accounts']);
|
|
86243
|
+
const v3Accounts = this.safeValue(params, 'type', this.options['v3Accounts']);
|
|
84934
86244
|
const result = { 'info': response };
|
|
84935
86245
|
for (let b = 0; b < balances.length; b++) {
|
|
84936
86246
|
const balance = balances[b];
|
|
@@ -84955,6 +86265,30 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84955
86265
|
result[code] = account;
|
|
84956
86266
|
}
|
|
84957
86267
|
}
|
|
86268
|
+
else if (this.inArray(type, v3Accounts)) {
|
|
86269
|
+
const available = this.safeValue(balance, 'available_balance');
|
|
86270
|
+
const hold = this.safeValue(balance, 'hold');
|
|
86271
|
+
if (available !== undefined && hold !== undefined) {
|
|
86272
|
+
const currencyId = this.safeString(available, 'currency');
|
|
86273
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
86274
|
+
const used = this.safeString(hold, 'value');
|
|
86275
|
+
const free = this.safeString(available, 'value');
|
|
86276
|
+
const total = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(used, free);
|
|
86277
|
+
let account = this.safeValue(result, code);
|
|
86278
|
+
if (account === undefined) {
|
|
86279
|
+
account = this.account();
|
|
86280
|
+
account['free'] = free;
|
|
86281
|
+
account['used'] = used;
|
|
86282
|
+
account['total'] = total;
|
|
86283
|
+
}
|
|
86284
|
+
else {
|
|
86285
|
+
account['free'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['free'], free);
|
|
86286
|
+
account['used'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['used'], used);
|
|
86287
|
+
account['total'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(account['total'], total);
|
|
86288
|
+
}
|
|
86289
|
+
result[code] = account;
|
|
86290
|
+
}
|
|
86291
|
+
}
|
|
84958
86292
|
}
|
|
84959
86293
|
return this.safeBalance(result);
|
|
84960
86294
|
}
|
|
@@ -84963,15 +86297,28 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84963
86297
|
* @method
|
|
84964
86298
|
* @name coinbase#fetchBalance
|
|
84965
86299
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
86300
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts
|
|
86301
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
|
|
84966
86302
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
86303
|
+
* @param {boolean} [params.v3] default false, set true to use v3 api endpoint
|
|
84967
86304
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
84968
86305
|
*/
|
|
84969
86306
|
await this.loadMarkets();
|
|
84970
86307
|
const request = {
|
|
84971
86308
|
'limit': 100,
|
|
84972
86309
|
};
|
|
84973
|
-
|
|
86310
|
+
let response = undefined;
|
|
86311
|
+
const isV3 = this.safeValue(params, 'v3', false);
|
|
86312
|
+
params = this.omit(params, 'v3');
|
|
86313
|
+
const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
|
|
86314
|
+
if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
|
|
86315
|
+
response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
|
|
86316
|
+
}
|
|
86317
|
+
else {
|
|
86318
|
+
response = await this.v2PrivateGetAccounts(this.extend(request, params));
|
|
86319
|
+
}
|
|
84974
86320
|
//
|
|
86321
|
+
// v2PrivateGetAccounts
|
|
84975
86322
|
// {
|
|
84976
86323
|
// "pagination":{
|
|
84977
86324
|
// "ending_before":null,
|
|
@@ -85011,6 +86358,36 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85011
86358
|
// ]
|
|
85012
86359
|
// }
|
|
85013
86360
|
//
|
|
86361
|
+
// v3PrivateGetBrokerageAccounts
|
|
86362
|
+
// {
|
|
86363
|
+
// "accounts": [
|
|
86364
|
+
// {
|
|
86365
|
+
// "uuid": "11111111-1111-1111-1111-111111111111",
|
|
86366
|
+
// "name": "USDC Wallet",
|
|
86367
|
+
// "currency": "USDC",
|
|
86368
|
+
// "available_balance": {
|
|
86369
|
+
// "value": "0.0000000000000000",
|
|
86370
|
+
// "currency": "USDC"
|
|
86371
|
+
// },
|
|
86372
|
+
// "default": true,
|
|
86373
|
+
// "active": true,
|
|
86374
|
+
// "created_at": "2023-01-04T06:20:06.456Z",
|
|
86375
|
+
// "updated_at": "2023-01-04T06:20:07.181Z",
|
|
86376
|
+
// "deleted_at": null,
|
|
86377
|
+
// "type": "ACCOUNT_TYPE_CRYPTO",
|
|
86378
|
+
// "ready": false,
|
|
86379
|
+
// "hold": {
|
|
86380
|
+
// "value": "0.0000000000000000",
|
|
86381
|
+
// "currency": "USDC"
|
|
86382
|
+
// }
|
|
86383
|
+
// },
|
|
86384
|
+
// ...
|
|
86385
|
+
// ],
|
|
86386
|
+
// "has_next": false,
|
|
86387
|
+
// "cursor": "",
|
|
86388
|
+
// "size": 9
|
|
86389
|
+
// }
|
|
86390
|
+
//
|
|
85014
86391
|
return this.parseBalance(response, params);
|
|
85015
86392
|
}
|
|
85016
86393
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -85018,6 +86395,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85018
86395
|
* @method
|
|
85019
86396
|
* @name coinbase#fetchLedger
|
|
85020
86397
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
86398
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
|
|
85021
86399
|
* @param {string} code unified currency code, default is undefined
|
|
85022
86400
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
85023
86401
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -119723,7 +121101,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119723
121101
|
'future': true,
|
|
119724
121102
|
'option': true,
|
|
119725
121103
|
'addMargin': true,
|
|
119726
|
-
'borrowMargin': true,
|
|
119727
121104
|
'cancelAllOrders': true,
|
|
119728
121105
|
'cancelOrder': true,
|
|
119729
121106
|
'createMarketOrder': true,
|
|
@@ -119788,7 +121165,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119788
121165
|
'fetchVolatilityHistory': false,
|
|
119789
121166
|
'fetchWithdrawals': true,
|
|
119790
121167
|
'reduceMargin': true,
|
|
119791
|
-
'repayMargin': true,
|
|
119792
121168
|
'setLeverage': true,
|
|
119793
121169
|
'setMarginMode': false,
|
|
119794
121170
|
'setPositionMode': true,
|
|
@@ -124577,7 +125953,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124577
125953
|
params = this.omit(params, 'symbol');
|
|
124578
125954
|
}
|
|
124579
125955
|
if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
|
|
124580
|
-
request['settle'] = currency['
|
|
125956
|
+
request['settle'] = currency['id'];
|
|
124581
125957
|
}
|
|
124582
125958
|
const response = await this.privateWalletPostTransfers(this.extend(request, params));
|
|
124583
125959
|
//
|
|
@@ -125213,220 +126589,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
125213
126589
|
}
|
|
125214
126590
|
return tiers;
|
|
125215
126591
|
}
|
|
125216
|
-
async repayMargin(code, amount, symbol = undefined, params = {}) {
|
|
125217
|
-
/**
|
|
125218
|
-
* @method
|
|
125219
|
-
* @name gate#repayMargin
|
|
125220
|
-
* @description repay borrowed margin and interest
|
|
125221
|
-
* @see https://www.gate.io/docs/apiv4/en/#repay-cross-margin-loan
|
|
125222
|
-
* @see https://www.gate.io/docs/apiv4/en/#repay-a-loan
|
|
125223
|
-
* @param {string} code unified currency code of the currency to repay
|
|
125224
|
-
* @param {float} amount the amount to repay
|
|
125225
|
-
* @param {string} symbol unified market symbol, required for isolated margin
|
|
125226
|
-
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
125227
|
-
* @param {string} [params.mode] 'all' or 'partial' payment mode, extra parameter required for isolated margin
|
|
125228
|
-
* @param {string} [params.id] '34267567' loan id, extra parameter required for isolated margin
|
|
125229
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
125230
|
-
*/
|
|
125231
|
-
const marginMode = this.safeString(params, 'marginMode'); // cross or isolated
|
|
125232
|
-
params = this.omit(params, 'marginMode');
|
|
125233
|
-
this.checkRequiredMarginArgument('repayMargin', symbol, marginMode);
|
|
125234
|
-
await this.loadMarkets();
|
|
125235
|
-
const currency = this.currency(code);
|
|
125236
|
-
const request = {
|
|
125237
|
-
'currency': currency['id'],
|
|
125238
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
125239
|
-
};
|
|
125240
|
-
let response = undefined;
|
|
125241
|
-
params = this.omit(params, ['marginMode']);
|
|
125242
|
-
if (symbol === undefined) {
|
|
125243
|
-
response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
|
|
125244
|
-
}
|
|
125245
|
-
else {
|
|
125246
|
-
const market = this.market(symbol);
|
|
125247
|
-
request['currency_pair'] = market['id'];
|
|
125248
|
-
request['mode'] = 'partial';
|
|
125249
|
-
const loanId = this.safeString2(params, 'loan_id', 'id');
|
|
125250
|
-
if (loanId === undefined) {
|
|
125251
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' repayMargin() requires loan_id param for isolated margin');
|
|
125252
|
-
}
|
|
125253
|
-
request['loan_id'] = loanId;
|
|
125254
|
-
params = this.omit(params, ['loan_id', 'id']);
|
|
125255
|
-
response = await this.privateMarginPostLoansLoanIdRepayment(this.extend(request, params));
|
|
125256
|
-
}
|
|
125257
|
-
//
|
|
125258
|
-
// Cross
|
|
125259
|
-
//
|
|
125260
|
-
// [
|
|
125261
|
-
// {
|
|
125262
|
-
// "id": "17",
|
|
125263
|
-
// "create_time": 1620381696159,
|
|
125264
|
-
// "update_time": 1620381696159,
|
|
125265
|
-
// "currency": "EOS",
|
|
125266
|
-
// "amount": "110.553635",
|
|
125267
|
-
// "text": "web",
|
|
125268
|
-
// "status": 2,
|
|
125269
|
-
// "repaid": "110.506649705159",
|
|
125270
|
-
// "repaid_interest": "0.046985294841",
|
|
125271
|
-
// "unpaid_interest": "0.0000074393366667"
|
|
125272
|
-
// }
|
|
125273
|
-
// ]
|
|
125274
|
-
//
|
|
125275
|
-
// Isolated
|
|
125276
|
-
//
|
|
125277
|
-
// {
|
|
125278
|
-
// "id": "34267567",
|
|
125279
|
-
// "create_time": "1656394778",
|
|
125280
|
-
// "expire_time": "1657258778",
|
|
125281
|
-
// "status": "finished",
|
|
125282
|
-
// "side": "borrow",
|
|
125283
|
-
// "currency": "USDT",
|
|
125284
|
-
// "rate": "0.0002",
|
|
125285
|
-
// "amount": "100",
|
|
125286
|
-
// "days": 10,
|
|
125287
|
-
// "auto_renew": false,
|
|
125288
|
-
// "currency_pair": "LTC_USDT",
|
|
125289
|
-
// "left": "0",
|
|
125290
|
-
// "repaid": "100",
|
|
125291
|
-
// "paid_interest": "0.003333333333",
|
|
125292
|
-
// "unpaid_interest": "0"
|
|
125293
|
-
// }
|
|
125294
|
-
//
|
|
125295
|
-
if (marginMode === 'cross') {
|
|
125296
|
-
response = response[0];
|
|
125297
|
-
}
|
|
125298
|
-
return this.parseMarginLoan(response, currency);
|
|
125299
|
-
}
|
|
125300
|
-
async borrowMargin(code, amount, symbol = undefined, params = {}) {
|
|
125301
|
-
/**
|
|
125302
|
-
* @method
|
|
125303
|
-
* @name gate#borrowMargin
|
|
125304
|
-
* @description create a loan to borrow margin
|
|
125305
|
-
* @see https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
|
|
125306
|
-
* @see https://www.gate.io/docs/apiv4/en/#lend-or-borrow
|
|
125307
|
-
* @param {string} code unified currency code of the currency to borrow
|
|
125308
|
-
* @param {float} amount the amount to borrow
|
|
125309
|
-
* @param {string} symbol unified market symbol, required for isolated margin
|
|
125310
|
-
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
125311
|
-
* @param {string} [params.rate] '0.0002' or '0.002' extra parameter required for isolated margin
|
|
125312
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
125313
|
-
*/
|
|
125314
|
-
const marginMode = this.safeString(params, 'marginMode'); // cross or isolated
|
|
125315
|
-
params = this.omit(params, 'marginMode');
|
|
125316
|
-
this.checkRequiredMarginArgument('borrowMargin', symbol, marginMode);
|
|
125317
|
-
await this.loadMarkets();
|
|
125318
|
-
const currency = this.currency(code);
|
|
125319
|
-
const request = {
|
|
125320
|
-
'currency': currency['id'],
|
|
125321
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
125322
|
-
};
|
|
125323
|
-
let response = undefined;
|
|
125324
|
-
if (symbol === undefined) {
|
|
125325
|
-
response = await this.privateMarginPostCrossLoans(this.extend(request, params));
|
|
125326
|
-
}
|
|
125327
|
-
else {
|
|
125328
|
-
const market = this.market(symbol);
|
|
125329
|
-
request['currency_pair'] = market['id'];
|
|
125330
|
-
request['side'] = 'borrow';
|
|
125331
|
-
// default it to 0.01% since this is a reasonable limit
|
|
125332
|
-
// as it is the smallest tick size currently offered by gateio
|
|
125333
|
-
request['rate'] = this.safeString(params, 'rate', '0.0001');
|
|
125334
|
-
request['auto_renew'] = true;
|
|
125335
|
-
params = this.omit(params, ['rate']);
|
|
125336
|
-
response = await this.privateMarginPostLoans(this.extend(request, params));
|
|
125337
|
-
}
|
|
125338
|
-
//
|
|
125339
|
-
// Cross
|
|
125340
|
-
//
|
|
125341
|
-
// {
|
|
125342
|
-
// "id": "17",
|
|
125343
|
-
// "create_time": 1620381696159,
|
|
125344
|
-
// "update_time": 1620381696159,
|
|
125345
|
-
// "currency": "EOS",
|
|
125346
|
-
// "amount": "110.553635",
|
|
125347
|
-
// "text": "web",
|
|
125348
|
-
// "status": 2,
|
|
125349
|
-
// "repaid": "110.506649705159",
|
|
125350
|
-
// "repaid_interest": "0.046985294841",
|
|
125351
|
-
// "unpaid_interest": "0.0000074393366667"
|
|
125352
|
-
// }
|
|
125353
|
-
//
|
|
125354
|
-
// Isolated
|
|
125355
|
-
//
|
|
125356
|
-
// {
|
|
125357
|
-
// "id": "34267567",
|
|
125358
|
-
// "create_time": "1656394778",
|
|
125359
|
-
// "expire_time": "1657258778",
|
|
125360
|
-
// "status": "loaned",
|
|
125361
|
-
// "side": "borrow",
|
|
125362
|
-
// "currency": "USDT",
|
|
125363
|
-
// "rate": "0.0002",
|
|
125364
|
-
// "amount": "100",
|
|
125365
|
-
// "days": 10,
|
|
125366
|
-
// "auto_renew": false,
|
|
125367
|
-
// "currency_pair": "LTC_USDT",
|
|
125368
|
-
// "left": "0",
|
|
125369
|
-
// "repaid": "0",
|
|
125370
|
-
// "paid_interest": "0",
|
|
125371
|
-
// "unpaid_interest": "0.003333333333"
|
|
125372
|
-
// }
|
|
125373
|
-
//
|
|
125374
|
-
return this.parseMarginLoan(response, currency);
|
|
125375
|
-
}
|
|
125376
|
-
parseMarginLoan(info, currency = undefined) {
|
|
125377
|
-
//
|
|
125378
|
-
// Cross
|
|
125379
|
-
//
|
|
125380
|
-
// {
|
|
125381
|
-
// "id": "17",
|
|
125382
|
-
// "create_time": 1620381696159,
|
|
125383
|
-
// "update_time": 1620381696159,
|
|
125384
|
-
// "currency": "EOS",
|
|
125385
|
-
// "amount": "110.553635",
|
|
125386
|
-
// "text": "web",
|
|
125387
|
-
// "status": 2,
|
|
125388
|
-
// "repaid": "110.506649705159",
|
|
125389
|
-
// "repaid_interest": "0.046985294841",
|
|
125390
|
-
// "unpaid_interest": "0.0000074393366667"
|
|
125391
|
-
// }
|
|
125392
|
-
//
|
|
125393
|
-
// Isolated
|
|
125394
|
-
//
|
|
125395
|
-
// {
|
|
125396
|
-
// "id": "34267567",
|
|
125397
|
-
// "create_time": "1656394778",
|
|
125398
|
-
// "expire_time": "1657258778",
|
|
125399
|
-
// "status": "loaned",
|
|
125400
|
-
// "side": "borrow",
|
|
125401
|
-
// "currency": "USDT",
|
|
125402
|
-
// "rate": "0.0002",
|
|
125403
|
-
// "amount": "100",
|
|
125404
|
-
// "days": 10,
|
|
125405
|
-
// "auto_renew": false,
|
|
125406
|
-
// "currency_pair": "LTC_USDT",
|
|
125407
|
-
// "left": "0",
|
|
125408
|
-
// "repaid": "0",
|
|
125409
|
-
// "paid_interest": "0",
|
|
125410
|
-
// "unpaid_interest": "0.003333333333"
|
|
125411
|
-
// }
|
|
125412
|
-
//
|
|
125413
|
-
const marginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
125414
|
-
let timestamp = this.safeInteger(info, 'create_time');
|
|
125415
|
-
if (marginMode === 'isolated') {
|
|
125416
|
-
timestamp = this.safeTimestamp(info, 'create_time');
|
|
125417
|
-
}
|
|
125418
|
-
const currencyId = this.safeString(info, 'currency');
|
|
125419
|
-
const marketId = this.safeString(info, 'currency_pair');
|
|
125420
|
-
return {
|
|
125421
|
-
'id': this.safeInteger(info, 'id'),
|
|
125422
|
-
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
125423
|
-
'amount': this.safeNumber(info, 'amount'),
|
|
125424
|
-
'symbol': this.safeSymbol(marketId, undefined, '_', 'margin'),
|
|
125425
|
-
'timestamp': timestamp,
|
|
125426
|
-
'datetime': this.iso8601(timestamp),
|
|
125427
|
-
'info': info,
|
|
125428
|
-
};
|
|
125429
|
-
}
|
|
125430
126592
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
125431
126593
|
const authentication = api[0]; // public, private
|
|
125432
126594
|
const type = api[1]; // spot, margin, future, delivery
|
|
@@ -137411,7 +138573,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137411
138573
|
if (limit !== undefined) {
|
|
137412
138574
|
request['size'] = limit;
|
|
137413
138575
|
}
|
|
137414
|
-
|
|
138576
|
+
let response = undefined;
|
|
138577
|
+
if (method === 'spot_private_get_v1_order_orders') {
|
|
138578
|
+
response = await this.spotPrivateGetV1OrderOrders(this.extend(request, params));
|
|
138579
|
+
}
|
|
138580
|
+
else {
|
|
138581
|
+
response = await this.spotPrivateGetV1OrderHistory(this.extend(request, params));
|
|
138582
|
+
}
|
|
137415
138583
|
//
|
|
137416
138584
|
// spot_private_get_v1_order_orders GET /v1/order/orders
|
|
137417
138585
|
//
|
|
@@ -159891,7 +161059,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
159891
161059
|
'fetchPosition': false,
|
|
159892
161060
|
'fetchPositionMode': false,
|
|
159893
161061
|
'fetchPositions': false,
|
|
159894
|
-
'
|
|
161062
|
+
'fetchPositionsForSymbol': false,
|
|
159895
161063
|
'fetchPositionsRisk': false,
|
|
159896
161064
|
'fetchPremiumIndexOHLCV': false,
|
|
159897
161065
|
'fetchTicker': true,
|
|
@@ -160769,7 +161937,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
160769
161937
|
const request = {
|
|
160770
161938
|
'pair': market['id'],
|
|
160771
161939
|
'orderSide': (side === 'buy') ? 'Bid' : 'Ask',
|
|
160772
|
-
'quantity':
|
|
161940
|
+
'quantity': this.numberToString(amount),
|
|
160773
161941
|
'type': capitalizedType,
|
|
160774
161942
|
};
|
|
160775
161943
|
if (capitalizedType === 'Limit') {
|
|
@@ -161635,7 +162803,8 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
161635
162803
|
let url = undefined;
|
|
161636
162804
|
if (Array.isArray(api)) {
|
|
161637
162805
|
const isGet = method === 'GET';
|
|
161638
|
-
const
|
|
162806
|
+
const version = this.safeString(api, 0);
|
|
162807
|
+
const access = this.safeString(api, 1);
|
|
161639
162808
|
if (version === 'v3') {
|
|
161640
162809
|
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
161641
162810
|
if (access === 'public') {
|
|
@@ -189365,7 +190534,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189365
190534
|
* @method
|
|
189366
190535
|
* @name okx#borrowCrossMargin
|
|
189367
190536
|
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
189368
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-
|
|
190537
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
189369
190538
|
* @param {string} code unified currency code of the currency to borrow
|
|
189370
190539
|
* @param {float} amount the amount to borrow
|
|
189371
190540
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
@@ -189385,12 +190554,10 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189385
190554
|
// "data": [
|
|
189386
190555
|
// {
|
|
189387
190556
|
// "amt": "102",
|
|
189388
|
-
// "availLoan": "97",
|
|
189389
190557
|
// "ccy": "USDT",
|
|
189390
|
-
// "
|
|
189391
|
-
// "posLoan": "0",
|
|
190558
|
+
// "ordId": "544199684697214976",
|
|
189392
190559
|
// "side": "borrow",
|
|
189393
|
-
// "
|
|
190560
|
+
// "state": "1"
|
|
189394
190561
|
// }
|
|
189395
190562
|
// ],
|
|
189396
190563
|
// "msg": ""
|
|
@@ -189405,18 +190572,25 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189405
190572
|
* @method
|
|
189406
190573
|
* @name okx#repayCrossMargin
|
|
189407
190574
|
* @description repay borrowed margin and interest
|
|
189408
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-
|
|
190575
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
189409
190576
|
* @param {string} code unified currency code of the currency to repay
|
|
189410
190577
|
* @param {float} amount the amount to repay
|
|
189411
190578
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
190579
|
+
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
189412
190580
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
189413
190581
|
*/
|
|
189414
190582
|
await this.loadMarkets();
|
|
190583
|
+
const id = this.safeString2(params, 'id', 'ordId');
|
|
190584
|
+
params = this.omit(params, 'id');
|
|
190585
|
+
if (id === undefined) {
|
|
190586
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' repayCrossMargin() requires an id parameter');
|
|
190587
|
+
}
|
|
189415
190588
|
const currency = this.currency(code);
|
|
189416
190589
|
const request = {
|
|
189417
190590
|
'ccy': currency['id'],
|
|
189418
190591
|
'amt': this.currencyToPrecision(code, amount),
|
|
189419
190592
|
'side': 'repay',
|
|
190593
|
+
'ordId': id,
|
|
189420
190594
|
};
|
|
189421
190595
|
const response = await this.privatePostAccountBorrowRepay(this.extend(request, params));
|
|
189422
190596
|
//
|
|
@@ -189425,12 +190599,10 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189425
190599
|
// "data": [
|
|
189426
190600
|
// {
|
|
189427
190601
|
// "amt": "102",
|
|
189428
|
-
// "availLoan": "97",
|
|
189429
190602
|
// "ccy": "USDT",
|
|
189430
|
-
// "
|
|
189431
|
-
// "posLoan": "0",
|
|
190603
|
+
// "ordId": "544199684697214976",
|
|
189432
190604
|
// "side": "repay",
|
|
189433
|
-
// "
|
|
190605
|
+
// "state": "1"
|
|
189434
190606
|
// }
|
|
189435
190607
|
// ],
|
|
189436
190608
|
// "msg": ""
|
|
@@ -190136,7 +191308,7 @@ class p2b extends _abstract_p2b_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
190136
191308
|
'fetchPermissions': false,
|
|
190137
191309
|
'fetchPosition': false,
|
|
190138
191310
|
'fetchPositions': false,
|
|
190139
|
-
'
|
|
191311
|
+
'fetchPositionsForSymbol': false,
|
|
190140
191312
|
'fetchPositionsRisk': false,
|
|
190141
191313
|
'fetchPremiumIndexOHLCV': false,
|
|
190142
191314
|
'fetchTicker': true,
|
|
@@ -218715,7 +219887,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
218715
219887
|
'args': topics,
|
|
218716
219888
|
};
|
|
218717
219889
|
const message = this.extend(request, params);
|
|
218718
|
-
return await this.watch(url, messageHash, message, subscriptionHash);
|
|
219890
|
+
return await this.watch(url, messageHash, message, messageHash, subscriptionHash);
|
|
218719
219891
|
}
|
|
218720
219892
|
async authenticate(url, params = {}) {
|
|
218721
219893
|
this.checkRequiredCredentials();
|
|
@@ -285910,7 +287082,7 @@ SOFTWARE.
|
|
|
285910
287082
|
|
|
285911
287083
|
//-----------------------------------------------------------------------------
|
|
285912
287084
|
// this is updated by vss.js when building
|
|
285913
|
-
const version = '4.1.
|
|
287085
|
+
const version = '4.1.62';
|
|
285914
287086
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
285915
287087
|
//-----------------------------------------------------------------------------
|
|
285916
287088
|
|