From 326620eee64489aac1cbcf1cb63b74f9112322f5 Mon Sep 17 00:00:00 2001 From: Patrik Lilja Date: Sun, 24 Mar 2019 16:50:46 +0100 Subject: [PATCH] Process trades on same minute in correct order The input file from Cointracking is specified from newest to oldest. Hence we should reverse the list before sorting by date for items on the same minute to occur in correct order. --- taxdata.py | 1 + 1 file changed, 1 insertion(+) diff --git a/taxdata.py b/taxdata.py index 0d5b958..9c68308 100644 --- a/taxdata.py +++ b/taxdata.py @@ -124,6 +124,7 @@ def indices(col_name): trades.append(trade) lineno += 1 + trades.reverse() trades.sort(key=lambda x: x.date) return Trades(trades)