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/dist/cjs/src/bitfinex.js
CHANGED
|
@@ -739,7 +739,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
739
739
|
'pub:map:currency:pool',
|
|
740
740
|
'pub:map:currency:explorer',
|
|
741
741
|
'pub:map:currency:tx:fee',
|
|
742
|
-
'pub:map:tx:method',
|
|
742
|
+
'pub:map:tx:method',
|
|
743
|
+
'pub:info:tx:status', // maps withdrawal/deposit statuses, coins: 1 = enabled, 0 = maintenance
|
|
743
744
|
];
|
|
744
745
|
const config = labels.join(',');
|
|
745
746
|
const request = {
|
|
@@ -822,42 +823,85 @@ class bitfinex extends bitfinex$1 {
|
|
|
822
823
|
// ["ABS",[0,131.3]],
|
|
823
824
|
// ["ADA",[0,0.3]],
|
|
824
825
|
// ],
|
|
826
|
+
// // deposit/withdrawal data
|
|
827
|
+
// [
|
|
828
|
+
// ["BITCOIN", 1, 1, null, null, null, null, 0, 0, null, null, 3],
|
|
829
|
+
// ...
|
|
830
|
+
// ]
|
|
825
831
|
// ]
|
|
826
832
|
//
|
|
827
833
|
const indexed = {
|
|
828
|
-
'sym': this.indexBy(this.
|
|
829
|
-
'label': this.indexBy(this.
|
|
830
|
-
'unit': this.indexBy(this.
|
|
831
|
-
'undl': this.indexBy(this.
|
|
832
|
-
'pool': this.indexBy(this.
|
|
833
|
-
'explorer': this.indexBy(this.
|
|
834
|
-
'fees': this.indexBy(this.
|
|
834
|
+
'sym': this.indexBy(this.safeList(response, 1, []), 0),
|
|
835
|
+
'label': this.indexBy(this.safeList(response, 2, []), 0),
|
|
836
|
+
'unit': this.indexBy(this.safeList(response, 3, []), 0),
|
|
837
|
+
'undl': this.indexBy(this.safeList(response, 4, []), 0),
|
|
838
|
+
'pool': this.indexBy(this.safeList(response, 5, []), 0),
|
|
839
|
+
'explorer': this.indexBy(this.safeList(response, 6, []), 0),
|
|
840
|
+
'fees': this.indexBy(this.safeList(response, 7, []), 0),
|
|
841
|
+
'networks': this.safeList(response, 8, []),
|
|
842
|
+
'statuses': this.indexBy(this.safeList(response, 9, []), 0),
|
|
835
843
|
};
|
|
836
|
-
const
|
|
844
|
+
const indexedNetworks = {};
|
|
845
|
+
for (let i = 0; i < indexed['networks'].length; i++) {
|
|
846
|
+
const networkObj = indexed['networks'][i];
|
|
847
|
+
const networkId = this.safeString(networkObj, 0);
|
|
848
|
+
const valuesList = this.safeList(networkObj, 1);
|
|
849
|
+
const networkName = this.safeString(valuesList, 0);
|
|
850
|
+
// for GOlang transpiler, do with "safe" method
|
|
851
|
+
const networksList = this.safeList(indexedNetworks, networkName, []);
|
|
852
|
+
networksList.push(networkId);
|
|
853
|
+
indexedNetworks[networkName] = networksList;
|
|
854
|
+
}
|
|
855
|
+
const ids = this.safeList(response, 0, []);
|
|
837
856
|
const result = {};
|
|
838
857
|
for (let i = 0; i < ids.length; i++) {
|
|
839
858
|
const id = ids[i];
|
|
840
|
-
if (id.
|
|
859
|
+
if (id.endsWith('F0')) {
|
|
841
860
|
// we get a lot of F0 currencies, skip those
|
|
842
861
|
continue;
|
|
843
862
|
}
|
|
844
863
|
const code = this.safeCurrencyCode(id);
|
|
845
|
-
const label = this.
|
|
864
|
+
const label = this.safeList(indexed['label'], id, []);
|
|
846
865
|
const name = this.safeString(label, 1);
|
|
847
|
-
const pool = this.
|
|
866
|
+
const pool = this.safeList(indexed['pool'], id, []);
|
|
848
867
|
const rawType = this.safeString(pool, 1);
|
|
849
868
|
const isCryptoCoin = (rawType !== undefined) || (id in indexed['explorer']); // "hacky" solution
|
|
850
869
|
let type = undefined;
|
|
851
870
|
if (isCryptoCoin) {
|
|
852
871
|
type = 'crypto';
|
|
853
872
|
}
|
|
854
|
-
const feeValues = this.
|
|
855
|
-
const fees = this.
|
|
873
|
+
const feeValues = this.safeList(indexed['fees'], id, []);
|
|
874
|
+
const fees = this.safeList(feeValues, 1, []);
|
|
856
875
|
const fee = this.safeNumber(fees, 1);
|
|
857
|
-
const undl = this.
|
|
876
|
+
const undl = this.safeList(indexed['undl'], id, []);
|
|
858
877
|
const precision = '8'; // default precision, todo: fix "magic constants"
|
|
859
878
|
const fid = 'f' + id;
|
|
860
|
-
|
|
879
|
+
const dwStatuses = this.safeList(indexed['statuses'], id, []);
|
|
880
|
+
const depositEnabled = this.safeInteger(dwStatuses, 1) === 1;
|
|
881
|
+
const withdrawEnabled = this.safeInteger(dwStatuses, 2) === 1;
|
|
882
|
+
const networks = {};
|
|
883
|
+
const netwokIds = this.safeList(indexedNetworks, id, []);
|
|
884
|
+
for (let j = 0; j < netwokIds.length; j++) {
|
|
885
|
+
const networkId = netwokIds[j];
|
|
886
|
+
const network = this.networkIdToCode(networkId);
|
|
887
|
+
networks[network] = {
|
|
888
|
+
'info': networkId,
|
|
889
|
+
'id': networkId.toLowerCase(),
|
|
890
|
+
'network': networkId,
|
|
891
|
+
'active': undefined,
|
|
892
|
+
'deposit': undefined,
|
|
893
|
+
'withdraw': undefined,
|
|
894
|
+
'fee': undefined,
|
|
895
|
+
'precision': undefined,
|
|
896
|
+
'limits': {
|
|
897
|
+
'withdraw': {
|
|
898
|
+
'min': undefined,
|
|
899
|
+
'max': undefined,
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
result[code] = this.safeCurrencyStructure({
|
|
861
905
|
'id': fid,
|
|
862
906
|
'uppercaseId': id,
|
|
863
907
|
'code': code,
|
|
@@ -865,8 +909,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
865
909
|
'type': type,
|
|
866
910
|
'name': name,
|
|
867
911
|
'active': true,
|
|
868
|
-
'deposit':
|
|
869
|
-
'withdraw':
|
|
912
|
+
'deposit': depositEnabled,
|
|
913
|
+
'withdraw': withdrawEnabled,
|
|
870
914
|
'fee': fee,
|
|
871
915
|
'precision': parseInt(precision),
|
|
872
916
|
'limits': {
|
|
@@ -879,40 +923,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
879
923
|
'max': undefined,
|
|
880
924
|
},
|
|
881
925
|
},
|
|
882
|
-
'networks':
|
|
883
|
-
};
|
|
884
|
-
const networks = {};
|
|
885
|
-
const currencyNetworks = this.safeValue(response, 8, []);
|
|
886
|
-
const cleanId = id.replace('F0', '');
|
|
887
|
-
for (let j = 0; j < currencyNetworks.length; j++) {
|
|
888
|
-
const pair = currencyNetworks[j];
|
|
889
|
-
const networkId = this.safeString(pair, 0);
|
|
890
|
-
const currencyId = this.safeString(this.safeValue(pair, 1, []), 0);
|
|
891
|
-
if (currencyId === cleanId) {
|
|
892
|
-
const network = this.networkIdToCode(networkId);
|
|
893
|
-
networks[network] = {
|
|
894
|
-
'info': networkId,
|
|
895
|
-
'id': networkId.toLowerCase(),
|
|
896
|
-
'network': networkId,
|
|
897
|
-
'active': undefined,
|
|
898
|
-
'deposit': undefined,
|
|
899
|
-
'withdraw': undefined,
|
|
900
|
-
'fee': undefined,
|
|
901
|
-
'precision': undefined,
|
|
902
|
-
'limits': {
|
|
903
|
-
'withdraw': {
|
|
904
|
-
'min': undefined,
|
|
905
|
-
'max': undefined,
|
|
906
|
-
},
|
|
907
|
-
},
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
const keysNetworks = Object.keys(networks);
|
|
912
|
-
const networksLength = keysNetworks.length;
|
|
913
|
-
if (networksLength > 0) {
|
|
914
|
-
result[code]['networks'] = networks;
|
|
915
|
-
}
|
|
926
|
+
'networks': networks,
|
|
927
|
+
});
|
|
916
928
|
}
|
|
917
929
|
return result;
|
|
918
930
|
}
|
|
@@ -1158,9 +1170,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
1158
1170
|
//
|
|
1159
1171
|
// on trading pairs (ex. tBTCUSD)
|
|
1160
1172
|
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
// SYMBOL,
|
|
1173
|
+
// [
|
|
1174
|
+
// SYMBOL, // this index is not present in singular-ticker
|
|
1164
1175
|
// BID,
|
|
1165
1176
|
// BID_SIZE,
|
|
1166
1177
|
// ASK,
|
|
@@ -1171,15 +1182,13 @@ class bitfinex extends bitfinex$1 {
|
|
|
1171
1182
|
// VOLUME,
|
|
1172
1183
|
// HIGH,
|
|
1173
1184
|
// LOW
|
|
1174
|
-
//
|
|
1175
|
-
// }
|
|
1185
|
+
// ]
|
|
1176
1186
|
//
|
|
1177
1187
|
//
|
|
1178
1188
|
// on funding currencies (ex. fUSD)
|
|
1179
1189
|
//
|
|
1180
|
-
//
|
|
1181
|
-
//
|
|
1182
|
-
// SYMBOL,
|
|
1190
|
+
// [
|
|
1191
|
+
// SYMBOL, // this index is not present in singular-ticker
|
|
1183
1192
|
// FRR,
|
|
1184
1193
|
// BID,
|
|
1185
1194
|
// BID_PERIOD,
|
|
@@ -1196,35 +1205,75 @@ class bitfinex extends bitfinex$1 {
|
|
|
1196
1205
|
// _PLACEHOLDER,
|
|
1197
1206
|
// _PLACEHOLDER,
|
|
1198
1207
|
// FRR_AMOUNT_AVAILABLE
|
|
1199
|
-
//
|
|
1200
|
-
// }
|
|
1208
|
+
// ]
|
|
1201
1209
|
//
|
|
1202
|
-
const
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1210
|
+
const length = ticker.length;
|
|
1211
|
+
const isFetchTicker = (length === 10) || (length === 16);
|
|
1212
|
+
let symbol = undefined;
|
|
1213
|
+
let minusIndex = 0;
|
|
1214
|
+
let isFundingCurrency = false;
|
|
1215
|
+
if (isFetchTicker) {
|
|
1216
|
+
minusIndex = 1;
|
|
1217
|
+
isFundingCurrency = (length === 16);
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
const marketId = this.safeString(ticker, 0);
|
|
1221
|
+
market = this.safeMarket(marketId, market);
|
|
1222
|
+
isFundingCurrency = (length === 17);
|
|
1223
|
+
}
|
|
1224
|
+
symbol = this.safeSymbol(undefined, market);
|
|
1225
|
+
let last = undefined;
|
|
1226
|
+
let bid = undefined;
|
|
1227
|
+
let ask = undefined;
|
|
1228
|
+
let change = undefined;
|
|
1229
|
+
let percentage = undefined;
|
|
1230
|
+
let volume = undefined;
|
|
1231
|
+
let high = undefined;
|
|
1232
|
+
let low = undefined;
|
|
1233
|
+
if (isFundingCurrency) {
|
|
1234
|
+
// per api docs, they are different array type
|
|
1235
|
+
last = this.safeString(ticker, 10 - minusIndex);
|
|
1236
|
+
bid = this.safeString(ticker, 2 - minusIndex);
|
|
1237
|
+
ask = this.safeString(ticker, 5 - minusIndex);
|
|
1238
|
+
change = this.safeString(ticker, 8 - minusIndex);
|
|
1239
|
+
percentage = this.safeString(ticker, 9 - minusIndex);
|
|
1240
|
+
volume = this.safeString(ticker, 11 - minusIndex);
|
|
1241
|
+
high = this.safeString(ticker, 12 - minusIndex);
|
|
1242
|
+
low = this.safeString(ticker, 13 - minusIndex);
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
// on trading pairs (ex. tBTCUSD or tHMSTR:USD)
|
|
1246
|
+
last = this.safeString(ticker, 7 - minusIndex);
|
|
1247
|
+
bid = this.safeString(ticker, 1 - minusIndex);
|
|
1248
|
+
ask = this.safeString(ticker, 3 - minusIndex);
|
|
1249
|
+
change = this.safeString(ticker, 5 - minusIndex);
|
|
1250
|
+
percentage = this.safeString(ticker, 6 - minusIndex);
|
|
1251
|
+
percentage = Precise["default"].stringMul(percentage, '100');
|
|
1252
|
+
volume = this.safeString(ticker, 8 - minusIndex);
|
|
1253
|
+
high = this.safeString(ticker, 9 - minusIndex);
|
|
1254
|
+
low = this.safeString(ticker, 10 - minusIndex);
|
|
1255
|
+
}
|
|
1207
1256
|
return this.safeTicker({
|
|
1208
1257
|
'symbol': symbol,
|
|
1209
1258
|
'timestamp': undefined,
|
|
1210
1259
|
'datetime': undefined,
|
|
1211
|
-
'high':
|
|
1212
|
-
'low':
|
|
1213
|
-
'bid':
|
|
1214
|
-
'bidVolume':
|
|
1215
|
-
'ask':
|
|
1216
|
-
'askVolume':
|
|
1260
|
+
'high': high,
|
|
1261
|
+
'low': low,
|
|
1262
|
+
'bid': bid,
|
|
1263
|
+
'bidVolume': undefined,
|
|
1264
|
+
'ask': ask,
|
|
1265
|
+
'askVolume': undefined,
|
|
1217
1266
|
'vwap': undefined,
|
|
1218
1267
|
'open': undefined,
|
|
1219
1268
|
'close': last,
|
|
1220
1269
|
'last': last,
|
|
1221
1270
|
'previousClose': undefined,
|
|
1222
|
-
'change':
|
|
1223
|
-
'percentage':
|
|
1271
|
+
'change': change,
|
|
1272
|
+
'percentage': percentage,
|
|
1224
1273
|
'average': undefined,
|
|
1225
|
-
'baseVolume':
|
|
1274
|
+
'baseVolume': volume,
|
|
1226
1275
|
'quoteVolume': undefined,
|
|
1227
|
-
'info':
|
|
1276
|
+
'info': ticker,
|
|
1228
1277
|
}, market);
|
|
1229
1278
|
}
|
|
1230
1279
|
/**
|
|
@@ -1287,15 +1336,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
1287
1336
|
// ...
|
|
1288
1337
|
// ]
|
|
1289
1338
|
//
|
|
1290
|
-
|
|
1291
|
-
for (let i = 0; i < tickers.length; i++) {
|
|
1292
|
-
const ticker = tickers[i];
|
|
1293
|
-
const marketId = this.safeString(ticker, 0);
|
|
1294
|
-
const market = this.safeMarket(marketId);
|
|
1295
|
-
const symbol = market['symbol'];
|
|
1296
|
-
result[symbol] = this.parseTicker({ 'result': ticker }, market);
|
|
1297
|
-
}
|
|
1298
|
-
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
1339
|
+
return this.parseTickers(tickers, symbols);
|
|
1299
1340
|
}
|
|
1300
1341
|
/**
|
|
1301
1342
|
* @method
|
|
@@ -1313,8 +1354,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
1313
1354
|
'symbol': market['id'],
|
|
1314
1355
|
};
|
|
1315
1356
|
const ticker = await this.publicGetTickerSymbol(this.extend(request, params));
|
|
1316
|
-
|
|
1317
|
-
return this.parseTicker(result, market);
|
|
1357
|
+
return this.parseTicker(ticker, market);
|
|
1318
1358
|
}
|
|
1319
1359
|
parseTrade(trade, market = undefined) {
|
|
1320
1360
|
//
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1543,7 +1543,9 @@ class bitget extends bitget$1 {
|
|
|
1543
1543
|
'fetchPositions': {
|
|
1544
1544
|
'method': 'privateMixGetV2MixPositionAllPosition', // or privateMixGetV2MixPositionHistoryPosition
|
|
1545
1545
|
},
|
|
1546
|
-
'defaultTimeInForce': 'GTC',
|
|
1546
|
+
'defaultTimeInForce': 'GTC',
|
|
1547
|
+
// fiat currencies on deposit page
|
|
1548
|
+
'fiatCurrencies': ['EUR', 'VND', 'PLN', 'CZK', 'HUF', 'DKK', 'AUD', 'CAD', 'NOK', 'SEK', 'CHF', 'MXN', 'COP', 'ARS', 'GBP', 'BRL', 'UAH', 'ZAR'],
|
|
1547
1549
|
},
|
|
1548
1550
|
'features': {
|
|
1549
1551
|
'spot': {
|
|
@@ -2030,47 +2032,47 @@ class bitget extends bitget$1 {
|
|
|
2030
2032
|
async fetchCurrencies(params = {}) {
|
|
2031
2033
|
const response = await this.publicSpotGetV2SpotPublicCoins(params);
|
|
2032
2034
|
//
|
|
2033
|
-
//
|
|
2034
|
-
//
|
|
2035
|
-
//
|
|
2036
|
-
//
|
|
2037
|
-
//
|
|
2038
|
-
//
|
|
2039
|
-
//
|
|
2040
|
-
//
|
|
2041
|
-
//
|
|
2042
|
-
//
|
|
2043
|
-
//
|
|
2044
|
-
//
|
|
2045
|
-
//
|
|
2046
|
-
//
|
|
2047
|
-
//
|
|
2048
|
-
//
|
|
2049
|
-
//
|
|
2050
|
-
//
|
|
2051
|
-
//
|
|
2052
|
-
//
|
|
2053
|
-
//
|
|
2054
|
-
//
|
|
2055
|
-
//
|
|
2056
|
-
//
|
|
2057
|
-
//
|
|
2058
|
-
//
|
|
2059
|
-
//
|
|
2035
|
+
// {
|
|
2036
|
+
// "code": "00000",
|
|
2037
|
+
// "msg": "success",
|
|
2038
|
+
// "requestTime": "1746195617812",
|
|
2039
|
+
// "data": [
|
|
2040
|
+
// {
|
|
2041
|
+
// "coinId": "1456",
|
|
2042
|
+
// "coin": "NEIROETH",
|
|
2043
|
+
// "transfer": "false",
|
|
2044
|
+
// "chains": [
|
|
2045
|
+
// {
|
|
2046
|
+
// "chain": "ERC20",
|
|
2047
|
+
// "needTag": "false",
|
|
2048
|
+
// "withdrawable": "true",
|
|
2049
|
+
// "rechargeable": "true",
|
|
2050
|
+
// "withdrawFee": "44.91017965",
|
|
2051
|
+
// "extraWithdrawFee": "0",
|
|
2052
|
+
// "depositConfirm": "12",
|
|
2053
|
+
// "withdrawConfirm": "64",
|
|
2054
|
+
// "minDepositAmount": "0.06",
|
|
2055
|
+
// "minWithdrawAmount": "60",
|
|
2056
|
+
// "browserUrl": "https://etherscan.io/tx/",
|
|
2057
|
+
// "contractAddress": "0xee2a03aa6dacf51c18679c516ad5283d8e7c2637",
|
|
2058
|
+
// "withdrawStep": "0",
|
|
2059
|
+
// "withdrawMinScale": "8",
|
|
2060
|
+
// "congestion": "normal"
|
|
2061
|
+
// }
|
|
2062
|
+
// ],
|
|
2063
|
+
// "areaCoin": "no"
|
|
2064
|
+
// },
|
|
2065
|
+
// ...
|
|
2060
2066
|
//
|
|
2061
2067
|
const result = {};
|
|
2062
2068
|
const data = this.safeValue(response, 'data', []);
|
|
2069
|
+
const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
|
|
2063
2070
|
for (let i = 0; i < data.length; i++) {
|
|
2064
2071
|
const entry = data[i];
|
|
2065
2072
|
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..)
|
|
2066
2073
|
const code = this.safeCurrencyCode(id);
|
|
2067
2074
|
const chains = this.safeValue(entry, 'chains', []);
|
|
2068
2075
|
const networks = {};
|
|
2069
|
-
let deposit = false;
|
|
2070
|
-
let withdraw = false;
|
|
2071
|
-
let minWithdrawString = undefined;
|
|
2072
|
-
let minDepositString = undefined;
|
|
2073
|
-
let minWithdrawFeeString = undefined;
|
|
2074
2076
|
for (let j = 0; j < chains.length; j++) {
|
|
2075
2077
|
const chain = chains[j];
|
|
2076
2078
|
const networkId = this.safeString(chain, 'chain');
|
|
@@ -2078,56 +2080,39 @@ class bitget extends bitget$1 {
|
|
|
2078
2080
|
if (network !== undefined) {
|
|
2079
2081
|
network = network.toUpperCase();
|
|
2080
2082
|
}
|
|
2081
|
-
const withdrawEnabled = this.safeString(chain, 'withdrawable');
|
|
2082
|
-
const canWithdraw = withdrawEnabled === 'true';
|
|
2083
|
-
withdraw = (canWithdraw) ? canWithdraw : withdraw;
|
|
2084
|
-
const depositEnabled = this.safeString(chain, 'rechargeable');
|
|
2085
|
-
const canDeposit = depositEnabled === 'true';
|
|
2086
|
-
deposit = (canDeposit) ? canDeposit : deposit;
|
|
2087
|
-
const networkWithdrawFeeString = this.safeString(chain, 'withdrawFee');
|
|
2088
|
-
if (networkWithdrawFeeString !== undefined) {
|
|
2089
|
-
minWithdrawFeeString = (minWithdrawFeeString === undefined) ? networkWithdrawFeeString : Precise["default"].stringMin(networkWithdrawFeeString, minWithdrawFeeString);
|
|
2090
|
-
}
|
|
2091
|
-
const networkMinWithdrawString = this.safeString(chain, 'minWithdrawAmount');
|
|
2092
|
-
if (networkMinWithdrawString !== undefined) {
|
|
2093
|
-
minWithdrawString = (minWithdrawString === undefined) ? networkMinWithdrawString : Precise["default"].stringMin(networkMinWithdrawString, minWithdrawString);
|
|
2094
|
-
}
|
|
2095
|
-
const networkMinDepositString = this.safeString(chain, 'minDepositAmount');
|
|
2096
|
-
if (networkMinDepositString !== undefined) {
|
|
2097
|
-
minDepositString = (minDepositString === undefined) ? networkMinDepositString : Precise["default"].stringMin(networkMinDepositString, minDepositString);
|
|
2098
|
-
}
|
|
2099
2083
|
networks[network] = {
|
|
2100
2084
|
'info': chain,
|
|
2101
2085
|
'id': networkId,
|
|
2102
2086
|
'network': network,
|
|
2103
2087
|
'limits': {
|
|
2104
2088
|
'withdraw': {
|
|
2105
|
-
'min': this.
|
|
2089
|
+
'min': this.safeNumber(chain, 'minWithdrawAmount'),
|
|
2106
2090
|
'max': undefined,
|
|
2107
2091
|
},
|
|
2108
2092
|
'deposit': {
|
|
2109
|
-
'min': this.
|
|
2093
|
+
'min': this.safeNumber(chain, 'minDepositAmount'),
|
|
2110
2094
|
'max': undefined,
|
|
2111
2095
|
},
|
|
2112
2096
|
},
|
|
2113
|
-
'active':
|
|
2114
|
-
'withdraw':
|
|
2115
|
-
'deposit':
|
|
2116
|
-
'fee': this.
|
|
2117
|
-
'precision':
|
|
2097
|
+
'active': undefined,
|
|
2098
|
+
'withdraw': this.safeString(chain, 'withdrawable') === 'true',
|
|
2099
|
+
'deposit': this.safeString(chain, 'rechargeable') === 'true',
|
|
2100
|
+
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
2101
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawMinScale'))),
|
|
2118
2102
|
};
|
|
2119
2103
|
}
|
|
2120
|
-
|
|
2104
|
+
const isFiat = this.inArray(code, fiatCurrencies);
|
|
2105
|
+
result[code] = this.safeCurrencyStructure({
|
|
2121
2106
|
'info': entry,
|
|
2122
2107
|
'id': id,
|
|
2123
2108
|
'code': code,
|
|
2124
2109
|
'networks': networks,
|
|
2125
|
-
'type':
|
|
2110
|
+
'type': isFiat ? 'fiat' : 'crypto',
|
|
2126
2111
|
'name': undefined,
|
|
2127
|
-
'active':
|
|
2128
|
-
'deposit':
|
|
2129
|
-
'withdraw':
|
|
2130
|
-
'fee':
|
|
2112
|
+
'active': undefined,
|
|
2113
|
+
'deposit': undefined,
|
|
2114
|
+
'withdraw': undefined,
|
|
2115
|
+
'fee': undefined,
|
|
2131
2116
|
'precision': undefined,
|
|
2132
2117
|
'limits': {
|
|
2133
2118
|
'amount': {
|
|
@@ -2135,16 +2120,16 @@ class bitget extends bitget$1 {
|
|
|
2135
2120
|
'max': undefined,
|
|
2136
2121
|
},
|
|
2137
2122
|
'withdraw': {
|
|
2138
|
-
'min':
|
|
2123
|
+
'min': undefined,
|
|
2139
2124
|
'max': undefined,
|
|
2140
2125
|
},
|
|
2141
2126
|
'deposit': {
|
|
2142
|
-
'min':
|
|
2127
|
+
'min': undefined,
|
|
2143
2128
|
'max': undefined,
|
|
2144
2129
|
},
|
|
2145
2130
|
},
|
|
2146
2131
|
'created': undefined,
|
|
2147
|
-
};
|
|
2132
|
+
});
|
|
2148
2133
|
}
|
|
2149
2134
|
return result;
|
|
2150
2135
|
}
|
|
@@ -2789,7 +2774,7 @@ class bitget extends bitget$1 {
|
|
|
2789
2774
|
const close = this.safeString(ticker, 'lastPr');
|
|
2790
2775
|
const timestamp = this.safeIntegerOmitZero(ticker, 'ts'); // exchange bitget provided 0
|
|
2791
2776
|
const change = this.safeString(ticker, 'change24h');
|
|
2792
|
-
const open24 = this.
|
|
2777
|
+
const open24 = this.safeString2(ticker, 'open24', 'open24h');
|
|
2793
2778
|
const open = this.safeString(ticker, 'open');
|
|
2794
2779
|
let symbol;
|
|
2795
2780
|
let openValue;
|
|
@@ -3489,6 +3474,7 @@ class bitget extends bitget$1 {
|
|
|
3489
3474
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3490
3475
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
3491
3476
|
* @param {boolean} [params.useHistoryEndpoint] whether to force to use historical endpoint (it has max limit of 200)
|
|
3477
|
+
* @param {boolean} [params.useHistoryEndpointForPagination] whether to force to use historical endpoint for pagination (default true)
|
|
3492
3478
|
* @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)
|
|
3493
3479
|
* @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
|
|
3494
3480
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
@@ -3498,12 +3484,14 @@ class bitget extends bitget$1 {
|
|
|
3498
3484
|
const defaultLimit = 100; // default 100, max 1000
|
|
3499
3485
|
const maxLimitForRecentEndpoint = 1000;
|
|
3500
3486
|
const maxLimitForHistoryEndpoint = 200; // note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
|
|
3487
|
+
const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
|
|
3488
|
+
const useHistoryEndpointForPagination = this.safeBool(params, 'useHistoryEndpointForPagination', true);
|
|
3501
3489
|
let paginate = false;
|
|
3502
3490
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
3503
3491
|
if (paginate) {
|
|
3504
|
-
|
|
3492
|
+
const limitForPagination = useHistoryEndpointForPagination ? maxLimitForHistoryEndpoint : maxLimitForRecentEndpoint;
|
|
3493
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, limitForPagination);
|
|
3505
3494
|
}
|
|
3506
|
-
const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
|
|
3507
3495
|
const market = this.market(symbol);
|
|
3508
3496
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3509
3497
|
const timeframes = this.options['timeframes'][marketType];
|
|
@@ -4152,7 +4140,8 @@ class bitget extends bitget$1 {
|
|
|
4152
4140
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
4153
4141
|
const timestamp = this.safeInteger2(order, 'cTime', 'ctime');
|
|
4154
4142
|
const updateTimestamp = this.safeInteger(order, 'uTime');
|
|
4155
|
-
|
|
4143
|
+
let rawStatus = this.safeString2(order, 'status', 'state');
|
|
4144
|
+
rawStatus = this.safeString(order, 'planStatus', rawStatus);
|
|
4156
4145
|
let fee = undefined;
|
|
4157
4146
|
const feeCostString = this.safeString(order, 'fee');
|
|
4158
4147
|
if (feeCostString !== undefined) {
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -206,6 +206,7 @@ class bitmart extends bitmart$1 {
|
|
|
206
206
|
'contract/private/order': 1.2,
|
|
207
207
|
'contract/private/order-history': 10,
|
|
208
208
|
'contract/private/position': 10,
|
|
209
|
+
'contract/private/position-v2': 10,
|
|
209
210
|
'contract/private/get-open-orders': 1.2,
|
|
210
211
|
'contract/private/current-plan-order': 1.2,
|
|
211
212
|
'contract/private/trades': 10,
|
|
@@ -1203,6 +1204,7 @@ class bitmart extends bitmart$1 {
|
|
|
1203
1204
|
// {
|
|
1204
1205
|
// "currency": "BTC",
|
|
1205
1206
|
// "name": "Bitcoin",
|
|
1207
|
+
// "recharge_minsize": '0.00000001',
|
|
1206
1208
|
// "contract_address": null,
|
|
1207
1209
|
// "network": "BTC",
|
|
1208
1210
|
// "withdraw_enabled": true,
|
|
@@ -1224,7 +1226,8 @@ class bitmart extends bitmart$1 {
|
|
|
1224
1226
|
const fullId = this.safeString(currency, 'currency');
|
|
1225
1227
|
let currencyId = fullId;
|
|
1226
1228
|
let networkId = this.safeString(currency, 'network');
|
|
1227
|
-
|
|
1229
|
+
const isNtf = (fullId.indexOf('NFT') >= 0);
|
|
1230
|
+
if (!isNtf) {
|
|
1228
1231
|
const parts = fullId.split('-');
|
|
1229
1232
|
currencyId = this.safeString(parts, 0);
|
|
1230
1233
|
const second = this.safeString(parts, 1);
|
|
@@ -1245,6 +1248,7 @@ class bitmart extends bitmart$1 {
|
|
|
1245
1248
|
'withdraw': undefined,
|
|
1246
1249
|
'active': undefined,
|
|
1247
1250
|
'networks': {},
|
|
1251
|
+
'type': isNtf ? 'other' : 'crypto',
|
|
1248
1252
|
};
|
|
1249
1253
|
}
|
|
1250
1254
|
const networkCode = this.networkIdToCode(networkId);
|
|
@@ -4896,6 +4900,7 @@ class bitmart extends bitmart$1 {
|
|
|
4896
4900
|
* @name bitmart#fetchPositions
|
|
4897
4901
|
* @description fetch all open contract positions
|
|
4898
4902
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
|
4903
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed
|
|
4899
4904
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
4900
4905
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4901
4906
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4914,7 +4919,7 @@ class bitmart extends bitmart$1 {
|
|
|
4914
4919
|
// only supports symbols as undefined or sending one symbol
|
|
4915
4920
|
request['symbol'] = market['id'];
|
|
4916
4921
|
}
|
|
4917
|
-
const response = await this.
|
|
4922
|
+
const response = await this.privateGetContractPrivatePositionV2(this.extend(request, params));
|
|
4918
4923
|
//
|
|
4919
4924
|
// {
|
|
4920
4925
|
// "code": 1000,
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -495,6 +495,7 @@ class bitmex extends bitmex$1 {
|
|
|
495
495
|
const maxWithdrawal = this.parseNumber(Precise["default"].stringMul(maxWithdrawalString, precisionString));
|
|
496
496
|
const minDepositString = this.safeString(currency, 'minDepositAmount');
|
|
497
497
|
const minDeposit = this.parseNumber(Precise["default"].stringMul(minDepositString, precisionString));
|
|
498
|
+
const isCrypto = this.safeString(currency, 'currencyType') === 'Crypto';
|
|
498
499
|
result[code] = {
|
|
499
500
|
'id': id,
|
|
500
501
|
'code': code,
|
|
@@ -520,6 +521,7 @@ class bitmex extends bitmex$1 {
|
|
|
520
521
|
},
|
|
521
522
|
},
|
|
522
523
|
'networks': networks,
|
|
524
|
+
'type': isCrypto ? 'crypto' : 'other',
|
|
523
525
|
};
|
|
524
526
|
}
|
|
525
527
|
return result;
|
|
@@ -728,9 +730,9 @@ class bitmex extends bitmex$1 {
|
|
|
728
730
|
const quote = this.safeCurrencyCode(quoteId);
|
|
729
731
|
const contract = swap || future;
|
|
730
732
|
let contractSize = undefined;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
let isInverse = this.safeValue(market, 'isInverse'); // this is true when BASE and SETTLE are same, i.e. BTC/XXX:BTC
|
|
734
|
+
let isQuanto = this.safeValue(market, 'isQuanto'); // this is true when BASE and SETTLE are different, i.e. AXS/XXX:BTC
|
|
735
|
+
let linear = contract ? (!isInverse && !isQuanto) : undefined;
|
|
734
736
|
const status = this.safeString(market, 'state');
|
|
735
737
|
const active = status === 'Open'; // Open, Settled, Unlisted
|
|
736
738
|
let expiry = undefined;
|
|
@@ -765,6 +767,12 @@ class bitmex extends bitmex$1 {
|
|
|
765
767
|
const maxOrderQty = this.safeNumber(market, 'maxOrderQty');
|
|
766
768
|
const initMargin = this.safeString(market, 'initMargin', '1');
|
|
767
769
|
const maxLeverage = this.parseNumber(Precise["default"].stringDiv('1', initMargin));
|
|
770
|
+
// subtype should be undefined for spot markets
|
|
771
|
+
if (spot) {
|
|
772
|
+
isInverse = undefined;
|
|
773
|
+
isQuanto = undefined;
|
|
774
|
+
linear = undefined;
|
|
775
|
+
}
|
|
768
776
|
return {
|
|
769
777
|
'id': id,
|
|
770
778
|
'symbol': symbol,
|
|
@@ -814,7 +822,7 @@ class bitmex extends bitmex$1 {
|
|
|
814
822
|
'max': positionIsQuote ? maxOrderQty : undefined,
|
|
815
823
|
},
|
|
816
824
|
},
|
|
817
|
-
'created':
|
|
825
|
+
'created': undefined,
|
|
818
826
|
'info': market,
|
|
819
827
|
};
|
|
820
828
|
}
|