ccxt 4.4.85 → 4.4.87
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 +18 -7
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +16 -9
- package/dist/cjs/src/abstract/bittrade.js +9 -0
- package/dist/cjs/src/abstract/modetrade.js +9 -0
- package/dist/cjs/src/ascendex.js +189 -155
- package/dist/cjs/src/base/Exchange.js +10 -8
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitget.js +5 -4
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitteam.js +31 -0
- package/dist/cjs/src/bittrade.js +2049 -0
- package/dist/cjs/src/coinbase.js +2 -6
- package/dist/cjs/src/coinmetro.js +5 -1
- package/dist/cjs/src/deribit.js +4 -5
- package/dist/cjs/src/derive.js +4 -5
- package/dist/cjs/src/ellipx.js +2 -3
- package/dist/cjs/src/gate.js +92 -76
- package/dist/cjs/src/hollaex.js +107 -49
- package/dist/cjs/src/htx.js +30 -52
- package/dist/cjs/src/hyperliquid.js +36 -20
- package/dist/cjs/src/kraken.js +5 -8
- package/dist/cjs/src/mexc.js +2 -2
- package/dist/cjs/src/modetrade.js +2839 -0
- package/dist/cjs/src/ndax.js +25 -24
- package/dist/cjs/src/okcoin.js +12 -31
- package/dist/cjs/src/okx.js +104 -2
- package/dist/cjs/src/okxus.js +53 -0
- package/dist/cjs/src/onetrading.js +9 -6
- package/dist/cjs/src/oxfun.js +42 -114
- package/dist/cjs/src/paradex.js +10 -1
- package/dist/cjs/src/phemex.js +4 -6
- package/dist/cjs/src/poloniex.js +181 -170
- package/dist/cjs/src/pro/binance.js +1 -0
- package/dist/cjs/src/pro/bittrade.js +605 -0
- package/dist/cjs/src/pro/luno.js +6 -5
- package/dist/cjs/src/pro/mexc.js +3 -0
- package/dist/cjs/src/pro/modetrade.js +1334 -0
- package/dist/cjs/src/pro/okxus.js +38 -0
- package/dist/cjs/src/probit.js +18 -51
- package/dist/cjs/src/timex.js +5 -10
- package/dist/cjs/src/vertex.js +3 -4
- package/dist/cjs/src/whitebit.js +41 -11
- package/dist/cjs/src/woo.js +101 -77
- package/dist/cjs/src/woofipro.js +24 -21
- package/dist/cjs/src/xt.js +36 -44
- package/js/ccxt.d.ts +20 -11
- package/js/ccxt.js +14 -8
- package/js/src/abstract/modetrade.d.ts +122 -0
- package/js/src/abstract/myokx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/abstract/okxus.d.ts +352 -0
- package/js/src/abstract/okxus.js +11 -0
- package/js/src/ascendex.d.ts +2 -0
- package/js/src/ascendex.js +189 -155
- package/js/src/base/Exchange.js +10 -8
- package/js/src/bequant.js +1 -1
- package/js/src/binance.js +1 -1
- package/js/src/bitget.js +5 -4
- package/js/src/bitmart.js +1 -1
- package/js/src/bitteam.js +31 -0
- package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
- package/js/src/{huobijp.js → bittrade.js} +35 -35
- package/js/src/coinbase.js +2 -6
- package/js/src/coinmetro.js +5 -1
- package/js/src/deribit.js +4 -5
- package/js/src/derive.js +4 -3
- package/js/src/ellipx.d.ts +1 -1
- package/js/src/ellipx.js +3 -5
- package/js/src/gate.js +92 -76
- package/js/src/hollaex.js +107 -49
- package/js/src/htx.js +30 -52
- package/js/src/hyperliquid.js +36 -20
- package/js/src/kraken.js +5 -8
- package/js/src/mexc.js +2 -2
- package/js/src/modetrade.d.ts +475 -0
- package/js/src/modetrade.js +2840 -0
- package/js/src/ndax.js +25 -24
- package/js/src/okcoin.js +12 -31
- package/js/src/okx.d.ts +24 -1
- package/js/src/okx.js +104 -2
- package/js/src/okxus.d.ts +4 -0
- package/js/src/okxus.js +54 -0
- package/js/src/onetrading.js +9 -6
- package/js/src/oxfun.js +42 -114
- package/js/src/paradex.js +10 -1
- package/js/src/phemex.js +4 -6
- package/js/src/poloniex.d.ts +2 -0
- package/js/src/poloniex.js +181 -170
- package/js/src/pro/binance.js +1 -0
- package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
- package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
- package/js/src/pro/luno.js +6 -5
- package/js/src/pro/mexc.js +3 -0
- package/js/src/pro/modetrade.d.ts +155 -0
- package/js/src/pro/modetrade.js +1335 -0
- package/js/src/pro/okxus.d.ts +4 -0
- package/js/src/pro/okxus.js +39 -0
- package/js/src/probit.js +18 -51
- package/js/src/timex.js +5 -10
- package/js/src/vertex.js +3 -4
- package/js/src/whitebit.js +42 -11
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +101 -77
- package/js/src/woofipro.d.ts +2 -1
- package/js/src/woofipro.js +24 -21
- package/js/src/xt.js +36 -44
- package/package.json +1 -1
- package/js/src/abstract/kuna.d.ts +0 -185
- package/js/src/kuna.d.ts +0 -335
- package/js/src/kuna.js +0 -2006
- /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
- /package/js/src/abstract/{huobijp.js → bittrade.js} +0 -0
- /package/js/src/abstract/{kuna.js → modetrade.js} +0 -0
package/js/src/poloniex.js
CHANGED
|
@@ -309,6 +309,11 @@ export default class poloniex extends Exchange {
|
|
|
309
309
|
'BEP20': 'BSC',
|
|
310
310
|
'ERC20': 'ETH',
|
|
311
311
|
'TRC20': 'TRON',
|
|
312
|
+
'TRX': 'TRON',
|
|
313
|
+
},
|
|
314
|
+
'networksById': {
|
|
315
|
+
'TRX': 'TRC20',
|
|
316
|
+
'TRON': 'TRC20',
|
|
312
317
|
},
|
|
313
318
|
'limits': {
|
|
314
319
|
'cost': {
|
|
@@ -1151,105 +1156,107 @@ export default class poloniex extends Exchange {
|
|
|
1151
1156
|
const response = await this.publicGetCurrencies(this.extend(params, { 'includeMultiChainCurrencies': true }));
|
|
1152
1157
|
//
|
|
1153
1158
|
// [
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
//
|
|
1172
|
-
//
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1159
|
+
// {
|
|
1160
|
+
// "USDT": {
|
|
1161
|
+
// "id": 214,
|
|
1162
|
+
// "name": "Tether USD",
|
|
1163
|
+
// "description": "Sweep to Main Account",
|
|
1164
|
+
// "type": "address",
|
|
1165
|
+
// "withdrawalFee": "0.00000000",
|
|
1166
|
+
// "minConf": 2,
|
|
1167
|
+
// "depositAddress": null,
|
|
1168
|
+
// "blockchain": "OMNI",
|
|
1169
|
+
// "delisted": false,
|
|
1170
|
+
// "tradingState": "NORMAL",
|
|
1171
|
+
// "walletState": "DISABLED",
|
|
1172
|
+
// "walletDepositState": "DISABLED",
|
|
1173
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1174
|
+
// "supportCollateral": true,
|
|
1175
|
+
// "supportBorrow": true,
|
|
1176
|
+
// "parentChain": null,
|
|
1177
|
+
// "isMultiChain": true,
|
|
1178
|
+
// "isChildChain": false,
|
|
1179
|
+
// "childChains": [
|
|
1180
|
+
// "USDTBSC",
|
|
1181
|
+
// "USDTETH",
|
|
1182
|
+
// "USDTSOL",
|
|
1183
|
+
// "USDTTRON"
|
|
1184
|
+
// ]
|
|
1185
|
+
// }
|
|
1186
|
+
// },
|
|
1187
|
+
// ...
|
|
1188
|
+
// {
|
|
1189
|
+
// "USDTBSC": {
|
|
1190
|
+
// "id": 582,
|
|
1191
|
+
// "name": "Binance-Peg BSC-USD",
|
|
1192
|
+
// "description": "Sweep to Main Account",
|
|
1193
|
+
// "type": "address",
|
|
1194
|
+
// "withdrawalFee": "0.00000000",
|
|
1195
|
+
// "minConf": 15,
|
|
1196
|
+
// "depositAddress": null,
|
|
1197
|
+
// "blockchain": "BSC",
|
|
1198
|
+
// "delisted": false,
|
|
1199
|
+
// "tradingState": "OFFLINE",
|
|
1200
|
+
// "walletState": "ENABLED",
|
|
1201
|
+
// "walletDepositState": "ENABLED",
|
|
1202
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1203
|
+
// "supportCollateral": false,
|
|
1204
|
+
// "supportBorrow": false,
|
|
1205
|
+
// "parentChain": "USDT",
|
|
1206
|
+
// "isMultiChain": true,
|
|
1207
|
+
// "isChildChain": true,
|
|
1208
|
+
// "childChains": []
|
|
1209
|
+
// }
|
|
1210
|
+
// },
|
|
1211
|
+
// ...
|
|
1175
1212
|
// ]
|
|
1176
1213
|
//
|
|
1177
1214
|
const result = {};
|
|
1215
|
+
// poloniex has a complicated structure of currencies, so we handle them differently
|
|
1216
|
+
// at first, turn the response into a normal dictionary
|
|
1217
|
+
const currenciesDict = {};
|
|
1178
1218
|
for (let i = 0; i < response.length; i++) {
|
|
1179
|
-
const item = this.
|
|
1219
|
+
const item = this.safeDict(response, i);
|
|
1180
1220
|
const ids = Object.keys(item);
|
|
1181
|
-
const id = this.
|
|
1182
|
-
|
|
1221
|
+
const id = this.safeString(ids, 0);
|
|
1222
|
+
currenciesDict[id] = item[id];
|
|
1223
|
+
}
|
|
1224
|
+
const keys = Object.keys(currenciesDict);
|
|
1225
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1226
|
+
const id = keys[i];
|
|
1227
|
+
const entry = currenciesDict[id];
|
|
1183
1228
|
const code = this.safeCurrencyCode(id);
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
if (networkId !== undefined) {
|
|
1188
|
-
networkCode = this.networkIdToCode(networkId, code);
|
|
1189
|
-
}
|
|
1190
|
-
const delisted = this.safeValue(currency, 'delisted');
|
|
1191
|
-
const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
|
|
1192
|
-
const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
|
|
1193
|
-
const withdrawEnabled = this.safeString(currency, 'walletWithdrawalState') === 'ENABLED';
|
|
1194
|
-
const active = !delisted && walletEnabled && depositEnabled && withdrawEnabled;
|
|
1195
|
-
const numericId = this.safeInteger(currency, 'id');
|
|
1196
|
-
const feeString = this.safeString(currency, 'withdrawalFee');
|
|
1197
|
-
const parentChain = this.safeValue(currency, 'parentChain');
|
|
1198
|
-
const noParentChain = parentChain === undefined;
|
|
1199
|
-
if (this.safeValue(result, code) === undefined) {
|
|
1200
|
-
result[code] = {
|
|
1201
|
-
'id': id,
|
|
1202
|
-
'code': code,
|
|
1203
|
-
'info': undefined,
|
|
1204
|
-
'name': name,
|
|
1205
|
-
'active': active,
|
|
1206
|
-
'deposit': depositEnabled,
|
|
1207
|
-
'withdraw': withdrawEnabled,
|
|
1208
|
-
'fee': this.parseNumber(feeString),
|
|
1209
|
-
'precision': undefined,
|
|
1210
|
-
'type': 'crypto',
|
|
1211
|
-
'limits': {
|
|
1212
|
-
'amount': {
|
|
1213
|
-
'min': undefined,
|
|
1214
|
-
'max': undefined,
|
|
1215
|
-
},
|
|
1216
|
-
'deposit': {
|
|
1217
|
-
'min': undefined,
|
|
1218
|
-
'max': undefined,
|
|
1219
|
-
},
|
|
1220
|
-
'withdraw': {
|
|
1221
|
-
'min': undefined,
|
|
1222
|
-
'max': undefined,
|
|
1223
|
-
},
|
|
1224
|
-
},
|
|
1225
|
-
};
|
|
1229
|
+
// skip childChains, as they are collected in parentChain loop
|
|
1230
|
+
if (this.safeBool(entry, 'isChildChain')) {
|
|
1231
|
+
continue;
|
|
1226
1232
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1233
|
+
const allChainEntries = [];
|
|
1234
|
+
const childChains = this.safeList(entry, 'childChains', []);
|
|
1235
|
+
if (childChains !== undefined) {
|
|
1236
|
+
for (let j = 0; j < childChains.length; j++) {
|
|
1237
|
+
const childChainId = childChains[j];
|
|
1238
|
+
const childNetworkEntry = this.safeDict(currenciesDict, childChainId);
|
|
1239
|
+
allChainEntries.push(childNetworkEntry);
|
|
1240
|
+
}
|
|
1230
1241
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1242
|
+
allChainEntries.push(entry);
|
|
1243
|
+
const networks = {};
|
|
1244
|
+
for (let j = 0; j < allChainEntries.length; j++) {
|
|
1245
|
+
const chainEntry = allChainEntries[j];
|
|
1246
|
+
const networkName = this.safeString(chainEntry, 'blockchain');
|
|
1247
|
+
const networkCode = this.networkIdToCode(networkName, code);
|
|
1248
|
+
const specialNetworkId = this.safeString(childChains, j, id); // in case it's primary chain, defeault to ID
|
|
1237
1249
|
networks[networkCode] = {
|
|
1238
|
-
'info':
|
|
1239
|
-
'id':
|
|
1250
|
+
'info': chainEntry,
|
|
1251
|
+
'id': specialNetworkId,
|
|
1252
|
+
'numericId': this.safeInteger(chainEntry, 'id'),
|
|
1240
1253
|
'network': networkCode,
|
|
1241
|
-
'
|
|
1242
|
-
'
|
|
1243
|
-
'
|
|
1244
|
-
'
|
|
1245
|
-
'active': active,
|
|
1246
|
-
'fee': this.parseNumber(feeString),
|
|
1254
|
+
'active': this.safeBool(chainEntry, 'walletState'),
|
|
1255
|
+
'deposit': this.safeString(chainEntry, 'walletDepositState') === 'ENABLED',
|
|
1256
|
+
'withdraw': this.safeString(chainEntry, 'walletWithdrawalState') === 'ENABLED',
|
|
1257
|
+
'fee': this.safeNumber(chainEntry, 'withdrawalFee'),
|
|
1247
1258
|
'precision': undefined,
|
|
1248
1259
|
'limits': {
|
|
1249
|
-
'amount': {
|
|
1250
|
-
'min': undefined,
|
|
1251
|
-
'max': undefined,
|
|
1252
|
-
},
|
|
1253
1260
|
'withdraw': {
|
|
1254
1261
|
'min': undefined,
|
|
1255
1262
|
'max': undefined,
|
|
@@ -1261,20 +1268,34 @@ export default class poloniex extends Exchange {
|
|
|
1261
1268
|
},
|
|
1262
1269
|
};
|
|
1263
1270
|
}
|
|
1264
|
-
result[code]
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1271
|
+
result[code] = this.safeCurrencyStructure({
|
|
1272
|
+
'info': entry,
|
|
1273
|
+
'code': code,
|
|
1274
|
+
'id': id,
|
|
1275
|
+
'numericId': this.safeInteger(entry, 'id'),
|
|
1276
|
+
'type': 'crypto',
|
|
1277
|
+
'name': this.safeString(entry, 'name'),
|
|
1278
|
+
'active': undefined,
|
|
1279
|
+
'deposit': undefined,
|
|
1280
|
+
'withdraw': undefined,
|
|
1281
|
+
'fee': undefined,
|
|
1282
|
+
'precision': undefined,
|
|
1283
|
+
'limits': {
|
|
1284
|
+
'amount': {
|
|
1285
|
+
'min': undefined,
|
|
1286
|
+
'max': undefined,
|
|
1287
|
+
},
|
|
1288
|
+
'withdraw': {
|
|
1289
|
+
'min': undefined,
|
|
1290
|
+
'max': undefined,
|
|
1291
|
+
},
|
|
1292
|
+
'deposit': {
|
|
1293
|
+
'min': undefined,
|
|
1294
|
+
'max': undefined,
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
1297
|
+
'networks': networks,
|
|
1298
|
+
});
|
|
1278
1299
|
}
|
|
1279
1300
|
return result;
|
|
1280
1301
|
}
|
|
@@ -2669,45 +2690,15 @@ export default class poloniex extends Exchange {
|
|
|
2669
2690
|
*/
|
|
2670
2691
|
async createDepositAddress(code, params = {}) {
|
|
2671
2692
|
await this.loadMarkets();
|
|
2672
|
-
const currency = this.
|
|
2673
|
-
|
|
2674
|
-
'currency': currency['id'],
|
|
2675
|
-
};
|
|
2676
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2677
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2678
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2679
|
-
if (network !== undefined) {
|
|
2680
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2681
|
-
params = this.omit(params, 'network');
|
|
2682
|
-
}
|
|
2683
|
-
else {
|
|
2684
|
-
if (currency['id'] === 'USDT') {
|
|
2685
|
-
throw new ArgumentsRequired(this.id + ' createDepositAddress requires a network parameter for ' + code + '.');
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2693
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2694
|
+
params = extraParams;
|
|
2688
2695
|
const response = await this.privatePostWalletsAddress(this.extend(request, params));
|
|
2689
2696
|
//
|
|
2690
2697
|
// {
|
|
2691
2698
|
// "address" : "0xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf"
|
|
2692
2699
|
// }
|
|
2693
2700
|
//
|
|
2694
|
-
|
|
2695
|
-
let tag = undefined;
|
|
2696
|
-
this.checkAddress(address);
|
|
2697
|
-
if (currency !== undefined) {
|
|
2698
|
-
const depositAddress = this.safeString(currency['info'], 'depositAddress');
|
|
2699
|
-
if (depositAddress !== undefined) {
|
|
2700
|
-
tag = address;
|
|
2701
|
-
address = depositAddress;
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2704
|
-
return {
|
|
2705
|
-
'currency': code,
|
|
2706
|
-
'address': address,
|
|
2707
|
-
'tag': tag,
|
|
2708
|
-
'network': network,
|
|
2709
|
-
'info': response,
|
|
2710
|
-
};
|
|
2701
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2711
2702
|
}
|
|
2712
2703
|
/**
|
|
2713
2704
|
* @method
|
|
@@ -2720,33 +2711,55 @@ export default class poloniex extends Exchange {
|
|
|
2720
2711
|
*/
|
|
2721
2712
|
async fetchDepositAddress(code, params = {}) {
|
|
2722
2713
|
await this.loadMarkets();
|
|
2723
|
-
const currency = this.
|
|
2724
|
-
|
|
2725
|
-
'currency': currency['id'],
|
|
2726
|
-
};
|
|
2727
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2728
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2729
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2730
|
-
if (network !== undefined) {
|
|
2731
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2732
|
-
params = this.omit(params, 'network');
|
|
2733
|
-
}
|
|
2734
|
-
else {
|
|
2735
|
-
if (currency['id'] === 'USDT') {
|
|
2736
|
-
throw new ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2714
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2715
|
+
params = extraParams;
|
|
2739
2716
|
const response = await this.privateGetWalletsAddresses(this.extend(request, params));
|
|
2740
2717
|
//
|
|
2741
2718
|
// {
|
|
2742
2719
|
// "USDTTRON" : "Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxp"
|
|
2743
2720
|
// }
|
|
2744
2721
|
//
|
|
2745
|
-
|
|
2722
|
+
const keys = Object.keys(response);
|
|
2723
|
+
const length = keys.length;
|
|
2724
|
+
if (length < 1) {
|
|
2725
|
+
throw new ExchangeError(this.id + ' fetchDepositAddress() returned an empty response, you might need to try "createDepositAddress" at first and then use "fetchDepositAddress"');
|
|
2726
|
+
}
|
|
2727
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2728
|
+
}
|
|
2729
|
+
prepareRequestForDepositAddress(code, params = {}) {
|
|
2730
|
+
if (!(code in this.currencies)) {
|
|
2731
|
+
throw new BadSymbol(this.id + ' fetchDepositAddress(): can not recognize ' + code + ' currency, you might try using unified currency-code and add provide specific "network" parameter, like: fetchDepositAddress("USDT", { "network": "TRC20" })');
|
|
2732
|
+
}
|
|
2733
|
+
const currency = this.currency(code);
|
|
2734
|
+
let networkCode = undefined;
|
|
2735
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
2736
|
+
if (networkCode === undefined) {
|
|
2737
|
+
// we need to know the network to find out the currency-junction
|
|
2738
|
+
throw new ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2739
|
+
}
|
|
2740
|
+
let exchangeNetworkId = undefined;
|
|
2741
|
+
networkCode = this.networkIdToCode(networkCode, code);
|
|
2742
|
+
const networkEntry = this.safeDict(currency['networks'], networkCode);
|
|
2743
|
+
if (networkEntry !== undefined) {
|
|
2744
|
+
exchangeNetworkId = networkEntry['id'];
|
|
2745
|
+
}
|
|
2746
|
+
else {
|
|
2747
|
+
exchangeNetworkId = networkCode;
|
|
2748
|
+
}
|
|
2749
|
+
const request = {
|
|
2750
|
+
'currency': exchangeNetworkId,
|
|
2751
|
+
};
|
|
2752
|
+
return [request, params, currency, networkEntry];
|
|
2753
|
+
}
|
|
2754
|
+
parseDepositAddressSpecial(response, currency, networkEntry) {
|
|
2755
|
+
let address = this.safeString(response, 'address');
|
|
2756
|
+
if (address === undefined) {
|
|
2757
|
+
address = this.safeString(response, networkEntry['id']);
|
|
2758
|
+
}
|
|
2746
2759
|
let tag = undefined;
|
|
2747
2760
|
this.checkAddress(address);
|
|
2748
|
-
if (
|
|
2749
|
-
const depositAddress = this.safeString(
|
|
2761
|
+
if (networkEntry !== undefined) {
|
|
2762
|
+
const depositAddress = this.safeString(networkEntry['info'], 'depositAddress');
|
|
2750
2763
|
if (depositAddress !== undefined) {
|
|
2751
2764
|
tag = address;
|
|
2752
2765
|
address = depositAddress;
|
|
@@ -2754,8 +2767,8 @@ export default class poloniex extends Exchange {
|
|
|
2754
2767
|
}
|
|
2755
2768
|
return {
|
|
2756
2769
|
'info': response,
|
|
2757
|
-
'currency': code,
|
|
2758
|
-
'network': network,
|
|
2770
|
+
'currency': currency['code'],
|
|
2771
|
+
'network': this.safeString(networkEntry, 'network'),
|
|
2759
2772
|
'address': address,
|
|
2760
2773
|
'tag': tag,
|
|
2761
2774
|
};
|
|
@@ -2825,23 +2838,13 @@ export default class poloniex extends Exchange {
|
|
|
2825
2838
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
2826
2839
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
2827
2840
|
this.checkAddress(address);
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
'amount': amount,
|
|
2833
|
-
'address': address,
|
|
2834
|
-
};
|
|
2841
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2842
|
+
params = extraParams;
|
|
2843
|
+
request['amount'] = this.currencyToPrecision(code, amount);
|
|
2844
|
+
request['address'] = address;
|
|
2835
2845
|
if (tag !== undefined) {
|
|
2836
2846
|
request['paymentId'] = tag;
|
|
2837
2847
|
}
|
|
2838
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2839
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2840
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2841
|
-
if (network !== undefined) {
|
|
2842
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2843
|
-
params = this.omit(params, 'network');
|
|
2844
|
-
}
|
|
2845
2848
|
const response = await this.privatePostWalletsWithdraw(this.extend(request, params));
|
|
2846
2849
|
//
|
|
2847
2850
|
// {
|
|
@@ -2850,7 +2853,11 @@ export default class poloniex extends Exchange {
|
|
|
2850
2853
|
// "withdrawalNumber": 13449869
|
|
2851
2854
|
// }
|
|
2852
2855
|
//
|
|
2853
|
-
|
|
2856
|
+
const withdrawResponse = {
|
|
2857
|
+
'response': response,
|
|
2858
|
+
'withdrawNetworkEntry': networkEntry,
|
|
2859
|
+
};
|
|
2860
|
+
return this.parseTransaction(withdrawResponse, currency);
|
|
2854
2861
|
}
|
|
2855
2862
|
async fetchTransactionsHelper(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2856
2863
|
await this.loadMarkets();
|
|
@@ -3176,6 +3183,10 @@ export default class poloniex extends Exchange {
|
|
|
3176
3183
|
// "withdrawalRequestsId": 33485231
|
|
3177
3184
|
// }
|
|
3178
3185
|
//
|
|
3186
|
+
// if it's being parsed from "withdraw()" method, get the original response
|
|
3187
|
+
if ('withdrawNetworkEntry' in transaction) {
|
|
3188
|
+
transaction = transaction['response'];
|
|
3189
|
+
}
|
|
3179
3190
|
const timestamp = this.safeTimestamp(transaction, 'timestamp');
|
|
3180
3191
|
const currencyId = this.safeString(transaction, 'currency');
|
|
3181
3192
|
const code = this.safeCurrencyCode(currencyId);
|
package/js/src/pro/binance.js
CHANGED
|
@@ -830,6 +830,7 @@ export default class binance extends binanceRest {
|
|
|
830
830
|
orderbook.reset(snapshot);
|
|
831
831
|
// unroll the accumulated deltas
|
|
832
832
|
const messages = orderbook.cache;
|
|
833
|
+
orderbook.cache = [];
|
|
833
834
|
for (let i = 0; i < messages.length; i++) {
|
|
834
835
|
const messageItem = messages[i];
|
|
835
836
|
const U = this.safeInteger(messageItem, 'U');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import bittradeRest from '../bittrade.js';
|
|
2
2
|
import type { Int, OrderBook, Trade, Ticker, OHLCV } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
|
-
export default class
|
|
4
|
+
export default class bittrade extends bittradeRest {
|
|
5
5
|
describe(): any;
|
|
6
6
|
requestId(): any;
|
|
7
7
|
/**
|
|
8
8
|
* @method
|
|
9
|
-
* @name
|
|
9
|
+
* @name bittrade#watchTicker
|
|
10
10
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
11
11
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
12
12
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -16,7 +16,7 @@ export default class huobijp extends huobijpRest {
|
|
|
16
16
|
handleTicker(client: Client, message: any): any;
|
|
17
17
|
/**
|
|
18
18
|
* @method
|
|
19
|
-
* @name
|
|
19
|
+
* @name bittrade#watchTrades
|
|
20
20
|
* @description get the list of most recent trades for a particular symbol
|
|
21
21
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
22
22
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -28,7 +28,7 @@ export default class huobijp extends huobijpRest {
|
|
|
28
28
|
handleTrades(client: Client, message: any): any;
|
|
29
29
|
/**
|
|
30
30
|
* @method
|
|
31
|
-
* @name
|
|
31
|
+
* @name bittrade#watchOHLCV
|
|
32
32
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
33
33
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
34
34
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -41,7 +41,7 @@ export default class huobijp extends huobijpRest {
|
|
|
41
41
|
handleOHLCV(client: Client, message: any): void;
|
|
42
42
|
/**
|
|
43
43
|
* @method
|
|
44
|
-
* @name
|
|
44
|
+
* @name bittrade#watchOrderBook
|
|
45
45
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
46
46
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
47
47
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
6
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
|
-
import
|
|
8
|
+
import bittradeRest from '../bittrade.js';
|
|
9
9
|
import { ExchangeError } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
|
|
11
11
|
// ----------------------------------------------------------------------------
|
|
12
|
-
export default class
|
|
12
|
+
export default class bittrade extends bittradeRest {
|
|
13
13
|
describe() {
|
|
14
14
|
return this.deepExtend(super.describe(), {
|
|
15
15
|
'has': {
|
|
@@ -49,7 +49,7 @@ export default class huobijp extends huobijpRest {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* @method
|
|
52
|
-
* @name
|
|
52
|
+
* @name bittrade#watchTicker
|
|
53
53
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
54
54
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
55
55
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -111,7 +111,7 @@ export default class huobijp extends huobijpRest {
|
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* @method
|
|
114
|
-
* @name
|
|
114
|
+
* @name bittrade#watchTrades
|
|
115
115
|
* @description get the list of most recent trades for a particular symbol
|
|
116
116
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
117
117
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -188,7 +188,7 @@ export default class huobijp extends huobijpRest {
|
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* @method
|
|
191
|
-
* @name
|
|
191
|
+
* @name bittrade#watchOHLCV
|
|
192
192
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
193
193
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
194
194
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -262,7 +262,7 @@ export default class huobijp extends huobijpRest {
|
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
264
264
|
* @method
|
|
265
|
-
* @name
|
|
265
|
+
* @name bittrade#watchOrderBook
|
|
266
266
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
267
267
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
268
268
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -585,7 +585,7 @@ export default class huobijp extends huobijpRest {
|
|
|
585
585
|
//
|
|
586
586
|
// ________________________
|
|
587
587
|
//
|
|
588
|
-
// sometimes
|
|
588
|
+
// sometimes bittrade responds with half of a JSON response like
|
|
589
589
|
//
|
|
590
590
|
// " {"ch":"market.ethbtc.m "
|
|
591
591
|
//
|
package/js/src/pro/luno.js
CHANGED
|
@@ -198,17 +198,18 @@ export default class luno extends lunoRest {
|
|
|
198
198
|
if (!(symbol in this.orderbooks)) {
|
|
199
199
|
this.orderbooks[symbol] = this.indexedOrderBook({});
|
|
200
200
|
}
|
|
201
|
-
const orderbook = this.orderbooks[symbol];
|
|
202
201
|
const asks = this.safeValue(message, 'asks');
|
|
203
202
|
if (asks !== undefined) {
|
|
204
203
|
const snapshot = this.customParseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'price', 'volume', 'id');
|
|
205
|
-
|
|
204
|
+
this.orderbooks[symbol] = this.indexedOrderBook(snapshot);
|
|
206
205
|
}
|
|
207
206
|
else {
|
|
208
|
-
this.
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
const ob = this.orderbooks[symbol];
|
|
208
|
+
this.handleDelta(ob, message);
|
|
209
|
+
ob['timestamp'] = timestamp;
|
|
210
|
+
ob['datetime'] = this.iso8601(timestamp);
|
|
211
211
|
}
|
|
212
|
+
const orderbook = this.orderbooks[symbol];
|
|
212
213
|
const nonce = this.safeInteger(message, 'sequence');
|
|
213
214
|
orderbook['nonce'] = nonce;
|
|
214
215
|
client.resolve(orderbook, messageHash);
|
package/js/src/pro/mexc.js
CHANGED
|
@@ -797,6 +797,9 @@ export default class mexc extends mexcRest {
|
|
|
797
797
|
const messageHash = 'orderbook:' + symbol;
|
|
798
798
|
const subscription = this.safeValue(client.subscriptions, messageHash);
|
|
799
799
|
const limit = this.safeInteger(subscription, 'limit');
|
|
800
|
+
if (!(symbol in this.orderbooks)) {
|
|
801
|
+
this.orderbooks[symbol] = this.orderBook();
|
|
802
|
+
}
|
|
800
803
|
const storedOrderBook = this.orderbooks[symbol];
|
|
801
804
|
const nonce = this.safeInteger(storedOrderBook, 'nonce');
|
|
802
805
|
if (nonce === undefined) {
|