Repository: rotki/rotki

Issue:
Binance.us balance query fails due to absence of lending and futures api there
## Problem Definition

@VoR0220 reported that Binance.us balance query does not work. The error looks like this:

```
[07/01/2021 10:06:59 MST] ERROR rotkehlchen.user_messages: binance_us account API request failed. Could not reach binance due to binance_us API request https://api.binance.us/sapi/v1/lending/union/account?recvWindow=10000&timestamp=1610039219559&signature=XXX for lending/union/account failed with HTTP status code: 500, error code: -1000 and error message: An unknown error occurred while processing the request.
```

## Task

Fix it. The fix should be as simple as:

Here:

https://github.com/rotki/rotki/blob/400091302f7c147bd1f90559679ccc250f9f0e67/rotkehlchen/exchanges/binance.py#L662-L665

Do:

```diff
-            returned_balances = self._query_lending_balances(returned_balances)
-            returned_balances = self._query_cross_collateral_futures_balances(returned_balances)
-            returned_balances = self._query_margined_futures_balances('fapi', returned_balances)
-            returned_balances = self._query_margined_futures_balances('dapi', returned_balances)
+           if self.name != str(Location.BINANCE_US):
+                returned_balances = self._query_lending_balances(returned_balances)
+                returned_balances = self._query_cross_collateral_futures_balances(returned_balances)
+                returned_balances = self._query_margined_futures_balances('fapi', returned_balances)
+                returned_balances = self._query_margined_futures_balances('dapi', returned_balances)
```


Discussion:
Hey @VoR0220 you told me you would do this. Would be nice to have it for the next release which will be done this week. If you can't do this, then just let me know and I can do it myself quickly.

Resolving patch:
diff --git a/rotkehlchen/exchanges/binance.py b/rotkehlchen/exchanges/binance.py
--- a/rotkehlchen/exchanges/binance.py
+++ b/rotkehlchen/exchanges/binance.py
@@ -659,10 +659,12 @@ def query_balances(self) -> Tuple[Optional[Dict], str]:
             self.first_connection()
             returned_balances: Dict = {}
             returned_balances = self._query_spot_balances(returned_balances)
-            returned_balances = self._query_lending_balances(returned_balances)
-            returned_balances = self._query_cross_collateral_futures_balances(returned_balances)
-            returned_balances = self._query_margined_futures_balances('fapi', returned_balances)
-            returned_balances = self._query_margined_futures_balances('dapi', returned_balances)
+            if self.name != str(Location.BINANCE_US):
+                returned_balances = self._query_lending_balances(returned_balances)
+                returned_balances = self._query_cross_collateral_futures_balances(returned_balances)  # noqa: E501
+                returned_balances = self._query_margined_futures_balances('fapi', returned_balances)  # noqa: E501
+                returned_balances = self._query_margined_futures_balances('dapi', returned_balances)  # noqa: E501
+
         except RemoteError as e:
             msg = (
                 f'{self.name} account API request failed. '


Test patch: