Repository: rotki/rotki

Issue:
Fee assets is not properly handled in bitstamp
## Problem Definition

Fee assets is not correctly initialized in bitstamp with the possibility of raising a `UnknownAsset` error

## Logs

```
[17/08/2021 13:38:35 CEST] ERROR rotkehlchen.greenlets: Query history of bitstamp exchange died with exception: Unknown asset usdc provided..
Exception Name: <class 'rotkehlchen.errors.UnknownAsset'>
Exception Info: Unknown asset usdc provided.
Traceback:
   File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "rotkehlchen/exchanges/exchange.py", line 374, in query_history_with_callbacks
  File "rotkehlchen/utils/mixins/lockable.py", line 40, in wrapper
  File "rotkehlchen/exchanges/exchange.py", line 334, in query_deposits_withdrawals
  File "rotkehlchen/exchanges/bitstamp.py", line 266, in query_online_deposits_withdrawals
  File "rotkehlchen/exchanges/bitstamp.py", line 490, in _api_query_paginated
  File "rotkehlchen/exchanges/bitstamp.py", line 555, in _deserialize_asset_movement
  File "<string>", line 4, in __init__
  File "rotkehlchen/assets/asset.py", line 432, in __post_init__
  File "rotkehlchen/assets/resolver.py", line 57, in get_asset_data
```



Discussion:

Resolving patch:
diff --git a/rotkehlchen/exchanges/bitstamp.py b/rotkehlchen/exchanges/bitstamp.py
--- a/rotkehlchen/exchanges/bitstamp.py
+++ b/rotkehlchen/exchanges/bitstamp.py
@@ -552,7 +552,7 @@ def _deserialize_asset_movement(
         for symbol in BITSTAMP_ASSET_MOVEMENT_SYMBOLS:
             amount = deserialize_asset_amount(raw_movement.get(symbol, '0'))
             if amount != ZERO:
-                fee_asset = Asset(symbol)
+                fee_asset = asset_from_bitstamp(symbol)
                 break
 
         if amount == ZERO:


Test patch:
diff --git a/rotkehlchen/tests/exchanges/test_bitstamp.py b/rotkehlchen/tests/exchanges/test_bitstamp.py
--- a/rotkehlchen/tests/exchanges/test_bitstamp.py
+++ b/rotkehlchen/tests/exchanges/test_bitstamp.py
@@ -9,7 +9,7 @@
 
 from rotkehlchen.accounting.structures import Balance
 from rotkehlchen.assets.converters import asset_from_bitstamp
-from rotkehlchen.constants.assets import A_BTC, A_ETH, A_EUR, A_LINK, A_USD
+from rotkehlchen.constants.assets import A_BTC, A_ETH, A_EUR, A_LINK, A_USD, A_USDC
 from rotkehlchen.errors import RemoteError, UnknownAsset
 from rotkehlchen.exchanges.bitstamp import (
     API_ERR_AUTH_NONCE_CODE,
@@ -861,6 +861,33 @@ def test_deserialize_asset_movement_deposit(mock_bitstamp):
     expected_movement = mock_bitstamp._deserialize_asset_movement(raw_movement)
     assert movement == expected_movement
 
+    raw_movement = {
+        'id': 3,
+        'type': '0',
+        'datetime': '2018-03-21 06:46:06.559877',
+        'btc': '0',
+        'usd': '0.00000000',
+        'btc_usd': '0.00',
+        'fee': '0.1',
+        'order_id': 2,
+        'usdc': '1000.51',
+    }
+    asset = A_USDC
+    movement = AssetMovement(
+        timestamp=1521614766,
+        location=Location.BITSTAMP,
+        category=AssetMovementCategory.DEPOSIT,
+        address=None,
+        transaction_id=None,
+        asset=asset,
+        amount=FVal('1000.51'),
+        fee_asset=asset,
+        fee=Fee(FVal('0.1')),
+        link='3',
+    )
+    expected_movement = mock_bitstamp._deserialize_asset_movement(raw_movement)
+    assert movement == expected_movement
+
 
 def test_deserialize_asset_movement_withdrawal(mock_bitstamp):
     raw_movement = {