ccxt 4.4.78 → 4.4.82
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 +8 -12
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/apex.js +21 -31
- package/dist/cjs/src/ascendex.js +26 -5
- package/dist/cjs/src/base/Exchange.js +26 -3
- package/dist/cjs/src/base/functions/encode.js +1 -1
- package/dist/cjs/src/bigone.js +22 -14
- package/dist/cjs/src/binance.js +8 -0
- package/dist/cjs/src/bingx.js +16 -40
- package/dist/cjs/src/bitfinex.js +128 -88
- package/dist/cjs/src/bitget.js +60 -71
- package/dist/cjs/src/bitmart.js +7 -2
- package/dist/cjs/src/bitmex.js +12 -4
- package/dist/cjs/src/bitopro.js +5 -1
- package/dist/cjs/src/bitrue.js +2 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitteam.js +2 -0
- package/dist/cjs/src/bitvavo.js +28 -10
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +34 -16
- package/dist/cjs/src/coinbase.js +4 -17
- package/dist/cjs/src/coinex.js +1 -0
- package/dist/cjs/src/coinlist.js +1 -0
- package/dist/cjs/src/coinone.js +1 -0
- package/dist/cjs/src/delta.js +4 -0
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/hollaex.js +1 -0
- package/dist/cjs/src/htx.js +9 -5
- package/dist/cjs/src/huobijp.js +1 -0
- package/dist/cjs/src/hyperliquid.js +16 -0
- package/dist/cjs/src/kraken.js +2 -0
- package/dist/cjs/src/okx.js +2 -3
- package/dist/cjs/src/oxfun.js +21 -1
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/binance.js +3 -3
- package/dist/cjs/src/pro/coinbase.js +43 -62
- package/dist/cjs/src/pro/hyperliquid.js +10 -2
- package/dist/cjs/src/pro/upbit.js +43 -0
- package/dist/cjs/src/timex.js +2 -2
- package/dist/cjs/src/upbit.js +43 -21
- package/dist/cjs/src/whitebit.js +65 -12
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/apex.js +21 -31
- package/js/src/ascendex.js +26 -5
- package/js/src/base/Exchange.d.ts +2 -1
- package/js/src/base/Exchange.js +26 -3
- package/js/src/base/functions/encode.d.ts +1 -1
- package/js/src/base/functions/encode.js +1 -1
- package/js/src/bigone.js +22 -14
- package/js/src/binance.js +8 -0
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +16 -40
- package/js/src/bitfinex.js +128 -88
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +60 -71
- package/js/src/bitmart.d.ts +1 -0
- package/js/src/bitmart.js +7 -2
- package/js/src/bitmex.js +12 -4
- package/js/src/bitopro.js +5 -1
- package/js/src/bitrue.js +2 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitteam.js +2 -0
- package/js/src/bitvavo.js +28 -10
- package/js/src/btcalpha.js +1 -1
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +1 -1
- package/js/src/bybit.js +34 -16
- package/js/src/coinbase.d.ts +0 -2
- package/js/src/coinbase.js +4 -17
- package/js/src/coinex.js +1 -0
- package/js/src/coinlist.js +1 -0
- package/js/src/coinone.js +1 -0
- package/js/src/delta.js +4 -0
- package/js/src/deribit.js +1 -0
- package/js/src/hollaex.js +1 -0
- package/js/src/htx.js +9 -5
- package/js/src/huobijp.js +1 -0
- package/js/src/hyperliquid.js +16 -0
- package/js/src/kraken.js +2 -0
- package/js/src/okx.js +2 -3
- package/js/src/oxfun.d.ts +10 -0
- package/js/src/oxfun.js +21 -1
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/binance.js +3 -3
- package/js/src/pro/coinbase.d.ts +4 -3
- package/js/src/pro/coinbase.js +43 -60
- package/js/src/pro/hyperliquid.js +10 -2
- package/js/src/pro/upbit.d.ts +16 -1
- package/js/src/pro/upbit.js +43 -0
- package/js/src/timex.js +2 -2
- package/js/src/upbit.d.ts +42 -20
- package/js/src/upbit.js +43 -21
- package/js/src/whitebit.js +65 -12
- package/package.json +1 -1
package/js/src/bitfinex.js
CHANGED
|
@@ -742,7 +742,8 @@ export default class bitfinex extends Exchange {
|
|
|
742
742
|
'pub:map:currency:pool',
|
|
743
743
|
'pub:map:currency:explorer',
|
|
744
744
|
'pub:map:currency:tx:fee',
|
|
745
|
-
'pub:map:tx:method',
|
|
745
|
+
'pub:map:tx:method',
|
|
746
|
+
'pub:info:tx:status', // maps withdrawal/deposit statuses, coins: 1 = enabled, 0 = maintenance
|
|
746
747
|
];
|
|
747
748
|
const config = labels.join(',');
|
|
748
749
|
const request = {
|
|
@@ -825,42 +826,85 @@ export default class bitfinex extends Exchange {
|
|
|
825
826
|
// ["ABS",[0,131.3]],
|
|
826
827
|
// ["ADA",[0,0.3]],
|
|
827
828
|
// ],
|
|
829
|
+
// // deposit/withdrawal data
|
|
830
|
+
// [
|
|
831
|
+
// ["BITCOIN", 1, 1, null, null, null, null, 0, 0, null, null, 3],
|
|
832
|
+
// ...
|
|
833
|
+
// ]
|
|
828
834
|
// ]
|
|
829
835
|
//
|
|
830
836
|
const indexed = {
|
|
831
|
-
'sym': this.indexBy(this.
|
|
832
|
-
'label': this.indexBy(this.
|
|
833
|
-
'unit': this.indexBy(this.
|
|
834
|
-
'undl': this.indexBy(this.
|
|
835
|
-
'pool': this.indexBy(this.
|
|
836
|
-
'explorer': this.indexBy(this.
|
|
837
|
-
'fees': this.indexBy(this.
|
|
837
|
+
'sym': this.indexBy(this.safeList(response, 1, []), 0),
|
|
838
|
+
'label': this.indexBy(this.safeList(response, 2, []), 0),
|
|
839
|
+
'unit': this.indexBy(this.safeList(response, 3, []), 0),
|
|
840
|
+
'undl': this.indexBy(this.safeList(response, 4, []), 0),
|
|
841
|
+
'pool': this.indexBy(this.safeList(response, 5, []), 0),
|
|
842
|
+
'explorer': this.indexBy(this.safeList(response, 6, []), 0),
|
|
843
|
+
'fees': this.indexBy(this.safeList(response, 7, []), 0),
|
|
844
|
+
'networks': this.safeList(response, 8, []),
|
|
845
|
+
'statuses': this.indexBy(this.safeList(response, 9, []), 0),
|
|
838
846
|
};
|
|
839
|
-
const
|
|
847
|
+
const indexedNetworks = {};
|
|
848
|
+
for (let i = 0; i < indexed['networks'].length; i++) {
|
|
849
|
+
const networkObj = indexed['networks'][i];
|
|
850
|
+
const networkId = this.safeString(networkObj, 0);
|
|
851
|
+
const valuesList = this.safeList(networkObj, 1);
|
|
852
|
+
const networkName = this.safeString(valuesList, 0);
|
|
853
|
+
// for GOlang transpiler, do with "safe" method
|
|
854
|
+
const networksList = this.safeList(indexedNetworks, networkName, []);
|
|
855
|
+
networksList.push(networkId);
|
|
856
|
+
indexedNetworks[networkName] = networksList;
|
|
857
|
+
}
|
|
858
|
+
const ids = this.safeList(response, 0, []);
|
|
840
859
|
const result = {};
|
|
841
860
|
for (let i = 0; i < ids.length; i++) {
|
|
842
861
|
const id = ids[i];
|
|
843
|
-
if (id.
|
|
862
|
+
if (id.endsWith('F0')) {
|
|
844
863
|
// we get a lot of F0 currencies, skip those
|
|
845
864
|
continue;
|
|
846
865
|
}
|
|
847
866
|
const code = this.safeCurrencyCode(id);
|
|
848
|
-
const label = this.
|
|
867
|
+
const label = this.safeList(indexed['label'], id, []);
|
|
849
868
|
const name = this.safeString(label, 1);
|
|
850
|
-
const pool = this.
|
|
869
|
+
const pool = this.safeList(indexed['pool'], id, []);
|
|
851
870
|
const rawType = this.safeString(pool, 1);
|
|
852
871
|
const isCryptoCoin = (rawType !== undefined) || (id in indexed['explorer']); // "hacky" solution
|
|
853
872
|
let type = undefined;
|
|
854
873
|
if (isCryptoCoin) {
|
|
855
874
|
type = 'crypto';
|
|
856
875
|
}
|
|
857
|
-
const feeValues = this.
|
|
858
|
-
const fees = this.
|
|
876
|
+
const feeValues = this.safeList(indexed['fees'], id, []);
|
|
877
|
+
const fees = this.safeList(feeValues, 1, []);
|
|
859
878
|
const fee = this.safeNumber(fees, 1);
|
|
860
|
-
const undl = this.
|
|
879
|
+
const undl = this.safeList(indexed['undl'], id, []);
|
|
861
880
|
const precision = '8'; // default precision, todo: fix "magic constants"
|
|
862
881
|
const fid = 'f' + id;
|
|
863
|
-
|
|
882
|
+
const dwStatuses = this.safeList(indexed['statuses'], id, []);
|
|
883
|
+
const depositEnabled = this.safeInteger(dwStatuses, 1) === 1;
|
|
884
|
+
const withdrawEnabled = this.safeInteger(dwStatuses, 2) === 1;
|
|
885
|
+
const networks = {};
|
|
886
|
+
const netwokIds = this.safeList(indexedNetworks, id, []);
|
|
887
|
+
for (let j = 0; j < netwokIds.length; j++) {
|
|
888
|
+
const networkId = netwokIds[j];
|
|
889
|
+
const network = this.networkIdToCode(networkId);
|
|
890
|
+
networks[network] = {
|
|
891
|
+
'info': networkId,
|
|
892
|
+
'id': networkId.toLowerCase(),
|
|
893
|
+
'network': networkId,
|
|
894
|
+
'active': undefined,
|
|
895
|
+
'deposit': undefined,
|
|
896
|
+
'withdraw': undefined,
|
|
897
|
+
'fee': undefined,
|
|
898
|
+
'precision': undefined,
|
|
899
|
+
'limits': {
|
|
900
|
+
'withdraw': {
|
|
901
|
+
'min': undefined,
|
|
902
|
+
'max': undefined,
|
|
903
|
+
},
|
|
904
|
+
},
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
result[code] = this.safeCurrencyStructure({
|
|
864
908
|
'id': fid,
|
|
865
909
|
'uppercaseId': id,
|
|
866
910
|
'code': code,
|
|
@@ -868,8 +912,8 @@ export default class bitfinex extends Exchange {
|
|
|
868
912
|
'type': type,
|
|
869
913
|
'name': name,
|
|
870
914
|
'active': true,
|
|
871
|
-
'deposit':
|
|
872
|
-
'withdraw':
|
|
915
|
+
'deposit': depositEnabled,
|
|
916
|
+
'withdraw': withdrawEnabled,
|
|
873
917
|
'fee': fee,
|
|
874
918
|
'precision': parseInt(precision),
|
|
875
919
|
'limits': {
|
|
@@ -882,40 +926,8 @@ export default class bitfinex extends Exchange {
|
|
|
882
926
|
'max': undefined,
|
|
883
927
|
},
|
|
884
928
|
},
|
|
885
|
-
'networks':
|
|
886
|
-
};
|
|
887
|
-
const networks = {};
|
|
888
|
-
const currencyNetworks = this.safeValue(response, 8, []);
|
|
889
|
-
const cleanId = id.replace('F0', '');
|
|
890
|
-
for (let j = 0; j < currencyNetworks.length; j++) {
|
|
891
|
-
const pair = currencyNetworks[j];
|
|
892
|
-
const networkId = this.safeString(pair, 0);
|
|
893
|
-
const currencyId = this.safeString(this.safeValue(pair, 1, []), 0);
|
|
894
|
-
if (currencyId === cleanId) {
|
|
895
|
-
const network = this.networkIdToCode(networkId);
|
|
896
|
-
networks[network] = {
|
|
897
|
-
'info': networkId,
|
|
898
|
-
'id': networkId.toLowerCase(),
|
|
899
|
-
'network': networkId,
|
|
900
|
-
'active': undefined,
|
|
901
|
-
'deposit': undefined,
|
|
902
|
-
'withdraw': undefined,
|
|
903
|
-
'fee': undefined,
|
|
904
|
-
'precision': undefined,
|
|
905
|
-
'limits': {
|
|
906
|
-
'withdraw': {
|
|
907
|
-
'min': undefined,
|
|
908
|
-
'max': undefined,
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
const keysNetworks = Object.keys(networks);
|
|
915
|
-
const networksLength = keysNetworks.length;
|
|
916
|
-
if (networksLength > 0) {
|
|
917
|
-
result[code]['networks'] = networks;
|
|
918
|
-
}
|
|
929
|
+
'networks': networks,
|
|
930
|
+
});
|
|
919
931
|
}
|
|
920
932
|
return result;
|
|
921
933
|
}
|
|
@@ -1161,9 +1173,8 @@ export default class bitfinex extends Exchange {
|
|
|
1161
1173
|
//
|
|
1162
1174
|
// on trading pairs (ex. tBTCUSD)
|
|
1163
1175
|
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
// SYMBOL,
|
|
1176
|
+
// [
|
|
1177
|
+
// SYMBOL, // this index is not present in singular-ticker
|
|
1167
1178
|
// BID,
|
|
1168
1179
|
// BID_SIZE,
|
|
1169
1180
|
// ASK,
|
|
@@ -1174,15 +1185,13 @@ export default class bitfinex extends Exchange {
|
|
|
1174
1185
|
// VOLUME,
|
|
1175
1186
|
// HIGH,
|
|
1176
1187
|
// LOW
|
|
1177
|
-
//
|
|
1178
|
-
// }
|
|
1188
|
+
// ]
|
|
1179
1189
|
//
|
|
1180
1190
|
//
|
|
1181
1191
|
// on funding currencies (ex. fUSD)
|
|
1182
1192
|
//
|
|
1183
|
-
//
|
|
1184
|
-
//
|
|
1185
|
-
// SYMBOL,
|
|
1193
|
+
// [
|
|
1194
|
+
// SYMBOL, // this index is not present in singular-ticker
|
|
1186
1195
|
// FRR,
|
|
1187
1196
|
// BID,
|
|
1188
1197
|
// BID_PERIOD,
|
|
@@ -1199,35 +1208,75 @@ export default class bitfinex extends Exchange {
|
|
|
1199
1208
|
// _PLACEHOLDER,
|
|
1200
1209
|
// _PLACEHOLDER,
|
|
1201
1210
|
// FRR_AMOUNT_AVAILABLE
|
|
1202
|
-
//
|
|
1203
|
-
// }
|
|
1211
|
+
// ]
|
|
1204
1212
|
//
|
|
1205
|
-
const
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1213
|
+
const length = ticker.length;
|
|
1214
|
+
const isFetchTicker = (length === 10) || (length === 16);
|
|
1215
|
+
let symbol = undefined;
|
|
1216
|
+
let minusIndex = 0;
|
|
1217
|
+
let isFundingCurrency = false;
|
|
1218
|
+
if (isFetchTicker) {
|
|
1219
|
+
minusIndex = 1;
|
|
1220
|
+
isFundingCurrency = (length === 16);
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
const marketId = this.safeString(ticker, 0);
|
|
1224
|
+
market = this.safeMarket(marketId, market);
|
|
1225
|
+
isFundingCurrency = (length === 17);
|
|
1226
|
+
}
|
|
1227
|
+
symbol = this.safeSymbol(undefined, market);
|
|
1228
|
+
let last = undefined;
|
|
1229
|
+
let bid = undefined;
|
|
1230
|
+
let ask = undefined;
|
|
1231
|
+
let change = undefined;
|
|
1232
|
+
let percentage = undefined;
|
|
1233
|
+
let volume = undefined;
|
|
1234
|
+
let high = undefined;
|
|
1235
|
+
let low = undefined;
|
|
1236
|
+
if (isFundingCurrency) {
|
|
1237
|
+
// per api docs, they are different array type
|
|
1238
|
+
last = this.safeString(ticker, 10 - minusIndex);
|
|
1239
|
+
bid = this.safeString(ticker, 2 - minusIndex);
|
|
1240
|
+
ask = this.safeString(ticker, 5 - minusIndex);
|
|
1241
|
+
change = this.safeString(ticker, 8 - minusIndex);
|
|
1242
|
+
percentage = this.safeString(ticker, 9 - minusIndex);
|
|
1243
|
+
volume = this.safeString(ticker, 11 - minusIndex);
|
|
1244
|
+
high = this.safeString(ticker, 12 - minusIndex);
|
|
1245
|
+
low = this.safeString(ticker, 13 - minusIndex);
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
// on trading pairs (ex. tBTCUSD or tHMSTR:USD)
|
|
1249
|
+
last = this.safeString(ticker, 7 - minusIndex);
|
|
1250
|
+
bid = this.safeString(ticker, 1 - minusIndex);
|
|
1251
|
+
ask = this.safeString(ticker, 3 - minusIndex);
|
|
1252
|
+
change = this.safeString(ticker, 5 - minusIndex);
|
|
1253
|
+
percentage = this.safeString(ticker, 6 - minusIndex);
|
|
1254
|
+
percentage = Precise.stringMul(percentage, '100');
|
|
1255
|
+
volume = this.safeString(ticker, 8 - minusIndex);
|
|
1256
|
+
high = this.safeString(ticker, 9 - minusIndex);
|
|
1257
|
+
low = this.safeString(ticker, 10 - minusIndex);
|
|
1258
|
+
}
|
|
1210
1259
|
return this.safeTicker({
|
|
1211
1260
|
'symbol': symbol,
|
|
1212
1261
|
'timestamp': undefined,
|
|
1213
1262
|
'datetime': undefined,
|
|
1214
|
-
'high':
|
|
1215
|
-
'low':
|
|
1216
|
-
'bid':
|
|
1217
|
-
'bidVolume':
|
|
1218
|
-
'ask':
|
|
1219
|
-
'askVolume':
|
|
1263
|
+
'high': high,
|
|
1264
|
+
'low': low,
|
|
1265
|
+
'bid': bid,
|
|
1266
|
+
'bidVolume': undefined,
|
|
1267
|
+
'ask': ask,
|
|
1268
|
+
'askVolume': undefined,
|
|
1220
1269
|
'vwap': undefined,
|
|
1221
1270
|
'open': undefined,
|
|
1222
1271
|
'close': last,
|
|
1223
1272
|
'last': last,
|
|
1224
1273
|
'previousClose': undefined,
|
|
1225
|
-
'change':
|
|
1226
|
-
'percentage':
|
|
1274
|
+
'change': change,
|
|
1275
|
+
'percentage': percentage,
|
|
1227
1276
|
'average': undefined,
|
|
1228
|
-
'baseVolume':
|
|
1277
|
+
'baseVolume': volume,
|
|
1229
1278
|
'quoteVolume': undefined,
|
|
1230
|
-
'info':
|
|
1279
|
+
'info': ticker,
|
|
1231
1280
|
}, market);
|
|
1232
1281
|
}
|
|
1233
1282
|
/**
|
|
@@ -1290,15 +1339,7 @@ export default class bitfinex extends Exchange {
|
|
|
1290
1339
|
// ...
|
|
1291
1340
|
// ]
|
|
1292
1341
|
//
|
|
1293
|
-
|
|
1294
|
-
for (let i = 0; i < tickers.length; i++) {
|
|
1295
|
-
const ticker = tickers[i];
|
|
1296
|
-
const marketId = this.safeString(ticker, 0);
|
|
1297
|
-
const market = this.safeMarket(marketId);
|
|
1298
|
-
const symbol = market['symbol'];
|
|
1299
|
-
result[symbol] = this.parseTicker({ 'result': ticker }, market);
|
|
1300
|
-
}
|
|
1301
|
-
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
1342
|
+
return this.parseTickers(tickers, symbols);
|
|
1302
1343
|
}
|
|
1303
1344
|
/**
|
|
1304
1345
|
* @method
|
|
@@ -1316,8 +1357,7 @@ export default class bitfinex extends Exchange {
|
|
|
1316
1357
|
'symbol': market['id'],
|
|
1317
1358
|
};
|
|
1318
1359
|
const ticker = await this.publicGetTickerSymbol(this.extend(request, params));
|
|
1319
|
-
|
|
1320
|
-
return this.parseTicker(result, market);
|
|
1360
|
+
return this.parseTicker(ticker, market);
|
|
1321
1361
|
}
|
|
1322
1362
|
parseTrade(trade, market = undefined) {
|
|
1323
1363
|
//
|
package/js/src/bitget.d.ts
CHANGED
|
@@ -226,6 +226,7 @@ export default class bitget extends Exchange {
|
|
|
226
226
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
227
227
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
228
228
|
* @param {boolean} [params.useHistoryEndpoint] whether to force to use historical endpoint (it has max limit of 200)
|
|
229
|
+
* @param {boolean} [params.useHistoryEndpointForPagination] whether to force to use historical endpoint for pagination (default true)
|
|
229
230
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
230
231
|
* @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
|
|
231
232
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
package/js/src/bitget.js
CHANGED
|
@@ -1546,7 +1546,9 @@ export default class bitget extends Exchange {
|
|
|
1546
1546
|
'fetchPositions': {
|
|
1547
1547
|
'method': 'privateMixGetV2MixPositionAllPosition', // or privateMixGetV2MixPositionHistoryPosition
|
|
1548
1548
|
},
|
|
1549
|
-
'defaultTimeInForce': 'GTC',
|
|
1549
|
+
'defaultTimeInForce': 'GTC',
|
|
1550
|
+
// fiat currencies on deposit page
|
|
1551
|
+
'fiatCurrencies': ['EUR', 'VND', 'PLN', 'CZK', 'HUF', 'DKK', 'AUD', 'CAD', 'NOK', 'SEK', 'CHF', 'MXN', 'COP', 'ARS', 'GBP', 'BRL', 'UAH', 'ZAR'],
|
|
1550
1552
|
},
|
|
1551
1553
|
'features': {
|
|
1552
1554
|
'spot': {
|
|
@@ -2033,47 +2035,47 @@ export default class bitget extends Exchange {
|
|
|
2033
2035
|
async fetchCurrencies(params = {}) {
|
|
2034
2036
|
const response = await this.publicSpotGetV2SpotPublicCoins(params);
|
|
2035
2037
|
//
|
|
2036
|
-
//
|
|
2037
|
-
//
|
|
2038
|
-
//
|
|
2039
|
-
//
|
|
2040
|
-
//
|
|
2041
|
-
//
|
|
2042
|
-
//
|
|
2043
|
-
//
|
|
2044
|
-
//
|
|
2045
|
-
//
|
|
2046
|
-
//
|
|
2047
|
-
//
|
|
2048
|
-
//
|
|
2049
|
-
//
|
|
2050
|
-
//
|
|
2051
|
-
//
|
|
2052
|
-
//
|
|
2053
|
-
//
|
|
2054
|
-
//
|
|
2055
|
-
//
|
|
2056
|
-
//
|
|
2057
|
-
//
|
|
2058
|
-
//
|
|
2059
|
-
//
|
|
2060
|
-
//
|
|
2061
|
-
//
|
|
2062
|
-
//
|
|
2038
|
+
// {
|
|
2039
|
+
// "code": "00000",
|
|
2040
|
+
// "msg": "success",
|
|
2041
|
+
// "requestTime": "1746195617812",
|
|
2042
|
+
// "data": [
|
|
2043
|
+
// {
|
|
2044
|
+
// "coinId": "1456",
|
|
2045
|
+
// "coin": "NEIROETH",
|
|
2046
|
+
// "transfer": "false",
|
|
2047
|
+
// "chains": [
|
|
2048
|
+
// {
|
|
2049
|
+
// "chain": "ERC20",
|
|
2050
|
+
// "needTag": "false",
|
|
2051
|
+
// "withdrawable": "true",
|
|
2052
|
+
// "rechargeable": "true",
|
|
2053
|
+
// "withdrawFee": "44.91017965",
|
|
2054
|
+
// "extraWithdrawFee": "0",
|
|
2055
|
+
// "depositConfirm": "12",
|
|
2056
|
+
// "withdrawConfirm": "64",
|
|
2057
|
+
// "minDepositAmount": "0.06",
|
|
2058
|
+
// "minWithdrawAmount": "60",
|
|
2059
|
+
// "browserUrl": "https://etherscan.io/tx/",
|
|
2060
|
+
// "contractAddress": "0xee2a03aa6dacf51c18679c516ad5283d8e7c2637",
|
|
2061
|
+
// "withdrawStep": "0",
|
|
2062
|
+
// "withdrawMinScale": "8",
|
|
2063
|
+
// "congestion": "normal"
|
|
2064
|
+
// }
|
|
2065
|
+
// ],
|
|
2066
|
+
// "areaCoin": "no"
|
|
2067
|
+
// },
|
|
2068
|
+
// ...
|
|
2063
2069
|
//
|
|
2064
2070
|
const result = {};
|
|
2065
2071
|
const data = this.safeValue(response, 'data', []);
|
|
2072
|
+
const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
|
|
2066
2073
|
for (let i = 0; i < data.length; i++) {
|
|
2067
2074
|
const entry = data[i];
|
|
2068
2075
|
const id = this.safeString(entry, 'coin'); // we don't use 'coinId' as it has no use. it is 'coin' field that needs to be used in currency related endpoints (deposit, withdraw, etc..)
|
|
2069
2076
|
const code = this.safeCurrencyCode(id);
|
|
2070
2077
|
const chains = this.safeValue(entry, 'chains', []);
|
|
2071
2078
|
const networks = {};
|
|
2072
|
-
let deposit = false;
|
|
2073
|
-
let withdraw = false;
|
|
2074
|
-
let minWithdrawString = undefined;
|
|
2075
|
-
let minDepositString = undefined;
|
|
2076
|
-
let minWithdrawFeeString = undefined;
|
|
2077
2079
|
for (let j = 0; j < chains.length; j++) {
|
|
2078
2080
|
const chain = chains[j];
|
|
2079
2081
|
const networkId = this.safeString(chain, 'chain');
|
|
@@ -2081,56 +2083,39 @@ export default class bitget extends Exchange {
|
|
|
2081
2083
|
if (network !== undefined) {
|
|
2082
2084
|
network = network.toUpperCase();
|
|
2083
2085
|
}
|
|
2084
|
-
const withdrawEnabled = this.safeString(chain, 'withdrawable');
|
|
2085
|
-
const canWithdraw = withdrawEnabled === 'true';
|
|
2086
|
-
withdraw = (canWithdraw) ? canWithdraw : withdraw;
|
|
2087
|
-
const depositEnabled = this.safeString(chain, 'rechargeable');
|
|
2088
|
-
const canDeposit = depositEnabled === 'true';
|
|
2089
|
-
deposit = (canDeposit) ? canDeposit : deposit;
|
|
2090
|
-
const networkWithdrawFeeString = this.safeString(chain, 'withdrawFee');
|
|
2091
|
-
if (networkWithdrawFeeString !== undefined) {
|
|
2092
|
-
minWithdrawFeeString = (minWithdrawFeeString === undefined) ? networkWithdrawFeeString : Precise.stringMin(networkWithdrawFeeString, minWithdrawFeeString);
|
|
2093
|
-
}
|
|
2094
|
-
const networkMinWithdrawString = this.safeString(chain, 'minWithdrawAmount');
|
|
2095
|
-
if (networkMinWithdrawString !== undefined) {
|
|
2096
|
-
minWithdrawString = (minWithdrawString === undefined) ? networkMinWithdrawString : Precise.stringMin(networkMinWithdrawString, minWithdrawString);
|
|
2097
|
-
}
|
|
2098
|
-
const networkMinDepositString = this.safeString(chain, 'minDepositAmount');
|
|
2099
|
-
if (networkMinDepositString !== undefined) {
|
|
2100
|
-
minDepositString = (minDepositString === undefined) ? networkMinDepositString : Precise.stringMin(networkMinDepositString, minDepositString);
|
|
2101
|
-
}
|
|
2102
2086
|
networks[network] = {
|
|
2103
2087
|
'info': chain,
|
|
2104
2088
|
'id': networkId,
|
|
2105
2089
|
'network': network,
|
|
2106
2090
|
'limits': {
|
|
2107
2091
|
'withdraw': {
|
|
2108
|
-
'min': this.
|
|
2092
|
+
'min': this.safeNumber(chain, 'minWithdrawAmount'),
|
|
2109
2093
|
'max': undefined,
|
|
2110
2094
|
},
|
|
2111
2095
|
'deposit': {
|
|
2112
|
-
'min': this.
|
|
2096
|
+
'min': this.safeNumber(chain, 'minDepositAmount'),
|
|
2113
2097
|
'max': undefined,
|
|
2114
2098
|
},
|
|
2115
2099
|
},
|
|
2116
|
-
'active':
|
|
2117
|
-
'withdraw':
|
|
2118
|
-
'deposit':
|
|
2119
|
-
'fee': this.
|
|
2120
|
-
'precision':
|
|
2100
|
+
'active': undefined,
|
|
2101
|
+
'withdraw': this.safeString(chain, 'withdrawable') === 'true',
|
|
2102
|
+
'deposit': this.safeString(chain, 'rechargeable') === 'true',
|
|
2103
|
+
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
2104
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawMinScale'))),
|
|
2121
2105
|
};
|
|
2122
2106
|
}
|
|
2123
|
-
|
|
2107
|
+
const isFiat = this.inArray(code, fiatCurrencies);
|
|
2108
|
+
result[code] = this.safeCurrencyStructure({
|
|
2124
2109
|
'info': entry,
|
|
2125
2110
|
'id': id,
|
|
2126
2111
|
'code': code,
|
|
2127
2112
|
'networks': networks,
|
|
2128
|
-
'type':
|
|
2113
|
+
'type': isFiat ? 'fiat' : 'crypto',
|
|
2129
2114
|
'name': undefined,
|
|
2130
|
-
'active':
|
|
2131
|
-
'deposit':
|
|
2132
|
-
'withdraw':
|
|
2133
|
-
'fee':
|
|
2115
|
+
'active': undefined,
|
|
2116
|
+
'deposit': undefined,
|
|
2117
|
+
'withdraw': undefined,
|
|
2118
|
+
'fee': undefined,
|
|
2134
2119
|
'precision': undefined,
|
|
2135
2120
|
'limits': {
|
|
2136
2121
|
'amount': {
|
|
@@ -2138,16 +2123,16 @@ export default class bitget extends Exchange {
|
|
|
2138
2123
|
'max': undefined,
|
|
2139
2124
|
},
|
|
2140
2125
|
'withdraw': {
|
|
2141
|
-
'min':
|
|
2126
|
+
'min': undefined,
|
|
2142
2127
|
'max': undefined,
|
|
2143
2128
|
},
|
|
2144
2129
|
'deposit': {
|
|
2145
|
-
'min':
|
|
2130
|
+
'min': undefined,
|
|
2146
2131
|
'max': undefined,
|
|
2147
2132
|
},
|
|
2148
2133
|
},
|
|
2149
2134
|
'created': undefined,
|
|
2150
|
-
};
|
|
2135
|
+
});
|
|
2151
2136
|
}
|
|
2152
2137
|
return result;
|
|
2153
2138
|
}
|
|
@@ -2792,7 +2777,7 @@ export default class bitget extends Exchange {
|
|
|
2792
2777
|
const close = this.safeString(ticker, 'lastPr');
|
|
2793
2778
|
const timestamp = this.safeIntegerOmitZero(ticker, 'ts'); // exchange bitget provided 0
|
|
2794
2779
|
const change = this.safeString(ticker, 'change24h');
|
|
2795
|
-
const open24 = this.
|
|
2780
|
+
const open24 = this.safeString2(ticker, 'open24', 'open24h');
|
|
2796
2781
|
const open = this.safeString(ticker, 'open');
|
|
2797
2782
|
let symbol;
|
|
2798
2783
|
let openValue;
|
|
@@ -3492,6 +3477,7 @@ export default class bitget extends Exchange {
|
|
|
3492
3477
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3493
3478
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
3494
3479
|
* @param {boolean} [params.useHistoryEndpoint] whether to force to use historical endpoint (it has max limit of 200)
|
|
3480
|
+
* @param {boolean} [params.useHistoryEndpointForPagination] whether to force to use historical endpoint for pagination (default true)
|
|
3495
3481
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3496
3482
|
* @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
|
|
3497
3483
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
@@ -3501,12 +3487,14 @@ export default class bitget extends Exchange {
|
|
|
3501
3487
|
const defaultLimit = 100; // default 100, max 1000
|
|
3502
3488
|
const maxLimitForRecentEndpoint = 1000;
|
|
3503
3489
|
const maxLimitForHistoryEndpoint = 200; // note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
|
|
3490
|
+
const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
|
|
3491
|
+
const useHistoryEndpointForPagination = this.safeBool(params, 'useHistoryEndpointForPagination', true);
|
|
3504
3492
|
let paginate = false;
|
|
3505
3493
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
3506
3494
|
if (paginate) {
|
|
3507
|
-
|
|
3495
|
+
const limitForPagination = useHistoryEndpointForPagination ? maxLimitForHistoryEndpoint : maxLimitForRecentEndpoint;
|
|
3496
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, limitForPagination);
|
|
3508
3497
|
}
|
|
3509
|
-
const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
|
|
3510
3498
|
const market = this.market(symbol);
|
|
3511
3499
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3512
3500
|
const timeframes = this.options['timeframes'][marketType];
|
|
@@ -4155,7 +4143,8 @@ export default class bitget extends Exchange {
|
|
|
4155
4143
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
4156
4144
|
const timestamp = this.safeInteger2(order, 'cTime', 'ctime');
|
|
4157
4145
|
const updateTimestamp = this.safeInteger(order, 'uTime');
|
|
4158
|
-
|
|
4146
|
+
let rawStatus = this.safeString2(order, 'status', 'state');
|
|
4147
|
+
rawStatus = this.safeString(order, 'planStatus', rawStatus);
|
|
4159
4148
|
let fee = undefined;
|
|
4160
4149
|
const feeCostString = this.safeString(order, 'fee');
|
|
4161
4150
|
if (feeCostString !== undefined) {
|
package/js/src/bitmart.d.ts
CHANGED
|
@@ -607,6 +607,7 @@ export default class bitmart extends Exchange {
|
|
|
607
607
|
* @name bitmart#fetchPositions
|
|
608
608
|
* @description fetch all open contract positions
|
|
609
609
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
|
610
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed
|
|
610
611
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
611
612
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
612
613
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
package/js/src/bitmart.js
CHANGED
|
@@ -209,6 +209,7 @@ export default class bitmart extends Exchange {
|
|
|
209
209
|
'contract/private/order': 1.2,
|
|
210
210
|
'contract/private/order-history': 10,
|
|
211
211
|
'contract/private/position': 10,
|
|
212
|
+
'contract/private/position-v2': 10,
|
|
212
213
|
'contract/private/get-open-orders': 1.2,
|
|
213
214
|
'contract/private/current-plan-order': 1.2,
|
|
214
215
|
'contract/private/trades': 10,
|
|
@@ -1206,6 +1207,7 @@ export default class bitmart extends Exchange {
|
|
|
1206
1207
|
// {
|
|
1207
1208
|
// "currency": "BTC",
|
|
1208
1209
|
// "name": "Bitcoin",
|
|
1210
|
+
// "recharge_minsize": '0.00000001',
|
|
1209
1211
|
// "contract_address": null,
|
|
1210
1212
|
// "network": "BTC",
|
|
1211
1213
|
// "withdraw_enabled": true,
|
|
@@ -1227,7 +1229,8 @@ export default class bitmart extends Exchange {
|
|
|
1227
1229
|
const fullId = this.safeString(currency, 'currency');
|
|
1228
1230
|
let currencyId = fullId;
|
|
1229
1231
|
let networkId = this.safeString(currency, 'network');
|
|
1230
|
-
|
|
1232
|
+
const isNtf = (fullId.indexOf('NFT') >= 0);
|
|
1233
|
+
if (!isNtf) {
|
|
1231
1234
|
const parts = fullId.split('-');
|
|
1232
1235
|
currencyId = this.safeString(parts, 0);
|
|
1233
1236
|
const second = this.safeString(parts, 1);
|
|
@@ -1248,6 +1251,7 @@ export default class bitmart extends Exchange {
|
|
|
1248
1251
|
'withdraw': undefined,
|
|
1249
1252
|
'active': undefined,
|
|
1250
1253
|
'networks': {},
|
|
1254
|
+
'type': isNtf ? 'other' : 'crypto',
|
|
1251
1255
|
};
|
|
1252
1256
|
}
|
|
1253
1257
|
const networkCode = this.networkIdToCode(networkId);
|
|
@@ -4899,6 +4903,7 @@ export default class bitmart extends Exchange {
|
|
|
4899
4903
|
* @name bitmart#fetchPositions
|
|
4900
4904
|
* @description fetch all open contract positions
|
|
4901
4905
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
|
4906
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed
|
|
4902
4907
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
4903
4908
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4904
4909
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4917,7 +4922,7 @@ export default class bitmart extends Exchange {
|
|
|
4917
4922
|
// only supports symbols as undefined or sending one symbol
|
|
4918
4923
|
request['symbol'] = market['id'];
|
|
4919
4924
|
}
|
|
4920
|
-
const response = await this.
|
|
4925
|
+
const response = await this.privateGetContractPrivatePositionV2(this.extend(request, params));
|
|
4921
4926
|
//
|
|
4922
4927
|
// {
|
|
4923
4928
|
// "code": 1000,
|