checking kraken data for any rows not having a timestamp in the timestamp column, purging those

(there was a text in the 1st row of USDGEUR.csv, making the conversion fail previously)
This commit is contained in:
hippocritical
2025-06-08 14:07:31 +02:00
parent f2569e36e8
commit 985c15bdd9

View File

@@ -69,6 +69,10 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str):
trades = pd.concat(dfs, ignore_index=True)
del dfs
# drop any row not having a number in the column timestamp
timestamp_numeric = pd.to_numeric(trades["timestamp"], errors="coerce")
trades = trades[timestamp_numeric.notna() & (timestamp_numeric % 1 == 0)]
trades.loc[:, "timestamp"] = trades["timestamp"] * 1e3
trades.loc[:, "cost"] = trades["price"] * trades["amount"]
for col in DEFAULT_TRADES_COLUMNS: