ccxt 4.1.34 → 4.1.35

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/js/src/huobi.js CHANGED
@@ -946,41 +946,195 @@ export default class huobi extends Exchange {
946
946
  },
947
947
  'networks': {
948
948
  // by displaynames
949
- 'ALGO': 'ALGO',
950
- 'ALGORAND': 'ALGO',
951
- 'BEP20': 'BEP20',
952
- 'BSC': 'BEP20',
953
- 'ERC20': 'ERC20',
954
- 'ETH': 'ERC20',
955
- 'AVALANCHE': 'AVAXCCHAIN',
956
- 'AVAX': 'AVAXCCHAIN',
957
- 'HRC20': 'HECO',
958
- 'HECO': 'HECO',
959
- // 'HT': 'HECO', // HT is not acceptable networkcode for unification
960
- 'TRC20': 'TRC20',
961
- 'TRX': 'TRC20',
962
- 'BTC': 'BTC',
963
- 'BITCOIN': 'BTC',
964
- 'ARBITRUM': 'ARB',
965
- 'ARB': 'ARB',
966
- 'SOLANA': 'SOL',
967
- 'SOL': 'SOL',
968
- 'SPL': 'SOL',
969
- 'PRC20': 'PRC20',
970
- 'POLYGON': 'PRC20',
971
- 'MATIC': 'PRC20',
972
- },
973
- 'networksById': {
974
- 'ALGO': 'ALGO',
975
- 'BEP20': 'BEP20',
976
- 'ERC20': 'ERC20',
977
- 'AVAXCCHAIN': 'AVALANCHE',
978
- 'HECO': 'HRC20',
979
- 'TRC20': 'TRC20',
949
+ 'TRC20': 'TRX',
980
950
  'BTC': 'BTC',
981
- 'ARB': 'ARBITRUM',
951
+ 'ERC20': 'ETH',
982
952
  'SOL': 'SOLANA',
983
- 'PRC20': 'POLYGON',
953
+ 'HRC20': 'HECO',
954
+ 'BEP20': 'BSC',
955
+ 'XMR': 'XMR',
956
+ 'LTC': 'LTC',
957
+ 'XRP': 'XRP',
958
+ 'XLM': 'XLM',
959
+ 'CRONOS': 'CRO',
960
+ 'CRO': 'CRO',
961
+ 'GLMR': 'GLMR',
962
+ 'POLYGON': 'MATIC',
963
+ 'MATIC': 'MATIC',
964
+ 'BTT': 'BTT',
965
+ 'CUBE': 'CUBE',
966
+ 'IOST': 'IOST',
967
+ 'NEO': 'NEO',
968
+ 'KLAY': 'KLAY',
969
+ 'EOS': 'EOS',
970
+ 'THETA': 'THETA',
971
+ 'NAS': 'NAS',
972
+ 'NULS': 'NULS',
973
+ 'QTUM': 'QTUM',
974
+ 'FTM': 'FTM',
975
+ 'CELO': 'CELO',
976
+ 'DOGE': 'DOGE',
977
+ 'DOGECHAIN': 'DOGECHAIN',
978
+ 'NEAR': 'NEAR',
979
+ 'STEP': 'STEP',
980
+ 'BITCI': 'BITCI',
981
+ 'CARDANO': 'ADA',
982
+ 'ADA': 'ADA',
983
+ 'ETC': 'ETC',
984
+ 'LUK': 'LUK',
985
+ 'MINEPLEX': 'MINEPLEX',
986
+ 'DASH': 'DASH',
987
+ 'ZEC': 'ZEC',
988
+ 'IOTA': 'IOTA',
989
+ 'NEON3': 'NEON3',
990
+ 'XEM': 'XEM',
991
+ 'HC': 'HC',
992
+ 'LSK': 'LSK',
993
+ 'DCR': 'DCR',
994
+ 'BTG': 'BTG',
995
+ 'STEEM': 'STEEM',
996
+ 'BTS': 'BTS',
997
+ 'ICX': 'ICX',
998
+ 'WAVES': 'WAVES',
999
+ 'CMT': 'CMT',
1000
+ 'BTM': 'BTM',
1001
+ 'VET': 'VET',
1002
+ 'XZC': 'XZC',
1003
+ 'ACT': 'ACT',
1004
+ 'SMT': 'SMT',
1005
+ 'BCD': 'BCD',
1006
+ 'WAX': 'WAX1',
1007
+ 'WICC': 'WICC',
1008
+ 'ELF': 'ELF',
1009
+ 'ZIL': 'ZIL',
1010
+ 'ELA': 'ELA',
1011
+ 'BCX': 'BCX',
1012
+ 'SBTC': 'SBTC',
1013
+ 'BIFI': 'BIFI',
1014
+ 'CTXC': 'CTXC',
1015
+ 'WAN': 'WAN',
1016
+ 'POLYX': 'POLYX',
1017
+ 'PAI': 'PAI',
1018
+ 'WTC': 'WTC',
1019
+ 'DGB': 'DGB',
1020
+ 'XVG': 'XVG',
1021
+ 'AAC': 'AAC',
1022
+ 'AE': 'AE',
1023
+ 'SEELE': 'SEELE',
1024
+ 'BCV': 'BCV',
1025
+ 'GRS': 'GRS',
1026
+ 'ARDR': 'ARDR',
1027
+ 'NANO': 'NANO',
1028
+ 'ZEN': 'ZEN',
1029
+ 'RBTC': 'RBTC',
1030
+ 'BSV': 'BSV',
1031
+ 'GAS': 'GAS',
1032
+ 'XTZ': 'XTZ',
1033
+ 'LAMB': 'LAMB',
1034
+ 'CVNT1': 'CVNT1',
1035
+ 'DOCK': 'DOCK',
1036
+ 'SC': 'SC',
1037
+ 'KMD': 'KMD',
1038
+ 'ETN': 'ETN',
1039
+ 'TOP': 'TOP',
1040
+ 'IRIS': 'IRIS',
1041
+ 'UGAS': 'UGAS',
1042
+ 'TT': 'TT',
1043
+ 'NEWTON': 'NEWTON',
1044
+ 'VSYS': 'VSYS',
1045
+ 'FSN': 'FSN',
1046
+ 'BHD': 'BHD',
1047
+ 'ONE': 'ONE',
1048
+ 'EM': 'EM',
1049
+ 'CKB': 'CKB',
1050
+ 'EOSS': 'EOSS',
1051
+ 'HIVE': 'HIVE',
1052
+ 'RVN': 'RVN',
1053
+ 'DOT': 'DOT',
1054
+ 'KSM': 'KSM',
1055
+ 'BAND': 'BAND',
1056
+ 'OEP4': 'OEP4',
1057
+ 'NBS': 'NBS',
1058
+ 'FIS': 'FIS',
1059
+ 'AR': 'AR',
1060
+ 'HBAR': 'HBAR',
1061
+ 'FIL': 'FIL',
1062
+ 'MASS': 'MASS',
1063
+ 'KAVA': 'KAVA',
1064
+ 'XYM': 'XYM',
1065
+ 'ENJ': 'ENJ',
1066
+ 'CRUST': 'CRUST',
1067
+ 'ICP': 'ICP',
1068
+ 'CSPR': 'CSPR',
1069
+ 'FLOW': 'FLOW',
1070
+ 'IOTX': 'IOTX',
1071
+ 'LAT': 'LAT',
1072
+ 'APT': 'APT',
1073
+ 'XCH': 'XCH',
1074
+ 'MINA': 'MINA',
1075
+ 'XEC': 'ECASH',
1076
+ 'XPRT': 'XPRT',
1077
+ 'CCA': 'ACA',
1078
+ 'AOTI': 'COTI',
1079
+ 'AKT': 'AKT',
1080
+ 'ARS': 'ARS',
1081
+ 'ASTR': 'ASTR',
1082
+ 'AZERO': 'AZERO',
1083
+ 'BLD': 'BLD',
1084
+ 'BRISE': 'BRISE',
1085
+ 'CORE': 'CORE',
1086
+ 'DESO': 'DESO',
1087
+ 'DFI': 'DFI',
1088
+ 'EGLD': 'EGLD',
1089
+ 'ERG': 'ERG',
1090
+ 'ETHF': 'ETHFAIR',
1091
+ 'ETHW': 'ETHW',
1092
+ 'EVMOS': 'EVMOS',
1093
+ 'FIO': 'FIO',
1094
+ 'FLR': 'FLR',
1095
+ 'FINSCHIA': 'FINSCHIA',
1096
+ 'KMA': 'KMA',
1097
+ 'KYVE': 'KYVE',
1098
+ 'MEV': 'MEV',
1099
+ 'MOVR': 'MOVR',
1100
+ 'NODL': 'NODL',
1101
+ 'OAS': 'OAS',
1102
+ 'OSMO': 'OSMO',
1103
+ 'PAYCOIN': 'PAYCOIN',
1104
+ 'POKT': 'POKT',
1105
+ 'PYG': 'PYG',
1106
+ 'REI': 'REI',
1107
+ 'SCRT': 'SCRT',
1108
+ 'SDN': 'SDN',
1109
+ 'SEI': 'SEI',
1110
+ 'SGB': 'SGB',
1111
+ 'SUI': 'SUI',
1112
+ 'SXP': 'SOLAR',
1113
+ 'SYS': 'SYS',
1114
+ 'TENET': 'TENET',
1115
+ 'TON': 'TON',
1116
+ 'UNQ': 'UNQ',
1117
+ 'UYU': 'UYU',
1118
+ 'WEMIX': 'WEMIX',
1119
+ 'XDC': 'XDC',
1120
+ 'XPLA': 'XPLA',
1121
+ // todo: below
1122
+ // 'LUNC': 'LUNC',
1123
+ // 'TERRA': 'TERRA', // tbd
1124
+ // 'LUNA': 'LUNA', tbd
1125
+ // 'FCT2': 'FCT2',
1126
+ // FIL-0X ?
1127
+ // 'COSMOS': 'ATOM1',
1128
+ // 'ATOM': 'ATOM1',
1129
+ // 'CRO': 'CRO',
1130
+ // 'OP': [ 'OPTIMISM', 'OPTIMISMETH' ]
1131
+ // 'ARB': ['ARB', 'ARBITRUMETH']
1132
+ // 'CHZ': [ 'CHZ', 'CZH' ],
1133
+ // todo: AVAXCCHAIN CCHAIN AVAX
1134
+ // 'ALGO': ['ALGO', 'ALGOUSDT']
1135
+ // 'ONT': [ 'ONT', 'ONTOLOGY' ],
1136
+ // 'BCC': 'BCC', BCH's somewhat chain
1137
+ // 'DBC1': 'DBC1',
984
1138
  },
985
1139
  // https://github.com/ccxt/ccxt/issues/5376
986
1140
  'fetchOrdersByStatesMethod': 'spot_private_get_v1_order_orders',
@@ -2931,10 +3085,10 @@ export default class huobi extends Exchange {
2931
3085
  for (let j = 0; j < chains.length; j++) {
2932
3086
  const chainEntry = chains[j];
2933
3087
  const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
2934
- const title = this.safeString(chainEntry, 'displayName');
3088
+ const title = this.safeString2(chainEntry, 'baseChain', 'displayName'); // baseChain and baseChainProtocol are together existent or inexistent in entries, but baseChain is preferred. when they are both inexistent, then we use generic displayName
2935
3089
  this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
2936
3090
  this.options['networkNamesByChainIds'][uniqueChainId] = title;
2937
- const networkCode = this.networkIdToCode(title, code);
3091
+ const networkCode = this.networkIdToCode(uniqueChainId);
2938
3092
  minWithdraw = this.safeNumber(chainEntry, 'minWithdrawAmt');
2939
3093
  maxWithdraw = this.safeNumber(chainEntry, 'maxWithdrawAmt');
2940
3094
  const withdrawStatus = this.safeString(chainEntry, 'withdrawStatus');
@@ -2954,6 +3108,10 @@ export default class huobi extends Exchange {
2954
3108
  'id': uniqueChainId,
2955
3109
  'network': networkCode,
2956
3110
  'limits': {
3111
+ 'deposit': {
3112
+ 'min': undefined,
3113
+ 'max': undefined,
3114
+ },
2957
3115
  'withdraw': {
2958
3116
  'min': minWithdraw,
2959
3117
  'max': maxWithdraw,
@@ -2984,6 +3142,10 @@ export default class huobi extends Exchange {
2984
3142
  'min': minWithdraw,
2985
3143
  'max': maxWithdraw,
2986
3144
  },
3145
+ 'deposit': {
3146
+ 'min': undefined,
3147
+ 'max': undefined,
3148
+ },
2987
3149
  },
2988
3150
  'precision': this.parseNumber(minPrecision),
2989
3151
  'networks': networks,
@@ -3011,8 +3173,13 @@ export default class huobi extends Exchange {
3011
3173
  throw new ExchangeError(this.id + ' networkCodeToId() - markets need to be loaded at first');
3012
3174
  }
3013
3175
  const uniqueNetworkIds = this.safeValue(this.options['networkChainIdsByNames'], currencyCode, {});
3014
- const networkTitle = super.networkCodeToId(networkCode);
3015
- return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
3176
+ if (networkCode in uniqueNetworkIds) {
3177
+ return uniqueNetworkIds[networkCode];
3178
+ }
3179
+ else {
3180
+ const networkTitle = super.networkCodeToId(networkCode);
3181
+ return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
3182
+ }
3016
3183
  }
3017
3184
  async fetchBalance(params = {}) {
3018
3185
  /**
@@ -5451,7 +5618,7 @@ export default class huobi extends Exchange {
5451
5618
  'currency': code,
5452
5619
  'address': address,
5453
5620
  'tag': tag,
5454
- 'network': this.networkIdToCode(networkId, code),
5621
+ 'network': this.networkIdToCode(networkId),
5455
5622
  'note': note,
5456
5623
  'info': depositAddress,
5457
5624
  };
@@ -5726,7 +5893,7 @@ export default class huobi extends Exchange {
5726
5893
  'txid': txHash,
5727
5894
  'timestamp': timestamp,
5728
5895
  'datetime': this.iso8601(timestamp),
5729
- 'network': this.networkIdToCode(networkId, code),
5896
+ 'network': this.networkIdToCode(networkId),
5730
5897
  'address': this.safeString(transaction, 'address'),
5731
5898
  'addressTo': undefined,
5732
5899
  'addressFrom': undefined,
package/js/src/kraken.js CHANGED
@@ -1227,8 +1227,10 @@ export default class kraken extends Exchange {
1227
1227
  for (let i = 0; i < currencyIds.length; i++) {
1228
1228
  const currencyId = currencyIds[i];
1229
1229
  const code = this.safeCurrencyCode(currencyId);
1230
+ const balance = this.safeValue(balances, currencyId, {});
1230
1231
  const account = this.account();
1231
- account['total'] = this.safeString(balances, currencyId);
1232
+ account['used'] = this.safeString(balance, 'hold_trade');
1233
+ account['total'] = this.safeString(balance, 'balance');
1232
1234
  result[code] = account;
1233
1235
  }
1234
1236
  return this.safeBalance(result);
@@ -1238,19 +1240,24 @@ export default class kraken extends Exchange {
1238
1240
  * @method
1239
1241
  * @name kraken#fetchBalance
1240
1242
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1241
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getAccountBalance
1243
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getExtendedBalance
1242
1244
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1243
1245
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
1244
1246
  */
1245
1247
  await this.loadMarkets();
1246
- const response = await this.privatePostBalance(params);
1248
+ const response = await this.privatePostBalanceEx(params);
1247
1249
  //
1248
1250
  // {
1249
- // "error":[],
1250
- // "result":{
1251
- // "ZUSD":"58.8649",
1252
- // "KFEE":"4399.43",
1253
- // "XXBT":"0.0000034506",
1251
+ // "error": [],
1252
+ // "result": {
1253
+ // "ZUSD": {
1254
+ // "balance": 25435.21,
1255
+ // "hold_trade": 8249.76
1256
+ // },
1257
+ // "XXBT": {
1258
+ // "balance": 1.2435,
1259
+ // "hold_trade": 0.8423
1260
+ // }
1254
1261
  // }
1255
1262
  // }
1256
1263
  //
@@ -190,7 +190,6 @@ export default class kucoin extends Exchange {
190
190
  };
191
191
  fetchLedger(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
192
192
  calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
193
- fetchBorrowRateHistory(code: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
194
193
  parseBorrowRateHistory(response: any, code: any, since: any, limit: any): any;
195
194
  parseBorrowRate(info: any, currency?: any): {
196
195
  currency: any;