From e24d5afb95723a9effaee5915e68041f93c86170 Mon Sep 17 00:00:00 2001 From: working4coins Date: Sat, 15 Jul 2023 11:50:05 +0200 Subject: [PATCH 1/3] Update data_reader.py Make AssertionError more explicit --- blankly/data/data_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blankly/data/data_reader.py b/blankly/data/data_reader.py index 45c11b77..79c9cf15 100644 --- a/blankly/data/data_reader.py +++ b/blankly/data/data_reader.py @@ -130,7 +130,7 @@ def _parse_csv_prices(self, file_paths: list, symbols: list, columns: set) -> No self._check_length(contents, file_paths[index]) # Check if its contained - assert (columns.issubset(contents.columns)) + assert (columns.issubset(contents.columns)), f"{columns} not subset of {contents.columns}" # Now push it directly into the dataset and sort by time self._internal_dataset[symbols[index]] = contents.sort_values('time') From 821b138a3e3a2c3b9aa66ed061c7631398c6f188 Mon Sep 17 00:00:00 2001 From: working4coins Date: Sat, 15 Jul 2023 12:34:47 +0200 Subject: [PATCH 2/3] Update data_reader.py --- blankly/data/data_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blankly/data/data_reader.py b/blankly/data/data_reader.py index 79c9cf15..c9d1e139 100644 --- a/blankly/data/data_reader.py +++ b/blankly/data/data_reader.py @@ -111,7 +111,7 @@ def _parse_df_prices(self, file_paths: list, symbols: list, columns: set) -> Non self._check_length(file_paths[index], file_paths[index]) # Check if its contained - assert (columns.issubset(file_paths[index].columns)) + assert (columns.issubset(file_paths[index].columns)), f"{columns} not subset of {file_paths[index].columns}" # Now push it directly into the dataset and sort by time self._internal_dataset[symbols[index]] = file_paths[index].sort_values('time') From 12ee1f48f664b8fce9070dc43220044c45a1fbbb Mon Sep 17 00:00:00 2001 From: working4coins Date: Sat, 15 Jul 2023 13:09:33 +0200 Subject: [PATCH 3/3] Update paper_trade_interface.py More explicit KeyError --- .../exchanges/interfaces/paper_trade/paper_trade_interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py b/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py index 640a64ec..1575bfc5 100644 --- a/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py +++ b/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py @@ -352,10 +352,10 @@ def get_account(self, symbol=None) -> utils.AttributeDict: return self.local_account.get_account(symbol) except KeyError: if self.backtesting: - raise KeyError("Symbol not found. This can be caused by an invalid quote currency " + raise KeyError(f"Symbol {symbol} not found. This can be caused by an invalid quote currency " "in backtest.json.") else: - raise KeyError("Symbol not found.") + raise KeyError(f"Symbol {symbol} not found.") def take_profit_order(self, symbol: str, price: float, size: float) -> TakeProfitOrder: # we don't simulate partial fills, this is the same as take_profit