Repository: rotki/rotki

Issue:
New coin request for manual balance asset list
Hi there,

I have a few coins in my portfolio which aren't currently available in the manual asset list, I was wondering if it's possible to add them in?

The coins are:
XOR (ERC20 Sora)
BAN (Banano)
VTHO (VeChain)
KCS (ERC20 KuCoin)
BAO (ERC20 Bao Finance)
EWT (EnergyWeb)
GUNTHY (ERC20)

If any/all of these could be added that would be awesome, it's the last thing holding me back from switching to Rotki as my sole portfolio manager! Will be buying premium this week either way, thanks for that hard work!


Discussion:

Resolving patch:
diff --git a/rotkehlchen/exchanges/kucoin.py b/rotkehlchen/exchanges/kucoin.py
--- a/rotkehlchen/exchanges/kucoin.py
+++ b/rotkehlchen/exchanges/kucoin.py
@@ -166,10 +166,10 @@ def __init__(
     ):
         super().__init__(str(Location.KUCOIN), api_key, secret, database)
         self.base_uri = base_uri
+        self.api_passphrase = passphrase
         self.session.headers.update({
             'Content-Type': 'application/json',
             'KC-API-KEY': self.api_key,
-            'KC-API-PASSPHRASE': passphrase,
             'KC-API-KEY-VERSION': '2',
         })
         self.msg_aggregator = msg_aggregator
@@ -184,7 +184,7 @@ def _api_query(
         May raise RemoteError
         """
         call_options = options.copy() if options else {}
-        for header in ('KC-API-SIGN', 'KC-API-TIMESTAMP'):
+        for header in ('KC-API-SIGN', 'KC-API-TIMESTAMP', 'KC-API-PASSPHRASE'):
             self.session.headers.pop(header, None)
 
         if case == KucoinCase.BALANCES:
@@ -217,9 +217,15 @@ def _api_query(
                     digestmod=hashlib.sha256,
                 ).digest(),
             ).decode('utf-8')
+            passphrase = base64.b64encode(hmac.new(
+                self.secret,
+                self.api_passphrase.encode('utf-8'),
+                hashlib.sha256,
+            ).digest()).decode('utf-8')
             self.session.headers.update({
                 'KC-API-SIGN': signature,
                 'KC-API-TIMESTAMP': timestamp,
+                'KC-API-PASSPHRASE': passphrase,
             })
             log.debug('Kucoin API request', request_url=request_url)
             try:


Test patch:
diff --git a/rotkehlchen/tests/exchanges/test_kucoin.py b/rotkehlchen/tests/exchanges/test_kucoin.py
--- a/rotkehlchen/tests/exchanges/test_kucoin.py
+++ b/rotkehlchen/tests/exchanges/test_kucoin.py
@@ -449,6 +449,7 @@ def test_deserialize_asset_movement_skipped(mock_kucoin, start_ts, end_ts, is_in
     assert reason == skip_reason
 
 
+@pytest.mark.skip('Fails with status code: 404 and text: KC-API-KEY not exists')
 @pytest.mark.parametrize('should_mock_current_price_queries', [True])
 def test_query_balances_sandbox(sandbox_kuckoin, inquirer):  # pylint: disable=unused-argument
     assets_balance, msg = sandbox_kuckoin.query_balances()
@@ -473,6 +474,7 @@ def test_query_balances_sandbox(sandbox_kuckoin, inquirer):  # pylint: disable=u
     assert msg == ''
 
 
+@pytest.mark.skip('Fails with status code: 404 and text: KC-API-KEY not exists')
 @pytest.mark.parametrize('should_mock_current_price_queries', [True])
 def test_query_trades_sandbox(sandbox_kuckoin, inquirer):  # pylint: disable=unused-argument
     """The sandbox account has 6 trades. Below a list of the trades and their
diff --git a/rotkehlchen/tests/unit/test_assets.py b/rotkehlchen/tests/unit/test_assets.py
--- a/rotkehlchen/tests/unit/test_assets.py
+++ b/rotkehlchen/tests/unit/test_assets.py
@@ -191,7 +191,7 @@ def test_coingecko_identifiers_are_reachable(data_dir):
 def test_assets_json_meta():
     """Test that all_assets.json md5 matches and that if md5 changes since last
     time then version is also bumped"""
-    last_meta = {'md5': 'fd5a4a1edd5d3c6f591734da0e8ce62c', 'version': 60}
+    last_meta = {'md5': '6a8dba71c678a7541bd0352e6ec05c4c', 'version': 61}
     data_dir = Path(__file__).resolve().parent.parent.parent / 'data'
     data_md5 = file_md5(data_dir / 'all_assets.json')