Repository: rotki/rotki

Issue:
Binance.US seems to not support fiat payments endpoint
## Problem Definition

A Binance.us user sees this error

```
Failed query for Binance US: Error: Binance US Main API request https://api.binance.us/sapi/v1/fiat/payments?timestamp=1635681866105&startTime=1500001200000&endTime=1507777199999&transactionType=0&recvWindow=10000&signature=b2aff0da1dc9bf967e3f2d999a8be7b042c09326762179a2d214fc86b73dc4a7 for fiat/payments failed with HTTP status code: 404, error code: no code found and error message: no message found
```

## Task

That probably means that binance.us does not support this endpoint. We should take this into account


Discussion:

Resolving patch:
diff --git a/rotkehlchen/exchanges/binance.py b/rotkehlchen/exchanges/binance.py
--- a/rotkehlchen/exchanges/binance.py
+++ b/rotkehlchen/exchanges/binance.py
@@ -919,6 +919,9 @@ def query_online_trade_history(
         return trades, (start_ts, end_ts)
 
     def _query_online_fiat_payments(self, start_ts: Timestamp, end_ts: Timestamp) -> List[Trade]:
+        if self.location == Location.BINANCEUS:
+            return []  # dont exist for Binance US: https://github.com/rotki/rotki/issues/3664
+
         fiat_buys = self._api_query_list_within_time_delta(
             start_ts=start_ts,
             end_ts=end_ts,
@@ -1227,24 +1230,28 @@ def query_online_deposits_withdrawals(
         )
         log.debug(f'{self.name} withdraw history result', results_num=len(withdraws))
 
-        fiat_deposits = self._api_query_list_within_time_delta(
-            start_ts=Timestamp(0),
-            end_ts=end_ts,
-            time_delta=API_TIME_INTERVAL_CONSTRAINT_TS,
-            api_type='sapi',
-            method='fiat/orders',
-            additional_options={'transactionType': 0},
-        )
-        log.debug(f'{self.name} fiat deposit history result', results_num=len(fiat_deposits))
-        fiat_withdraws = self._api_query_list_within_time_delta(
-            start_ts=Timestamp(0),
-            end_ts=end_ts,
-            time_delta=API_TIME_INTERVAL_CONSTRAINT_TS,
-            api_type='sapi',
-            method='fiat/orders',
-            additional_options={'transactionType': 1},
-        )
-        log.debug(f'{self.name} fiat withdraw history result', results_num=len(fiat_withdraws))
+        if self.location != Location.BINANCEUS:
+            # dont exist for Binance US: https://github.com/rotki/rotki/issues/3664
+            fiat_deposits = self._api_query_list_within_time_delta(
+                start_ts=Timestamp(0),
+                end_ts=end_ts,
+                time_delta=API_TIME_INTERVAL_CONSTRAINT_TS,
+                api_type='sapi',
+                method='fiat/orders',
+                additional_options={'transactionType': 0},
+            )
+            log.debug(f'{self.name} fiat deposit history result', results_num=len(fiat_deposits))
+            fiat_withdraws = self._api_query_list_within_time_delta(
+                start_ts=Timestamp(0),
+                end_ts=end_ts,
+                time_delta=API_TIME_INTERVAL_CONSTRAINT_TS,
+                api_type='sapi',
+                method='fiat/orders',
+                additional_options={'transactionType': 1},
+            )
+            log.debug(f'{self.name} fiat withdraw history result', results_num=len(fiat_withdraws))
+        else:
+            fiat_deposits = fiat_withdraws = []
 
         movements = []
         for raw_movement in deposits + withdraws:


Test patch: