ccxt 4.4.28 → 4.4.30
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +59 -7
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/binance.js +9 -0
- package/dist/cjs/src/bitbns.js +12 -12
- package/dist/cjs/src/bitfinex.js +9 -9
- package/dist/cjs/src/bitget.js +99 -6
- package/dist/cjs/src/bitmart.js +53 -53
- package/dist/cjs/src/bitopro.js +21 -21
- package/dist/cjs/src/bitrue.js +28 -28
- package/dist/cjs/src/bitvavo.js +4 -0
- package/dist/cjs/src/bybit.js +51 -646
- package/dist/cjs/src/coincatch.js +24 -4
- package/dist/cjs/src/deribit.js +7 -3
- package/dist/cjs/src/hyperliquid.js +108 -4
- package/dist/cjs/src/lbank.js +7 -1
- package/dist/cjs/src/pro/bitvavo.js +2 -1
- package/dist/cjs/src/pro/blofin.js +2 -1
- package/dist/cjs/src/pro/mexc.js +198 -30
- package/dist/cjs/src/vertex.js +51 -6
- package/examples/README.md +0 -2
- package/examples/js/cli.js +7 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/alpaca.d.ts +1 -0
- package/js/src/abstract/binance.d.ts +9 -0
- package/js/src/abstract/binancecoinm.d.ts +9 -0
- package/js/src/abstract/binanceus.d.ts +9 -0
- package/js/src/abstract/binanceusdm.d.ts +9 -0
- package/js/src/abstract/bybit.d.ts +0 -13
- package/js/src/alpaca.d.ts +2 -0
- package/js/src/alpaca.js +59 -7
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -0
- package/js/src/binance.js +9 -0
- package/js/src/bitbns.js +12 -12
- package/js/src/bitfinex.js +9 -9
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitget.d.ts +2 -1
- package/js/src/bitget.js +99 -6
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +53 -53
- package/js/src/bitopro.js +21 -21
- package/js/src/bitrue.js +28 -28
- package/js/src/bitvavo.js +4 -0
- package/js/src/bybit.d.ts +0 -8
- package/js/src/bybit.js +51 -646
- package/js/src/coincatch.d.ts +1 -1
- package/js/src/coincatch.js +24 -4
- package/js/src/deribit.js +7 -3
- package/js/src/hyperliquid.d.ts +3 -1
- package/js/src/hyperliquid.js +108 -4
- package/js/src/lbank.js +7 -1
- package/js/src/pro/bitvavo.js +2 -1
- package/js/src/pro/blofin.js +2 -1
- package/js/src/pro/mexc.js +198 -30
- package/js/src/vertex.d.ts +4 -2
- package/js/src/vertex.js +51 -6
- package/js/src/whitebit.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -197,7 +197,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
197
197
|
|
|
198
198
|
//-----------------------------------------------------------------------------
|
|
199
199
|
// this is updated by vss.js when building
|
|
200
|
-
const version = '4.4.
|
|
200
|
+
const version = '4.4.30';
|
|
201
201
|
Exchange["default"].ccxtVersion = version;
|
|
202
202
|
const exchanges = {
|
|
203
203
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -51,6 +51,7 @@ class alpaca extends alpaca$1 {
|
|
|
51
51
|
'closeAllPositions': false,
|
|
52
52
|
'closePosition': false,
|
|
53
53
|
'createOrder': true,
|
|
54
|
+
'editOrder': true,
|
|
54
55
|
'fetchBalance': false,
|
|
55
56
|
'fetchBidsAsks': false,
|
|
56
57
|
'fetchClosedOrders': true,
|
|
@@ -131,6 +132,7 @@ class alpaca extends alpaca$1 {
|
|
|
131
132
|
'v2/wallets/transfers',
|
|
132
133
|
],
|
|
133
134
|
'put': [
|
|
135
|
+
'v2/orders/{order_id}',
|
|
134
136
|
'v2/watchlists/{watchlist_id}',
|
|
135
137
|
'v2/watchlists:by_name',
|
|
136
138
|
],
|
|
@@ -816,6 +818,15 @@ class alpaca extends alpaca$1 {
|
|
|
816
818
|
}
|
|
817
819
|
return this.filterByArray(results, 'symbol', symbols);
|
|
818
820
|
}
|
|
821
|
+
generateClientOrderId(params) {
|
|
822
|
+
const clientOrderIdprefix = this.safeString(this.options, 'clientOrderId');
|
|
823
|
+
const uuid = this.uuid();
|
|
824
|
+
const parts = uuid.split('-');
|
|
825
|
+
const random_id = parts.join('');
|
|
826
|
+
const defaultClientId = this.implodeParams(clientOrderIdprefix, { 'id': random_id });
|
|
827
|
+
const clientOrderId = this.safeString(params, 'clientOrderId', defaultClientId);
|
|
828
|
+
return clientOrderId;
|
|
829
|
+
}
|
|
819
830
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
820
831
|
/**
|
|
821
832
|
* @method
|
|
@@ -858,13 +869,7 @@ class alpaca extends alpaca$1 {
|
|
|
858
869
|
const defaultTIF = this.safeString(this.options, 'defaultTimeInForce');
|
|
859
870
|
request['time_in_force'] = this.safeString(params, 'timeInForce', defaultTIF);
|
|
860
871
|
params = this.omit(params, ['timeInForce', 'triggerPrice']);
|
|
861
|
-
|
|
862
|
-
const uuid = this.uuid();
|
|
863
|
-
const parts = uuid.split('-');
|
|
864
|
-
const random_id = parts.join('');
|
|
865
|
-
const defaultClientId = this.implodeParams(clientOrderIdprefix, { 'id': random_id });
|
|
866
|
-
const clientOrderId = this.safeString(params, 'clientOrderId', defaultClientId);
|
|
867
|
-
request['client_order_id'] = clientOrderId;
|
|
872
|
+
request['client_order_id'] = this.generateClientOrderId(params);
|
|
868
873
|
params = this.omit(params, ['clientOrderId']);
|
|
869
874
|
const order = await this.traderPrivatePostV2Orders(this.extend(request, params));
|
|
870
875
|
//
|
|
@@ -1083,6 +1088,53 @@ class alpaca extends alpaca$1 {
|
|
|
1083
1088
|
};
|
|
1084
1089
|
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
1085
1090
|
}
|
|
1091
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1092
|
+
/**
|
|
1093
|
+
* @method
|
|
1094
|
+
* @name alpaca#editOrder
|
|
1095
|
+
* @description edit a trade order
|
|
1096
|
+
* @see https://docs.alpaca.markets/reference/patchorderbyorderid-1
|
|
1097
|
+
* @param {string} id order id
|
|
1098
|
+
* @param {string} [symbol] unified symbol of the market to create an order in
|
|
1099
|
+
* @param {string} [type] 'market', 'limit' or 'stop_limit'
|
|
1100
|
+
* @param {string} [side] 'buy' or 'sell'
|
|
1101
|
+
* @param {float} [amount] how much of the currency you want to trade in units of the base currency
|
|
1102
|
+
* @param {float} [price] the price for the order, in units of the quote currency, ignored in market orders
|
|
1103
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1104
|
+
* @param {string} [params.triggerPrice] the price to trigger a stop order
|
|
1105
|
+
* @param {string} [params.timeInForce] for crypto trading either 'gtc' or 'ioc' can be used
|
|
1106
|
+
* @param {string} [params.clientOrderId] a unique identifier for the order, automatically generated if not sent
|
|
1107
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1108
|
+
*/
|
|
1109
|
+
await this.loadMarkets();
|
|
1110
|
+
const request = {
|
|
1111
|
+
'order_id': id,
|
|
1112
|
+
};
|
|
1113
|
+
let market = undefined;
|
|
1114
|
+
if (symbol !== undefined) {
|
|
1115
|
+
market = this.market(symbol);
|
|
1116
|
+
}
|
|
1117
|
+
if (amount !== undefined) {
|
|
1118
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
1119
|
+
}
|
|
1120
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stop_price']);
|
|
1121
|
+
if (triggerPrice !== undefined) {
|
|
1122
|
+
request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1123
|
+
params = this.omit(params, 'triggerPrice');
|
|
1124
|
+
}
|
|
1125
|
+
if (price !== undefined) {
|
|
1126
|
+
request['limit_price'] = this.priceToPrecision(symbol, price);
|
|
1127
|
+
}
|
|
1128
|
+
let timeInForce = undefined;
|
|
1129
|
+
[timeInForce, params] = this.handleOptionAndParams2(params, 'editOrder', 'timeInForce', 'defaultTimeInForce');
|
|
1130
|
+
if (timeInForce !== undefined) {
|
|
1131
|
+
request['time_in_force'] = timeInForce;
|
|
1132
|
+
}
|
|
1133
|
+
request['client_order_id'] = this.generateClientOrderId(params);
|
|
1134
|
+
params = this.omit(params, ['clientOrderId']);
|
|
1135
|
+
const response = await this.traderPrivatePatchV2OrdersOrderId(this.extend(request, params));
|
|
1136
|
+
return this.parseOrder(response, market);
|
|
1137
|
+
}
|
|
1086
1138
|
parseOrder(order, market = undefined) {
|
|
1087
1139
|
//
|
|
1088
1140
|
// {
|
|
@@ -2069,6 +2069,9 @@ class Exchange {
|
|
|
2069
2069
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
2070
2070
|
throw new errors.NotSupported(this.id + ' fetchOrderBook() is not supported yet');
|
|
2071
2071
|
}
|
|
2072
|
+
async fetchOrderBookWs(symbol, limit = undefined, params = {}) {
|
|
2073
|
+
throw new errors.NotSupported(this.id + ' fetchOrderBookWs() is not supported yet');
|
|
2074
|
+
}
|
|
2072
2075
|
async fetchMarginMode(symbol, params = {}) {
|
|
2073
2076
|
if (this.has['fetchMarginModes']) {
|
|
2074
2077
|
const marginModes = await this.fetchMarginModes([symbol], params);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -393,6 +393,12 @@ class binance extends binance$1 {
|
|
|
393
393
|
'eth-staking/wbeth/history/wrapHistory': 15,
|
|
394
394
|
'eth-staking/wbeth/history/unwrapHistory': 15,
|
|
395
395
|
'eth-staking/eth/history/wbethRewardsHistory': 15,
|
|
396
|
+
'sol-staking/sol/history/stakingHistory': 15,
|
|
397
|
+
'sol-staking/sol/history/redemptionHistory': 15,
|
|
398
|
+
'sol-staking/sol/history/bnsolRewardsHistory': 15,
|
|
399
|
+
'sol-staking/sol/history/rateHistory': 15,
|
|
400
|
+
'sol-staking/account': 15,
|
|
401
|
+
'sol-staking/sol/quota': 15,
|
|
396
402
|
// mining endpoints
|
|
397
403
|
'mining/pub/algoList': 0.1,
|
|
398
404
|
'mining/pub/coinList': 0.1,
|
|
@@ -604,6 +610,8 @@ class binance extends binance$1 {
|
|
|
604
610
|
'eth-staking/eth/stake': 15,
|
|
605
611
|
'eth-staking/eth/redeem': 15,
|
|
606
612
|
'eth-staking/wbeth/wrap': 15,
|
|
613
|
+
'sol-staking/sol/stake': 15,
|
|
614
|
+
'sol-staking/sol/redeem': 15,
|
|
607
615
|
// mining endpoints
|
|
608
616
|
'mining/hash-transfer/config': 0.5,
|
|
609
617
|
'mining/hash-transfer/config/cancel': 0.5,
|
|
@@ -638,6 +646,7 @@ class binance extends binance$1 {
|
|
|
638
646
|
'simple-earn/locked/redeem': 0.1,
|
|
639
647
|
'simple-earn/flexible/setAutoSubscribe': 15,
|
|
640
648
|
'simple-earn/locked/setAutoSubscribe': 15,
|
|
649
|
+
'simple-earn/locked/setRedeemOption': 5,
|
|
641
650
|
// convert
|
|
642
651
|
'dci/product/subscribe': 0.1,
|
|
643
652
|
'dci/product/auto_compound/edit': 0.1,
|
package/dist/cjs/src/bitbns.js
CHANGED
|
@@ -223,11 +223,11 @@ class bitbns extends bitbns$1 {
|
|
|
223
223
|
const quoteId = this.safeString(market, 'quote');
|
|
224
224
|
const base = this.safeCurrencyCode(baseId);
|
|
225
225
|
const quote = this.safeCurrencyCode(quoteId);
|
|
226
|
-
const marketPrecision = this.
|
|
227
|
-
const marketLimits = this.
|
|
228
|
-
const amountLimits = this.
|
|
229
|
-
const priceLimits = this.
|
|
230
|
-
const costLimits = this.
|
|
226
|
+
const marketPrecision = this.safeDict(market, 'precision', {});
|
|
227
|
+
const marketLimits = this.safeDict(market, 'limits', {});
|
|
228
|
+
const amountLimits = this.safeDict(marketLimits, 'amount', {});
|
|
229
|
+
const priceLimits = this.safeDict(marketLimits, 'price', {});
|
|
230
|
+
const costLimits = this.safeDict(marketLimits, 'cost', {});
|
|
231
231
|
const usdt = (quoteId === 'USDT');
|
|
232
232
|
// INR markets don't need a _INR prefix
|
|
233
233
|
const uppercaseId = usdt ? (baseId + '_' + quoteId) : baseId;
|
|
@@ -433,7 +433,7 @@ class bitbns extends bitbns$1 {
|
|
|
433
433
|
'timestamp': timestamp,
|
|
434
434
|
'datetime': this.iso8601(timestamp),
|
|
435
435
|
};
|
|
436
|
-
const data = this.
|
|
436
|
+
const data = this.safeDict(response, 'data', {});
|
|
437
437
|
const keys = Object.keys(data);
|
|
438
438
|
for (let i = 0; i < keys.length; i++) {
|
|
439
439
|
const key = keys[i];
|
|
@@ -659,7 +659,7 @@ class bitbns extends bitbns$1 {
|
|
|
659
659
|
}
|
|
660
660
|
await this.loadMarkets();
|
|
661
661
|
const market = this.market(symbol);
|
|
662
|
-
const isTrigger = this.
|
|
662
|
+
const isTrigger = this.safeBool2(params, 'trigger', 'stop');
|
|
663
663
|
params = this.omit(params, ['trigger', 'stop']);
|
|
664
664
|
const request = {
|
|
665
665
|
'entry_id': id,
|
|
@@ -693,7 +693,7 @@ class bitbns extends bitbns$1 {
|
|
|
693
693
|
'symbol': market['id'],
|
|
694
694
|
'entry_id': id,
|
|
695
695
|
};
|
|
696
|
-
const trigger = this.
|
|
696
|
+
const trigger = this.safeBool2(params, 'trigger', 'stop');
|
|
697
697
|
if (trigger) {
|
|
698
698
|
throw new errors.BadRequest(this.id + ' fetchOrder cannot fetch stop orders');
|
|
699
699
|
}
|
|
@@ -723,7 +723,7 @@ class bitbns extends bitbns$1 {
|
|
|
723
723
|
// "code":200
|
|
724
724
|
// }
|
|
725
725
|
//
|
|
726
|
-
const data = this.
|
|
726
|
+
const data = this.safeList(response, 'data', []);
|
|
727
727
|
const first = this.safeDict(data, 0);
|
|
728
728
|
return this.parseOrder(first, market);
|
|
729
729
|
}
|
|
@@ -746,7 +746,7 @@ class bitbns extends bitbns$1 {
|
|
|
746
746
|
}
|
|
747
747
|
await this.loadMarkets();
|
|
748
748
|
const market = this.market(symbol);
|
|
749
|
-
const isTrigger = this.
|
|
749
|
+
const isTrigger = this.safeBool2(params, 'trigger', 'stop');
|
|
750
750
|
params = this.omit(params, ['trigger', 'stop']);
|
|
751
751
|
const quoteSide = (market['quoteId'] === 'USDT') ? 'usdtListOpen' : 'listOpen';
|
|
752
752
|
const request = {
|
|
@@ -1048,7 +1048,7 @@ class bitbns extends bitbns$1 {
|
|
|
1048
1048
|
'6': 'ok', // Completed
|
|
1049
1049
|
},
|
|
1050
1050
|
};
|
|
1051
|
-
const statuses = this.
|
|
1051
|
+
const statuses = this.safeDict(statusesByType, type, {});
|
|
1052
1052
|
return this.safeString(statuses, status, status);
|
|
1053
1053
|
}
|
|
1054
1054
|
parseTransaction(transaction, currency = undefined) {
|
|
@@ -1144,7 +1144,7 @@ class bitbns extends bitbns$1 {
|
|
|
1144
1144
|
// "error":null
|
|
1145
1145
|
// }
|
|
1146
1146
|
//
|
|
1147
|
-
const data = this.
|
|
1147
|
+
const data = this.safeDict(response, 'data', {});
|
|
1148
1148
|
const address = this.safeString(data, 'token');
|
|
1149
1149
|
const tag = this.safeString(data, 'tag');
|
|
1150
1150
|
this.checkAddress(address);
|
package/dist/cjs/src/bitfinex.js
CHANGED
|
@@ -420,7 +420,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
420
420
|
// }
|
|
421
421
|
// }
|
|
422
422
|
//
|
|
423
|
-
const fees = this.
|
|
423
|
+
const fees = this.safeDict(response, 'withdraw', {});
|
|
424
424
|
const ids = Object.keys(fees);
|
|
425
425
|
for (let i = 0; i < ids.length; i++) {
|
|
426
426
|
const id = ids[i];
|
|
@@ -527,7 +527,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
527
527
|
// }
|
|
528
528
|
//
|
|
529
529
|
const result = {};
|
|
530
|
-
const fiat = this.
|
|
530
|
+
const fiat = this.safeDict(this.options, 'fiat', {});
|
|
531
531
|
const makerFee = this.safeNumber(response, 'maker_fee');
|
|
532
532
|
const takerFee = this.safeNumber(response, 'taker_fee');
|
|
533
533
|
const makerFee2Fiat = this.safeNumber(response, 'maker_fee_2fiat');
|
|
@@ -626,7 +626,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
626
626
|
'settleId': undefined,
|
|
627
627
|
'type': type,
|
|
628
628
|
'spot': (type === 'spot'),
|
|
629
|
-
'margin': this.
|
|
629
|
+
'margin': this.safeBool(market, 'margin'),
|
|
630
630
|
'swap': (type === 'swap'),
|
|
631
631
|
'future': false,
|
|
632
632
|
'option': false,
|
|
@@ -696,7 +696,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
696
696
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
697
697
|
*/
|
|
698
698
|
await this.loadMarkets();
|
|
699
|
-
const accountsByType = this.
|
|
699
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
700
700
|
const requestedType = this.safeString(params, 'type', 'exchange');
|
|
701
701
|
const accountType = this.safeString(accountsByType, requestedType, requestedType);
|
|
702
702
|
if (accountType === undefined) {
|
|
@@ -760,7 +760,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
760
760
|
// transferring between derivatives wallet and regular wallet is not documented in their API
|
|
761
761
|
// however we support it in CCXT (from just looking at web inspector)
|
|
762
762
|
await this.loadMarkets();
|
|
763
|
-
const accountsByType = this.
|
|
763
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
764
764
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
765
765
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
766
766
|
const currency = this.currency(code);
|
|
@@ -1236,8 +1236,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
1236
1236
|
// }
|
|
1237
1237
|
//
|
|
1238
1238
|
const side = this.safeString(order, 'side');
|
|
1239
|
-
const open = this.
|
|
1240
|
-
const canceled = this.
|
|
1239
|
+
const open = this.safeBool(order, 'is_live');
|
|
1240
|
+
const canceled = this.safeBool(order, 'is_cancelled');
|
|
1241
1241
|
let status = undefined;
|
|
1242
1242
|
if (open) {
|
|
1243
1243
|
status = 'open';
|
|
@@ -1645,7 +1645,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
1645
1645
|
// }
|
|
1646
1646
|
// ]
|
|
1647
1647
|
//
|
|
1648
|
-
const response = this.
|
|
1648
|
+
const response = this.safeDict(responses, 0, {});
|
|
1649
1649
|
const id = this.safeInteger(response, 'withdrawal_id');
|
|
1650
1650
|
const message = this.safeString(response, 'message');
|
|
1651
1651
|
const errorMessage = this.findBroadlyMatchedKey(this.exceptions['broad'], message);
|
|
@@ -1740,7 +1740,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
1740
1740
|
else {
|
|
1741
1741
|
// json response with error, i.e:
|
|
1742
1742
|
// [{"status":"error","message":"Momentary balance check. Please wait few seconds and try the transfer again."}]
|
|
1743
|
-
const responseObject = this.
|
|
1743
|
+
const responseObject = this.safeDict(response, 0, {});
|
|
1744
1744
|
const status = this.safeString(responseObject, 'status', '');
|
|
1745
1745
|
if (status === 'error') {
|
|
1746
1746
|
throwError = true;
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -84,7 +84,7 @@ class bitget extends bitget$1 {
|
|
|
84
84
|
'fetchFundingIntervals': false,
|
|
85
85
|
'fetchFundingRate': true,
|
|
86
86
|
'fetchFundingRateHistory': true,
|
|
87
|
-
'fetchFundingRates':
|
|
87
|
+
'fetchFundingRates': true,
|
|
88
88
|
'fetchIndexOHLCV': true,
|
|
89
89
|
'fetchIsolatedBorrowRate': true,
|
|
90
90
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -6846,6 +6846,71 @@ class bitget extends bitget$1 {
|
|
|
6846
6846
|
const data = this.safeValue(response, 'data', []);
|
|
6847
6847
|
return this.parseFundingRate(data[0], market);
|
|
6848
6848
|
}
|
|
6849
|
+
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
6850
|
+
/**
|
|
6851
|
+
* @method
|
|
6852
|
+
* @name bitget#fetchFundingRates
|
|
6853
|
+
* @description fetch the current funding rates for all markets
|
|
6854
|
+
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
|
|
6855
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
6856
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6857
|
+
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
6858
|
+
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
6859
|
+
* @returns {object} a dictionary of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
6860
|
+
*/
|
|
6861
|
+
await this.loadMarkets();
|
|
6862
|
+
let market = undefined;
|
|
6863
|
+
if (symbols !== undefined) {
|
|
6864
|
+
const symbol = this.safeValue(symbols, 0);
|
|
6865
|
+
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
6866
|
+
if (sandboxMode) {
|
|
6867
|
+
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
6868
|
+
market = this.market(sandboxSymbol);
|
|
6869
|
+
}
|
|
6870
|
+
else {
|
|
6871
|
+
market = this.market(symbol);
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
const request = {};
|
|
6875
|
+
let productType = undefined;
|
|
6876
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6877
|
+
request['productType'] = productType;
|
|
6878
|
+
const response = await this.publicMixGetV2MixMarketTickers(this.extend(request, params));
|
|
6879
|
+
// {
|
|
6880
|
+
// "code": "00000",
|
|
6881
|
+
// "msg": "success",
|
|
6882
|
+
// "requestTime": 1700533773477,
|
|
6883
|
+
// "data": [
|
|
6884
|
+
// {
|
|
6885
|
+
// "symbol": "BTCUSD",
|
|
6886
|
+
// "lastPr": "29904.5",
|
|
6887
|
+
// "askPr": "29904.5",
|
|
6888
|
+
// "bidPr": "29903.5",
|
|
6889
|
+
// "bidSz": "0.5091",
|
|
6890
|
+
// "askSz": "2.2694",
|
|
6891
|
+
// "high24h": "0",
|
|
6892
|
+
// "low24h": "0",
|
|
6893
|
+
// "ts": "1695794271400",
|
|
6894
|
+
// "change24h": "0",
|
|
6895
|
+
// "baseVolume": "0",
|
|
6896
|
+
// "quoteVolume": "0",
|
|
6897
|
+
// "usdtVolume": "0",
|
|
6898
|
+
// "openUtc": "0",
|
|
6899
|
+
// "changeUtc24h": "0",
|
|
6900
|
+
// "indexPrice": "29132.353333",
|
|
6901
|
+
// "fundingRate": "-0.0007",
|
|
6902
|
+
// "holdingAmount": "125.6844",
|
|
6903
|
+
// "deliveryStartTime": null,
|
|
6904
|
+
// "deliveryTime": null,
|
|
6905
|
+
// "deliveryStatus": "delivery_normal",
|
|
6906
|
+
// "open24h": "0",
|
|
6907
|
+
// "markPrice": "12345"
|
|
6908
|
+
// },
|
|
6909
|
+
// ]
|
|
6910
|
+
// }
|
|
6911
|
+
const data = this.safeList(response, 'data', []);
|
|
6912
|
+
return this.parseFundingRates(data, market);
|
|
6913
|
+
}
|
|
6849
6914
|
parseFundingRate(contract, market = undefined) {
|
|
6850
6915
|
//
|
|
6851
6916
|
// fetchFundingRate
|
|
@@ -6862,11 +6927,39 @@ class bitget extends bitget$1 {
|
|
|
6862
6927
|
// "nextFundingTime": "1727942400000",
|
|
6863
6928
|
// "ratePeriod": "8"
|
|
6864
6929
|
// }
|
|
6865
|
-
//
|
|
6930
|
+
// fetchFundingRates
|
|
6931
|
+
// {
|
|
6932
|
+
// "symbol": "BTCUSD",
|
|
6933
|
+
// "lastPr": "29904.5",
|
|
6934
|
+
// "askPr": "29904.5",
|
|
6935
|
+
// "bidPr": "29903.5",
|
|
6936
|
+
// "bidSz": "0.5091",
|
|
6937
|
+
// "askSz": "2.2694",
|
|
6938
|
+
// "high24h": "0",
|
|
6939
|
+
// "low24h": "0",
|
|
6940
|
+
// "ts": "1695794271400",
|
|
6941
|
+
// "change24h": "0",
|
|
6942
|
+
// "baseVolume": "0",
|
|
6943
|
+
// "quoteVolume": "0",
|
|
6944
|
+
// "usdtVolume": "0",
|
|
6945
|
+
// "openUtc": "0",
|
|
6946
|
+
// "changeUtc24h": "0",
|
|
6947
|
+
// "indexPrice": "29132.353333",
|
|
6948
|
+
// "fundingRate": "-0.0007",
|
|
6949
|
+
// "holdingAmount": "125.6844",
|
|
6950
|
+
// "deliveryStartTime": null,
|
|
6951
|
+
// "deliveryTime": null,
|
|
6952
|
+
// "deliveryStatus": "delivery_normal",
|
|
6953
|
+
// "open24h": "0",
|
|
6954
|
+
// "markPrice": "12345"
|
|
6955
|
+
// }
|
|
6866
6956
|
const marketId = this.safeString(contract, 'symbol');
|
|
6867
6957
|
const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
|
|
6868
6958
|
const fundingTimestamp = this.safeInteger(contract, 'nextFundingTime');
|
|
6869
6959
|
const interval = this.safeString(contract, 'ratePeriod');
|
|
6960
|
+
const timestamp = this.safeInteger(contract, 'ts');
|
|
6961
|
+
const markPrice = this.safeNumber(contract, 'markPrice');
|
|
6962
|
+
const indexPrice = this.safeNumber(contract, 'indexPrice');
|
|
6870
6963
|
let intervalString = undefined;
|
|
6871
6964
|
if (interval !== undefined) {
|
|
6872
6965
|
intervalString = interval + 'h';
|
|
@@ -6874,12 +6967,12 @@ class bitget extends bitget$1 {
|
|
|
6874
6967
|
return {
|
|
6875
6968
|
'info': contract,
|
|
6876
6969
|
'symbol': symbol,
|
|
6877
|
-
'markPrice':
|
|
6878
|
-
'indexPrice':
|
|
6970
|
+
'markPrice': markPrice,
|
|
6971
|
+
'indexPrice': indexPrice,
|
|
6879
6972
|
'interestRate': undefined,
|
|
6880
6973
|
'estimatedSettlePrice': undefined,
|
|
6881
|
-
'timestamp':
|
|
6882
|
-
'datetime':
|
|
6974
|
+
'timestamp': timestamp,
|
|
6975
|
+
'datetime': this.iso8601(timestamp),
|
|
6883
6976
|
'fundingRate': this.safeNumber(contract, 'fundingRate'),
|
|
6884
6977
|
'fundingTimestamp': fundingTimestamp,
|
|
6885
6978
|
'fundingDatetime': this.iso8601(fundingTimestamp),
|