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:
@@ -69,6 +69,10 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str):
|
|||||||
trades = pd.concat(dfs, ignore_index=True)
|
trades = pd.concat(dfs, ignore_index=True)
|
||||||
del dfs
|
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[:, "timestamp"] = trades["timestamp"] * 1e3
|
||||||
trades.loc[:, "cost"] = trades["price"] * trades["amount"]
|
trades.loc[:, "cost"] = trades["price"] * trades["amount"]
|
||||||
for col in DEFAULT_TRADES_COLUMNS:
|
for col in DEFAULT_TRADES_COLUMNS:
|
||||||
|
|||||||
Reference in New Issue
Block a user