Repository: rotki/rotki

Issue:
Some NEXO entries in CSV have different datetime format
## Problem Definition

A user provided a screenshot

![image](https://user-images.githubusercontent.com/5068010/120938770-df9fd780-c714-11eb-82ec-89a96950fbeb.png)

where the date seems to include also seconds in the format. This is something different from what we had so I suspect that depending on region or something the format might be different

Operating system: 
Rotki version: 1.17.2



Discussion:
All right, we can work with that, but if it depends on some settings on the Nexo side perhaps it's also possible for them to configure nexo to export a CSV that v1.17.2 can read?
I will investigate more tomorrow asking to out users. Just didn't want to forget this
The user that gave me the data confirmed that was an error when providing me the information and indeed the time column includes seconds

Resolving patch:
diff --git a/rotkehlchen/data/importer.py b/rotkehlchen/data/importer.py
--- a/rotkehlchen/data/importer.py
+++ b/rotkehlchen/data/importer.py
@@ -797,7 +797,7 @@ def _consume_nexo(self, csv_row: Dict[str, Any]) -> None:
         if 'rejected' not in csv_row['Details']:
             timestamp = deserialize_timestamp_from_date(
                 date=csv_row['Date / Time'],
-                formatstr='%Y-%m-%d %H:%M',
+                formatstr='%Y-%m-%d %H:%M:%S',
                 location='NEXO',
             )
         else:


Test patch:
diff --git a/rotkehlchen/tests/data/nexo.csv b/rotkehlchen/tests/data/nexo.csv
--- a/rotkehlchen/tests/data/nexo.csv
+++ b/rotkehlchen/tests/data/nexo.csv
@@ -1,14 +1,14 @@
 Transaction,Type,Currency,Amount,USD Equivalent,Details,Outstanding Loan,Date / Time
-NXT0000000001,LockingTermDeposit,USDC,-1,$1.1226435,approved / Transfer from Savings Wallet to Term Wallet,$0.00,2021-03-06 09:51
-NXT0000000002,Interest,USDC,1,$1.16806918161,approved / USDC Interest Earned,$0.00,2021-03-06 01:20
-NXT0000000003,ExchangeDepositedOn,EUR,10,$15.1411,approved / EUR,$0.00,2021-02-26 19:09
-NXT0000000004,DepositToExchange,EUR,100,$120.1509,approved / EUR Top Up,$0.00,2021-02-26 14:58
-NXT0000000005,WithdrawExchanged,EUR,-2000.79,$2500.63591346,approved / EUR Withdrawal,$0.00,2020-12-16 15:09
-NXT0000000006,ExchangeToWithdraw,USDC,-2000.79,$2500.5364681,approved / User,$0.00,2020-12-16 21:18
-NXT0000000007,Dividend,NEXO,10.3585507,$3.43448965222,approved / Loyalty Dividend,$0.00,2020-08-15 12:01
-NXT0000000008,ExchangeToWithdraw,USDC,-2000,$2500.5,rejected / USER,$0.00,2020-08-15 01:10
-NXT0000000009,Dividend,NEXO,22.5653042,$16.0708424630,approved / Base Dividend,$0.00,2019-08-15 17:01
-NXT0000000010,ExchangeDepositedOn,EUR,10000,$11174.47,approved / USDC,$0.00,2019-08-15 23:47
-NXT0000000011,Deposit,NEXO,1.00001,$5487.0248909704,approved / 0x999999999849662f1106541b0d2e78be4445e6d8d870ac8616a3cf79de969c9b,$0.00,2019-05-24 17:50
-NXT0000000012,Withdrawal,BTC,-0.9995,$5574.2115,approved / BTC withdrawal,$0.00,2019-04-24 16:18
-NXT0000000013,Deposit,BTC,1,$5579.7,approved / 3699999999999999999999999,$0.00,2019-04-24 14:42
\ No newline at end of file
+NXT0000000001,LockingTermDeposit,USDC,-1,$1.1226435,approved / Transfer from Savings Wallet to Term Wallet,$0.00,2021-03-06 09:51:54
+NXT0000000002,Interest,USDC,1,$1.16806918161,approved / USDC Interest Earned,$0.00,2021-03-06 01:20:20
+NXT0000000003,ExchangeDepositedOn,EUR,10,$15.1411,approved / EUR,$0.00,2021-02-26 19:09:00
+NXT0000000004,DepositToExchange,EUR,100,$120.1509,approved / EUR Top Up,$0.00,2021-02-26 14:58:12
+NXT0000000005,WithdrawExchanged,EUR,-2000.79,$2500.63591346,approved / EUR Withdrawal,$0.00,2020-12-16 15:09:24
+NXT0000000006,ExchangeToWithdraw,USDC,-2000.79,$2500.5364681,approved / User,$0.00,2020-12-16 21:18:33
+NXT0000000007,Dividend,NEXO,10.3585507,$3.43448965222,approved / Loyalty Dividend,$0.00,2020-08-15 12:01:55
+NXT0000000008,ExchangeToWithdraw,USDC,-2000,$2500.5,rejected / USER,$0.00,2020-08-15 01:10:12
+NXT0000000009,Dividend,NEXO,22.5653042,$16.0708424630,approved / Base Dividend,$0.00,2019-08-15 17:01:04
+NXT0000000010,ExchangeDepositedOn,EUR,10000,$11174.47,approved / USDC,$0.00,2019-08-15 23:47:01
+NXT0000000011,Deposit,NEXO,1.00001,$5487.0248909704,approved / 0x999999999849662f1106541b0d2e78be4445e6d8d870ac8616a3cf79de969c9b,$0.00,2019-05-24 17:50:10
+NXT0000000012,Withdrawal,BTC,-0.9995,$5574.2115,approved / BTC withdrawal,$0.00,2019-04-24 16:18:19
+NXT0000000013,Deposit,BTC,1,$5579.7,approved / 3699999999999999999999999,$0.00,2019-04-24 14:42:44
\ No newline at end of file
diff --git a/rotkehlchen/tests/utils/dataimport.py b/rotkehlchen/tests/utils/dataimport.py
--- a/rotkehlchen/tests/utils/dataimport.py
+++ b/rotkehlchen/tests/utils/dataimport.py
@@ -481,7 +481,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
 
     expected_actions = [LedgerAction(
         identifier=3,
-        timestamp=Timestamp(1565888460),
+        timestamp=Timestamp(1565888464),
         action_type=LedgerActionType.INCOME,
         location=Location.NEXO,
         amount=AssetAmount(FVal('22.5653042')),
@@ -492,7 +492,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
         notes='Dividend from Nexo',
     ), LedgerAction(
         identifier=2,
-        timestamp=Timestamp(1597492860),
+        timestamp=Timestamp(1597492915),
         action_type=LedgerActionType.INCOME,
         location=Location.NEXO,
         amount=AssetAmount(FVal('10.3585507')),
@@ -503,7 +503,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
         notes='Dividend from Nexo',
     ), LedgerAction(
         identifier=1,
-        timestamp=Timestamp(1614993600),
+        timestamp=Timestamp(1614993620),
         action_type=LedgerActionType.INCOME,
         location=Location.NEXO,
         amount=AssetAmount(FVal('1')),
@@ -517,7 +517,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     expected_movements = [AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.DEPOSIT,
-        timestamp=Timestamp(1556116920),
+        timestamp=Timestamp(1556116964),
         address=None,
         transaction_id=None,
         asset=A_BTC,
@@ -528,7 +528,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     ), AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.WITHDRAWAL,
-        timestamp=Timestamp(1556122680),
+        timestamp=Timestamp(1556122699),
         address=None,
         transaction_id=None,
         asset=A_BTC,
@@ -539,7 +539,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     ), AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.DEPOSIT,
-        timestamp=Timestamp(1558720200),
+        timestamp=Timestamp(1558720210),
         address=None,
         transaction_id=None,
         asset=symbol_to_asset_or_token('NEXO'),
@@ -550,7 +550,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     ), AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.DEPOSIT,
-        timestamp=Timestamp(1565912820),
+        timestamp=Timestamp(1565912821),
         address=None,
         transaction_id=None,
         asset=A_EUR,
@@ -561,7 +561,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     ), AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.WITHDRAWAL,
-        timestamp=Timestamp(1608131340),
+        timestamp=Timestamp(1608131364),
         address=None,
         transaction_id=None,
         asset=A_EUR,
@@ -583,7 +583,7 @@ def assert_nexo_results(rotki: Rotkehlchen):
     ), AssetMovement(
         location=Location.NEXO,
         category=AssetMovementCategory.DEPOSIT,
-        timestamp=Timestamp(1615024260),
+        timestamp=Timestamp(1615024314),
         address=None,
         transaction_id=None,
         asset=symbol_to_asset_or_token('USDC'),
@@ -592,5 +592,6 @@ def assert_nexo_results(rotki: Rotkehlchen):
         fee=Fee(ZERO),
         link='NXT0000000001',
     )]
+
     assert ledger_actions == expected_actions
     assert asset_movements == expected_movements