ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.87k stars 7.51k forks source link

bitfinex fetchFundingFees result contains 'HOT' and 'Hydro Protocol' (full name & duplicate) #4127

Closed firepol closed 5 years ago

firepol commented 5 years ago

I just called the method in question, and the response was:

{'info': {'withdraw': {'BTC': '0.0004', 'LTC': '0.001', 'ETH': '0.0018', 'ETC': '0.01', 'ZEC': '0.001', 'XMR': '0.0001', 'DSH': '0.01', 'XRP': '0.02', 'IOT': '0.5', 'EOS': 0, 'SAN': '0.71147', 'OMG': '0.11971', 'BCH': '0.0001', 'NEO': 0, 'ETP': '0.01', 'QTM': '0.01', 'AVT': '0.92308', 'EDO': '0.26144', 'BTG': 0, 'DAT': '8.2767', 'QSH': '1.6777', 'YYW': '8.4986', 'GNT': '2.2285', 'SNT': '9.2375', 'BAT': '1.3362', 'MNA': '5.1432', 'FUN': '26.363', 'ZRX': '0.44642', 'TNB': '31.707', 'SPK': '6.802', 'TRX': '34.395', 'RCN': '8.2024', 'RLC': '0.9043', 'AID': '5.1436', 'SNG': '11.253', 'REP': '0.025232', 'ELF': '1.2513', 'NEC': '0.83967', 'IOS': '31.602', 'AIO': '0.71966', 'REQ': '5.6252', 'RDN': '0.72096', 'LRC': '2.8466', 'WAX': '4.0537', 'DAI': '0.38514', 'CFI': '13.958', 'AGI': '4.8161', 'BFT': '9.1144', 'MTN': '13.58', 'ODE': '1.7104', 'ANT': '0.44337', 'DTH': '24.52', 'MIT': '1.4402', 'STJ': '0.13234', 'XLM': 0, 'XVG': '0.5', 'BCI': 0, 'MKR': '0.00054308', 'VEN': '0.0018', 'KNC': '0.71223', 'POA': '2.0931', 'EVT': '184.41', 'LYM': '20.69', 'UTK': '10.03', 'VEE': '37.206', 'DAD': '4.8285', 'ORS': '9.4256', 'AUC': '7.7201', 'POY': '1.2858', 'FSN': '0.41462', 'CBT': '22.791', 'ZCN': '1.3689', 'SEN': '90.91', 'NCA': '45.0', 'CND': '11.253', 'CTX': '1.1262', 'PAI': '0.5', 'SEE': '240.0', 'ESS': '89.109', 'ATD': 0, 'ADD': 0, 'MTO': '3872.9', 'ATM': '59.348', 'HOT': '38.97', 'DTA': '97.298', 'IQX': '1.0', 'WPR': '6.4415', 'ZIL': '9.8361', 'BNT': '0.2867', 'ABS': '20.003', 'XRA': '6.9768', 'MAN': '1.4992', 'BBN': '33.427', 'NIO': '7.347', 'DGX': '0.0070777', 'VET': 0, 'UTN': '85.715', 'TKN': '0.43903', 'GOT': '0.57737', 'XTZ': '0.2', 'CNN': '878.05', 'BOX': '36.638', 'MGO': '0.5625', 'RTE': '55.918', 'YGG': '252.81', 'MLN': '0.026038', 'WTC': '0.11687', 'CSX': '2.1195', 'OMN': 0, 'INT': '10.871', 'DRN': '1.2461', 'PNK': '47.771', 'DGB': 0}}, 'withdraw': {'BTC': 0.0004, 'LTC': 0.001, 'ETH': 0.0018, 'ETC': 0.01, 'ZEC': 0.001, 'XMR': 0.0001, 'DASH': 0.01, 'XRP': 0.02, 'IOTA': 0.5, 'EOS': 0.0, 'SAN': 0.71147, 'OMG': 0.11971, 'BCH': 0.0001, 'NEO': 0.0, 'ETP': 0.01, 'QTUM': 0.01, 'AVT': 0.92308, 'EDO': 0.26144, 'BTG': 0.0, 'DATA': 8.2767, 'QASH': 1.6777, 'YOYOW': 8.4986, 'GNT': 2.2285, 'SNT': 9.2375, 'BAT': 1.3362, 'MANA': 5.1432, 'FUN': 26.363, 'ZRX': 0.44642, 'TNB': 31.707, 'SPANK': 6.802, 'TRX': 34.395, 'RCN': 8.2024, 'RLC': 0.9043, 'AID': 5.1436, 'SNGLS': 11.253, 'REP': 0.025232, 'ELF': 1.2513, 'NEC': 0.83967, 'IOST': 31.602, 'AION': 0.71966, 'REQ': 5.6252, 'RDN': 0.72096, 'LRC': 2.8466, 'WAX': 4.0537, 'DAI': 0.38514, 'CFI': 13.958, 'AGI': 4.8161, 'BFT': 9.1144, 'MTN': 13.58, 'ODE': 1.7104, 'ANT': 0.44337, 'DTH': 24.52, 'MITH': 1.4402, 'STORJ': 0.13234, 'XLM': 0.0, 'XVG': 0.5, 'BCI': 0.0, 'MKR': 0.00054308, 'VEN': 0.0018, 'KNC': 0.71223, 'POA': 2.0931, 'EVT': 184.41, 'LYM': 20.69, 'UTK': 10.03, 'VEE': 37.206, 'DADI': 4.8285, 'ORS Group': 9.4256, 'AUC': 7.7201, 'POLY': 1.2858, 'FSN': 0.41462, 'CBT': 22.791, 'ZCN': 1.3689, 'SEN': 90.91, 'NCASH': 45.0, 'CND': 11.253, 'CTXC': 1.1262, 'PAI': 0.5, 'SEER': 240.0, 'ESS': 89.109, 'ATD': 0.0, 'ADD': 0.0, 'MTO': 3872.9, 'ATMI': 59.348, 'Hydro Protocol': 38.97, 'DTA': 97.298, 'IQ': 1.0, 'WPR': 6.4415, 'ZIL': 9.8361, 'BNT': 0.2867, 'ABYSS': 20.003, 'XRA': 6.9768, 'MAN': 1.4992, 'BBN': 33.427, 'NIO': 7.347, 'DGX': 0.0070777, 'VET': 0.0, 'UTNP': 85.715, 'TKN': 0.43903, 'GOT': 0.57737, 'XTZ': 0.2, 'CNN': 878.05, 'BOX': 36.638, 'MGO': 0.5625, 'RTE': 55.918, 'YGG': 252.81, 'MLN': 0.026038, 'WTC': 0.11687, 'CSX': 2.1195, 'OMN': 0.0, 'INT': 10.871, 'DRN': 1.2461, 'PNK': 47.771, 'DGB': 0.0}, 'deposit': {'BTC': 0.0004, 'LTC': 0.001, 'ETH': 0.0018, 'ETC': 0.01, 'ZEC': 0.001, 'XMR': 0.0001, 'DASH': 0.01, 'XRP': 0.02, 'IOTA': 0.5, 'EOS': 0.0, 'SAN': 0.71147, 'OMG': 0.11971, 'BCH': 0.0001, 'NEO': 0.0, 'ETP': 0.01, 'QTUM': 0.01, 'AVT': 0.92308, 'EDO': 0.26144, 'BTG': 0.0, 'DATA': 8.2767, 'QASH': 1.6777, 'YOYOW': 8.4986, 'GNT': 2.2285, 'SNT': 9.2375, 'BAT': 1.3362, 'MANA': 5.1432, 'FUN': 26.363, 'ZRX': 0.44642, 'TNB': 31.707, 'SPANK': 6.802, 'TRX': 34.395, 'RCN': 8.2024, 'RLC': 0.9043, 'AID': 5.1436, 'SNGLS': 11.253, 'REP': 0.025232, 'ELF': 1.2513, 'NEC': 0.83967, 'IOST': 31.602, 'AION': 0.71966, 'REQ': 5.6252, 'RDN': 0.72096, 'LRC': 2.8466, 'WAX': 4.0537, 'DAI': 0.38514, 'CFI': 13.958, 'AGI': 4.8161, 'BFT': 9.1144, 'MTN': 13.58, 'ODE': 1.7104, 'ANT': 0.44337, 'DTH': 24.52, 'MITH': 1.4402, 'STORJ': 0.13234, 'XLM': 0.0, 'XVG': 0.5, 'BCI': 0.0, 'MKR': 0.00054308, 'VEN': 0.0018, 'KNC': 0.71223, 'POA': 2.0931, 'EVT': 184.41, 'LYM': 20.69, 'UTK': 10.03, 'VEE': 37.206, 'DADI': 4.8285, 'ORS Group': 9.4256, 'AUC': 7.7201, 'POLY': 1.2858, 'FSN': 0.41462, 'CBT': 22.791, 'ZCN': 1.3689, 'SEN': 90.91, 'NCASH': 45.0, 'CND': 11.253, 'CTXC': 1.1262, 'PAI': 0.5, 'SEER': 240.0, 'ESS': 89.109, 'ATD': 0.0, 'ADD': 0.0, 'MTO': 3872.9, 'ATMI': 59.348, 'Hydro Protocol': 38.97, 'DTA': 97.298, 'IQ': 1.0, 'WPR': 6.4415, 'ZIL': 9.8361, 'BNT': 0.2867, 'ABYSS': 20.003, 'XRA': 6.9768, 'MAN': 1.4992, 'BBN': 33.427, 'NIO': 7.347, 'DGX': 0.0070777, 'VET': 0.0, 'UTNP': 85.715, 'TKN': 0.43903, 'GOT': 0.57737, 'XTZ': 0.2, 'CNN': 878.05, 'BOX': 36.638, 'MGO': 0.5625, 'RTE': 55.918, 'YGG': 252.81, 'MLN': 0.026038, 'WTC': 0.11687, 'CSX': 2.1195, 'OMN': 0.0, 'INT': 10.871, 'DRN': 1.2461, 'PNK': 47.771, 'DGB': 0.0}}

Expected, all cryptocurrencies should be by symbol, e.g.:

But the thing is, 'HOT' is already in the list (has even the same withdrawl fee) so the bug must be somewhere else...

kroitor commented 5 years ago

@firepol need more info from you... maybe, some minimal snippet to reproduce it...

Because, when I run with version 1.17.486 i can only see HOT properly converted to Hydro Protocol – present just once in the entire output for each deposit/withdraw section – HOT in info, Hydro Protocol in deposit and withdraw:

mbp:ccxt igorkroitor$ python examples/py/cli.py bitfinex fetchFundingFees
{'deposit': {'ABYSS': 38.12,
             u'ADD': 0.0,
             u'AGI': 4.8161,
             u'AID': 5.1436,
             'AION': 0.71966,
             u'ANT': 0.44337,
             u'ATD': 0.0,
             'ATMI': 43.637,
             u'AUC': 5.1562,
             u'AVT': 0.92308,
             u'BAT': 1.3362,
             u'BBN': 33.427,
             u'BCH': 0.0001,
             u'BCI': 0.0,
             u'BFT': 9.1144,
             u'BNT': 0.2867,
             u'BOX': 36.638,
             u'BTC': 0.0004,
             u'BTG': 0.0,
             u'CBT': 22.791,
             u'CFI': 13.958,
             u'CND': 11.253,
             u'CNN': 1139.3,
             u'CSX': 2.1195,
             'CTXC': 1.1262,
             'DADI': 4.8285,
             u'DAI': 0.38514,
             'DASH': 0.01,
             'DATA': 8.2767,
             u'DGB': 0.0,
             u'DGX': 0.0070777,
             u'DRN': 1.2461,
             u'DTA': 128.58,
             u'DTH': 24.52,
             u'EDO': 0.26144,
             u'ELF': 1.2513,
             u'EOS': 0.0,
             u'ESS': 89.109,
             u'ETC': 0.01,
             u'ETH': 0.0018,
             u'ETP': 0.01,
             u'EVT': 171.46,
             u'FSN': 0.41462,
             u'FUN': 26.363,
             u'GNT': 2.2285,
             u'GOT': 0.57737,
             'Hydro Protocol': 38.97,
             u'INT': 10.871,
             'IOST': 31.602,
             'IOTA': 0.5,
             'IQ': 1.0,
             u'KNC': 0.91431,
             u'LRC': 2.8466,
             u'LTC': 0.001,
             u'LYM': 20.69,
             u'MAN': 1.4992,
             'MANA': 5.1432,
             u'MGO': 0.70727,
             'MITH': 1.4402,
             u'MKR': 0.00054308,
             u'MLN': 0.018,
             u'MTN': 13.58,
             u'MTO': 3872.9,
             'NCASH': 45.0,
             u'NEC': 0.83967,
             u'NEO': 0.0,
             u'NIO': 12.122,
             u'ODE': 1.7104,
             u'OMG': 0.11971,
             u'OMN': 0.0,
             'ORS Group': 9.4256,
             u'PAI': 0.5,
             u'PNK': 47.771,
             u'POA': 3.7449,
             'POLY': 1.2858,
             'QASH': 1.6777,
             'QTUM': 0.01,
             u'RCN': 10.0,
             u'RDN': 0.72096,
             u'REP': 0.025232,
             u'REQ': 5.6252,
             u'RLC': 0.9043,
             u'RTE': 78.672,
             u'SAN': 0.71147,
             'SEER': 240.0,
             u'SEN': 90.91,
             'SNGLS': 11.253,
             u'SNT': 9.2375,
             'SPANK': 6.802,
             'STORJ': 0.13234,
             u'TKN': 0.43903,
             u'TNB': 31.707,
             u'TRX': 34.395,
             u'UTK': 10.03,
             'UTNP': 85.715,
             u'VEE': 37.206,
             u'VEN': 0.0018,
             u'VET': 0.0,
             u'WAX': 4.0537,
             u'WPR': 6.4415,
             u'WTC': 0.11687,
             u'XLM': 0.0,
             u'XMR': 0.0001,
             u'XRA': 8.8236,
             u'XRP': 0.02,
             u'XTZ': 0.2,
             u'XVG': 0.5,
             u'YGG': 252.81,
             'YOYOW': 8.4986,
             u'ZCN': 1.3689,
             u'ZEC': 0.001,
             u'ZIL': 9.8361,
             u'ZRX': 0.44642},
 'info': {u'withdraw': {u'ABS': u'38.12',
                        u'ADD': 0,
                        u'AGI': u'4.8161',
                        u'AID': u'5.1436',
                        u'AIO': u'0.71966',
                        u'ANT': u'0.44337',
                        u'ATD': 0,
                        u'ATM': u'43.637',
                        u'AUC': u'5.1562',
                        u'AVT': u'0.92308',
                        u'BAT': u'1.3362',
                        u'BBN': u'33.427',
                        u'BCH': u'0.0001',
                        u'BCI': 0,
                        u'BFT': u'9.1144',
                        u'BNT': u'0.2867',
                        u'BOX': u'36.638',
                        u'BTC': u'0.0004',
                        u'BTG': 0,
                        u'CBT': u'22.791',
                        u'CFI': u'13.958',
                        u'CND': u'11.253',
                        u'CNN': u'1139.3',
                        u'CSX': u'2.1195',
                        u'CTX': u'1.1262',
                        u'DAD': u'4.8285',
                        u'DAI': u'0.38514',
                        u'DAT': u'8.2767',
                        u'DGB': 0,
                        u'DGX': u'0.0070777',
                        u'DRN': u'1.2461',
                        u'DSH': u'0.01',
                        u'DTA': u'128.58',
                        u'DTH': u'24.52',
                        u'EDO': u'0.26144',
                        u'ELF': u'1.2513',
                        u'EOS': 0,
                        u'ESS': u'89.109',
                        u'ETC': u'0.01',
                        u'ETH': u'0.0018',
                        u'ETP': u'0.01',
                        u'EVT': u'171.46',
                        u'FSN': u'0.41462',
                        u'FUN': u'26.363',
                        u'GNT': u'2.2285',
                        u'GOT': u'0.57737',
                        u'HOT': u'38.97',
                        u'INT': u'10.871',
                        u'IOS': u'31.602',
                        u'IOT': u'0.5',
                        u'IQX': u'1.0',
                        u'KNC': u'0.91431',
                        u'LRC': u'2.8466',
                        u'LTC': u'0.001',
                        u'LYM': u'20.69',
                        u'MAN': u'1.4992',
                        u'MGO': u'0.70727',
                        u'MIT': u'1.4402',
                        u'MKR': u'0.00054308',
                        u'MLN': u'0.018',
                        u'MNA': u'5.1432',
                        u'MTN': u'13.58',
                        u'MTO': u'3872.9',
                        u'NCA': u'45.0',
                        u'NEC': u'0.83967',
                        u'NEO': 0,
                        u'NIO': u'12.122',
                        u'ODE': u'1.7104',
                        u'OMG': u'0.11971',
                        u'OMN': 0,
                        u'ORS': u'9.4256',
                        u'PAI': u'0.5',
                        u'PNK': u'47.771',
                        u'POA': u'3.7449',
                        u'POY': u'1.2858',
                        u'QSH': u'1.6777',
                        u'QTM': u'0.01',
                        u'RCN': u'10.0',
                        u'RDN': u'0.72096',
                        u'REP': u'0.025232',
                        u'REQ': u'5.6252',
                        u'RLC': u'0.9043',
                        u'RTE': u'78.672',
                        u'SAN': u'0.71147',
                        u'SEE': u'240.0',
                        u'SEN': u'90.91',
                        u'SNG': u'11.253',
                        u'SNT': u'9.2375',
                        u'SPK': u'6.802',
                        u'STJ': u'0.13234',
                        u'TKN': u'0.43903',
                        u'TNB': u'31.707',
                        u'TRX': u'34.395',
                        u'UTK': u'10.03',
                        u'UTN': u'85.715',
                        u'VEE': u'37.206',
                        u'VEN': u'0.0018',
                        u'VET': 0,
                        u'WAX': u'4.0537',
                        u'WPR': u'6.4415',
                        u'WTC': u'0.11687',
                        u'XLM': 0,
                        u'XMR': u'0.0001',
                        u'XRA': u'8.8236',
                        u'XRP': u'0.02',
                        u'XTZ': u'0.2',
                        u'XVG': u'0.5',
                        u'YGG': u'252.81',
                        u'YYW': u'8.4986',
                        u'ZCN': u'1.3689',
                        u'ZEC': u'0.001',
                        u'ZIL': u'9.8361',
                        u'ZRX': u'0.44642'}},
 'withdraw': {'ABYSS': 38.12,
              u'ADD': 0.0,
              u'AGI': 4.8161,
              u'AID': 5.1436,
              'AION': 0.71966,
              u'ANT': 0.44337,
              u'ATD': 0.0,
              'ATMI': 43.637,
              u'AUC': 5.1562,
              u'AVT': 0.92308,
              u'BAT': 1.3362,
              u'BBN': 33.427,
              u'BCH': 0.0001,
              u'BCI': 0.0,
              u'BFT': 9.1144,
              u'BNT': 0.2867,
              u'BOX': 36.638,
              u'BTC': 0.0004,
              u'BTG': 0.0,
              u'CBT': 22.791,
              u'CFI': 13.958,
              u'CND': 11.253,
              u'CNN': 1139.3,
              u'CSX': 2.1195,
              'CTXC': 1.1262,
              'DADI': 4.8285,
              u'DAI': 0.38514,
              'DASH': 0.01,
              'DATA': 8.2767,
              u'DGB': 0.0,
              u'DGX': 0.0070777,
              u'DRN': 1.2461,
              u'DTA': 128.58,
              u'DTH': 24.52,
              u'EDO': 0.26144,
              u'ELF': 1.2513,
              u'EOS': 0.0,
              u'ESS': 89.109,
              u'ETC': 0.01,
              u'ETH': 0.0018,
              u'ETP': 0.01,
              u'EVT': 171.46,
              u'FSN': 0.41462,
              u'FUN': 26.363,
              u'GNT': 2.2285,
              u'GOT': 0.57737,
              'Hydro Protocol': 38.97,
              u'INT': 10.871,
              'IOST': 31.602,
              'IOTA': 0.5,
              'IQ': 1.0,
              u'KNC': 0.91431,
              u'LRC': 2.8466,
              u'LTC': 0.001,
              u'LYM': 20.69,
              u'MAN': 1.4992,
              'MANA': 5.1432,
              u'MGO': 0.70727,
              'MITH': 1.4402,
              u'MKR': 0.00054308,
              u'MLN': 0.018,
              u'MTN': 13.58,
              u'MTO': 3872.9,
              'NCASH': 45.0,
              u'NEC': 0.83967,
              u'NEO': 0.0,
              u'NIO': 12.122,
              u'ODE': 1.7104,
              u'OMG': 0.11971,
              u'OMN': 0.0,
              'ORS Group': 9.4256,
              u'PAI': 0.5,
              u'PNK': 47.771,
              u'POA': 3.7449,
              'POLY': 1.2858,
              'QASH': 1.6777,
              'QTUM': 0.01,
              u'RCN': 10.0,
              u'RDN': 0.72096,
              u'REP': 0.025232,
              u'REQ': 5.6252,
              u'RLC': 0.9043,
              u'RTE': 78.672,
              u'SAN': 0.71147,
              'SEER': 240.0,
              u'SEN': 90.91,
              'SNGLS': 11.253,
              u'SNT': 9.2375,
              'SPANK': 6.802,
              'STORJ': 0.13234,
              u'TKN': 0.43903,
              u'TNB': 31.707,
              u'TRX': 34.395,
              u'UTK': 10.03,
              'UTNP': 85.715,
              u'VEE': 37.206,
              u'VEN': 0.0018,
              u'VET': 0.0,
              u'WAX': 4.0537,
              u'WPR': 6.4415,
              u'WTC': 0.11687,
              u'XLM': 0.0,
              u'XMR': 0.0001,
              u'XRA': 8.8236,
              u'XRP': 0.02,
              u'XTZ': 0.2,
              u'XVG': 0.5,
              u'YGG': 252.81,
              'YOYOW': 8.4986,
              u'ZCN': 1.3689,
              u'ZEC': 0.001,
              u'ZIL': 9.8361,
              u'ZRX': 0.44642}}
mbp:ccxt igorkroitor$
firepol commented 5 years ago

@kroitor you could actually reproduce the issue.

Sorry I think about the "double" I got confused because I searched the text and thought I found it 2 times, but it was actually only under "info", so forget about the duplicate...

The issue is: "HOT" should stay "HOT" instead of being modified to "Hydro Protocol". I mean I expect a short symbol, I coded a DB and I expect a symbol provided in CCXT shorter than 10 chars, one single word, uppercase. Why HOT is different and messing up my processing? I have to manually fix it myself like this:

    if exchange_name == 'bitfinex':
        for currency, fee in funding_fees['withdraw'].items():
            if currency == 'Hydro Protocol':
                currency = 'HOT'
            print(f'{currency}: {fee}') 
kroitor commented 5 years ago

Why HOT is different

Because there's two of them, HOT Hydro Protocol being many times smaller in market cap than HOT Holo.

and messing up my processing?

It is documented in the Manual:

Sometimes the user might notice a symbol like 'XBTM18' or '.XRPUSDM20180101' or some other "exotic/rare symbols". The symbol is not required to have a slash or to be a pair of currencies. The string in the symbol really depends on the type of the market (whether it is a spot market or a futures market, a darkpool market or an expired market, etc). Attempting to parse the symbol string is highly discouraged, one should not rely on the symbol format, it is recommended to use market properties instead.

You should not try to process symbols just use market['base'], market['quote'], market['baseId'] and market['quoteId'], treat a symbol as a whole (the entire string).

Duplicate: https://github.com/ccxt/ccxt/issues/3470

Hope this answers your questions )