prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Changing fiat currency does not change manually tracked balances value column title
  ## Problem Definition
  
  Seen in v1.4.0 by @cryptomole1
  
  Changing the FIAT currency via the drop-down menu if the user has manually tracked balances changes the value but not the title of the column. The title of the column is stuck to being `USD Value`.
  
  I can confirm the problem, just tested it.
  
  ## Task
  
  - Fix it
  - Write a unit test
  
  </issue>
  <code>
  [start of rotkehlchen/balances/manual.py]
  1 from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional
  2 
  3 from rotkehlchen.assets.asset import Asset
  4 from rotkehlchen.errors import InputError
  5 from rotkehlchen.fval import FVal
  6 from rotkehlchen.inquirer import Inquirer
  7 from rotkehlchen.typing import Location
  8 
  9 if TYPE_CHECKING:
  10     from rotkehlchen.db.dbhandler import DBHandler
  11 
  12 
  13 class ManuallyTrackedBalance(NamedTuple):
  14     asset: Asset
  15     label: str
  16     amount: FVal
  17     location: Location
  18     tags: Optional[List[str]]
  19 
  20 
  21 class ManuallyTrackedBalanceWithValue(NamedTuple):
  22     # NamedTuples can't use inheritance. Make sure this has same fields as
  23     # ManuallyTrackedBalance until usd_value
  24     asset: Asset
  25     label: str
  26     amount: FVal
  27     location: Location
  28     tags: Optional[List[str]]
  29     usd_value: FVal
  30 
  31 
  32 def get_manually_tracked_balances(db: 'DBHandler') -> List[ManuallyTrackedBalanceWithValue]:
  33     """Gets the manually tracked balances
  34 
  35     May raise:
  36     - RemoteError if there is a problem querying for the current price of an asset
  37     """
  38     balances = db.get_manually_tracked_balances()
  39     balances_with_value = []
  40     for entry in balances:
  41         price = Inquirer().find_usd_price(entry.asset)
  42         # https://github.com/python/mypy/issues/2582 --> for the type ignore below
  43         balances_with_value.append(ManuallyTrackedBalanceWithValue(  # type: ignore
  44             **entry._asdict(),
  45             usd_value=price * entry.amount,
  46         ))
  47 
  48     return balances_with_value
  49 
  50 
  51 def add_manually_tracked_balances(
  52         db: 'DBHandler',
  53         data: List[ManuallyTrackedBalance],
  54 ) -> None:
  55     """Adds manually tracked balances
  56 
  57     May raise:
  58     - InputError if any of the given balance entry labels already exist in the DB
  59     - TagConstraintError if any of the given manually tracked balances contain unknown tags.
  60     """
  61     if len(data) == 0:
  62         raise InputError('Empty list of manually tracked balances to add was given')
  63     db.ensure_tags_exist(
  64         given_data=data,
  65         action='adding',
  66         data_type='manually tracked balances',
  67     )
  68     db.add_manually_tracked_balances(data=data)
  69 
  70 
  71 def edit_manually_tracked_balances(db: 'DBHandler', data: List[ManuallyTrackedBalance]) -> None:
  72     """Edits manually tracked balances
  73 
  74     May raise:
  75     - InputError if the given balances list is empty or if
  76     any of the balance entry labels to edit do not exist in the DB.
  77     - TagConstraintError if any of the given balance data contain unknown tags.
  78     """
  79     if len(data) == 0:
  80         raise InputError('Empty list of manually tracked balances to edit was given')
  81     db.ensure_tags_exist(
  82         given_data=data,
  83         action='editing',
  84         data_type='manually tracked balances',
  85     )
  86     db.edit_manually_tracked_balances(data)
  87 
  88 
  89 def account_for_manually_tracked_balances(
  90         db: 'DBHandler',
  91         balances: Dict[str, Any],
  92 ) -> Dict[str, Any]:
  93     """Given the big balances mapping adds to it all manually tracked balances"""
  94     manually_tracked_balances = get_manually_tracked_balances(db)
  95     for m_entry in manually_tracked_balances:
  96         location_str = str(m_entry.location)
  97         if location_str not in balances:
  98             balances[location_str] = {}
  99             balances[location_str][m_entry.asset.identifier] = {
  100                 'amount': m_entry.amount,
  101                 'usd_value': m_entry.usd_value,
  102             }
  103         else:
  104             if m_entry.asset.identifier not in balances[location_str]:
  105                 balances[location_str][m_entry.asset.identifier] = {
  106                     'amount': m_entry.amount,
  107                     'usd_value': m_entry.usd_value,
  108                 }
  109             else:
  110                 old_amount = balances[location_str][m_entry.asset.identifier]['amount']
  111                 old_usd_value = balances[location_str][m_entry.asset.identifier]['usd_value']
  112                 balances[location_str][m_entry.asset.identifier] = {
  113                     'amount': old_amount + m_entry.amount,
  114                     'usd_value': old_usd_value + m_entry.usd_value,
  115                 }
  116 
  117     return balances
  118
  [end of rotkehlchen/balances/manual.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/rotkehlchen/balances/manual.py b/rotkehlchen/balances/manual.py
  --- a/rotkehlchen/balances/manual.py
  +++ b/rotkehlchen/balances/manual.py
  @@ -1,10 +1,11 @@
   from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional
   
   from rotkehlchen.assets.asset import Asset
  -from rotkehlchen.errors import InputError
  +from rotkehlchen.constants.misc import ZERO
  +from rotkehlchen.errors import InputError, RemoteError
   from rotkehlchen.fval import FVal
   from rotkehlchen.inquirer import Inquirer
  -from rotkehlchen.typing import Location
  +from rotkehlchen.typing import Location, Price
   
   if TYPE_CHECKING:
       from rotkehlchen.db.dbhandler import DBHandler
  @@ -30,15 +31,18 @@
   
   
   def get_manually_tracked_balances(db: 'DBHandler') -> List[ManuallyTrackedBalanceWithValue]:
  -    """Gets the manually tracked balances
  -
  -    May raise:
  -    - RemoteError if there is a problem querying for the current price of an asset
  -    """
  +    """Gets the manually tracked balances"""
       balances = db.get_manually_tracked_balances()
       balances_with_value = []
       for entry in balances:
  -        price = Inquirer().find_usd_price(entry.asset)
  +        try:
  +            price = Inquirer().find_usd_price(entry.asset)
  +        except RemoteError as e:
  +            db.msg_aggregator.add_warning(
  +                f'Could not find price for {entry.asset.identifier} during '
  +                f'manually tracked balance querying due to {str(e)}',
  +            )
  +            price = Price(ZERO)
           # https://github.com/python/mypy/issues/2582 --> for the type ignore below
           balances_with_value.append(ManuallyTrackedBalanceWithValue(  # type: ignore
               **entry._asdict(),
  
verification_info: {"golden_diff": "diff --git a/rotkehlchen/balances/manual.py b/rotkehlchen/balances/manual.py\n--- a/rotkehlchen/balances/manual.py\n+++ b/rotkehlchen/balances/manual.py\n@@ -1,10 +1,11 @@\n from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional\n \n from rotkehlchen.assets.asset import Asset\n-from rotkehlchen.errors import InputError\n+from rotkehlchen.constants.misc import ZERO\n+from rotkehlchen.errors import InputError, RemoteError\n from rotkehlchen.fval import FVal\n from rotkehlchen.inquirer import Inquirer\n-from rotkehlchen.typing import Location\n+from rotkehlchen.typing import Location, Price\n \n if TYPE_CHECKING:\n     from rotkehlchen.db.dbhandler import DBHandler\n@@ -30,15 +31,18 @@\n \n \n def get_manually_tracked_balances(db: 'DBHandler') -> List[ManuallyTrackedBalanceWithValue]:\n-    \"\"\"Gets the manually tracked balances\n-\n-    May raise:\n-    - RemoteError if there is a problem querying for the current price of an asset\n-    \"\"\"\n+    \"\"\"Gets the manually tracked balances\"\"\"\n     balances = db.get_manually_tracked_balances()\n     balances_with_value = []\n     for entry in balances:\n-        price = Inquirer().find_usd_price(entry.asset)\n+        try:\n+            price = Inquirer().find_usd_price(entry.asset)\n+        except RemoteError as e:\n+            db.msg_aggregator.add_warning(\n+                f'Could not find price for {entry.asset.identifier} during '\n+                f'manually tracked balance querying due to {str(e)}',\n+            )\n+            price = Price(ZERO)\n         # https://github.com/python/mypy/issues/2582 --> for the type ignore below\n         balances_with_value.append(ManuallyTrackedBalanceWithValue(  # type: ignore\n             **entry._asdict(),\n", "issue": "Changing fiat currency does not change manually tracked balances value column title\n## Problem Definition\r\n\r\nSeen in v1.4.0 by @cryptomole1\r\n\r\nChanging the FIAT currency via the drop-down menu if the user has manually tracked balances changes the value but not the title of the column. The title of the column is stuck to being `USD Value`.\r\n\r\nI can confirm the problem, just tested it.\r\n\r\n## Task\r\n\r\n- Fix it\r\n- Write a unit test\n", "before_files": [{"content": "from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional\n\nfrom rotkehlchen.assets.asset import Asset\nfrom rotkehlchen.errors import InputError\nfrom rotkehlchen.fval import FVal\nfrom rotkehlchen.inquirer import Inquirer\nfrom rotkehlchen.typing import Location\n\nif TYPE_CHECKING:\n    from rotkehlchen.db.dbhandler import DBHandler\n\n\nclass ManuallyTrackedBalance(NamedTuple):\n    asset: Asset\n    label: str\n    amount: FVal\n    location: Location\n    tags: Optional[List[str]]\n\n\nclass ManuallyTrackedBalanceWithValue(NamedTuple):\n    # NamedTuples can't use inheritance. Make sure this has same fields as\n    # ManuallyTrackedBalance until usd_value\n    asset: Asset\n    label: str\n    amount: FVal\n    location: Location\n    tags: Optional[List[str]]\n    usd_value: FVal\n\n\ndef get_manually_tracked_balances(db: 'DBHandler') -> List[ManuallyTrackedBalanceWithValue]:\n    \"\"\"Gets the manually tracked balances\n\n    May raise:\n    - RemoteError if there is a problem querying for the current price of an asset\n    \"\"\"\n    balances = db.get_manually_tracked_balances()\n    balances_with_value = []\n    for entry in balances:\n        price = Inquirer().find_usd_price(entry.asset)\n        # https://github.com/python/mypy/issues/2582 --> for the type ignore below\n        balances_with_value.append(ManuallyTrackedBalanceWithValue(  # type: ignore\n            **entry._asdict(),\n            usd_value=price * entry.amount,\n        ))\n\n    return balances_with_value\n\n\ndef add_manually_tracked_balances(\n        db: 'DBHandler',\n        data: List[ManuallyTrackedBalance],\n) -> None:\n    \"\"\"Adds manually tracked balances\n\n    May raise:\n    - InputError if any of the given balance entry labels already exist in the DB\n    - TagConstraintError if any of the given manually tracked balances contain unknown tags.\n    \"\"\"\n    if len(data) == 0:\n        raise InputError('Empty list of manually tracked balances to add was given')\n    db.ensure_tags_exist(\n        given_data=data,\n        action='adding',\n        data_type='manually tracked balances',\n    )\n    db.add_manually_tracked_balances(data=data)\n\n\ndef edit_manually_tracked_balances(db: 'DBHandler', data: List[ManuallyTrackedBalance]) -> None:\n    \"\"\"Edits manually tracked balances\n\n    May raise:\n    - InputError if the given balances list is empty or if\n    any of the balance entry labels to edit do not exist in the DB.\n    - TagConstraintError if any of the given balance data contain unknown tags.\n    \"\"\"\n    if len(data) == 0:\n        raise InputError('Empty list of manually tracked balances to edit was given')\n    db.ensure_tags_exist(\n        given_data=data,\n        action='editing',\n        data_type='manually tracked balances',\n    )\n    db.edit_manually_tracked_balances(data)\n\n\ndef account_for_manually_tracked_balances(\n        db: 'DBHandler',\n        balances: Dict[str, Any],\n) -> Dict[str, Any]:\n    \"\"\"Given the big balances mapping adds to it all manually tracked balances\"\"\"\n    manually_tracked_balances = get_manually_tracked_balances(db)\n    for m_entry in manually_tracked_balances:\n        location_str = str(m_entry.location)\n        if location_str not in balances:\n            balances[location_str] = {}\n            balances[location_str][m_entry.asset.identifier] = {\n                'amount': m_entry.amount,\n                'usd_value': m_entry.usd_value,\n            }\n        else:\n            if m_entry.asset.identifier not in balances[location_str]:\n                balances[location_str][m_entry.asset.identifier] = {\n                    'amount': m_entry.amount,\n                    'usd_value': m_entry.usd_value,\n                }\n            else:\n                old_amount = balances[location_str][m_entry.asset.identifier]['amount']\n                old_usd_value = balances[location_str][m_entry.asset.identifier]['usd_value']\n                balances[location_str][m_entry.asset.identifier] = {\n                    'amount': old_amount + m_entry.amount,\n                    'usd_value': old_usd_value + m_entry.usd_value,\n                }\n\n    return balances\n", "path": "rotkehlchen/balances/manual.py"}]}