diff --git a/CryptoPrice/retrievers/MetaRetriever.py b/CryptoPrice/retrievers/MetaRetriever.py index ea3e1e4..f408b29 100644 --- a/CryptoPrice/retrievers/MetaRetriever.py +++ b/CryptoPrice/retrievers/MetaRetriever.py @@ -103,9 +103,6 @@ def get_path_prices(self, asset: str, ref_asset: str, timestamp: int, :return: Metaprice reflecting the value calculated through a trading path :rtype: Optional[MetaPrice] """ - if asset == ref_asset: - yield MetaPrice(1, asset, ref_asset, [], source=set('',)) - return if preferred_assets is None: preferred_assets = ['BTC', 'ETH'] diff --git a/CryptoPrice/storage/DataBase.py b/CryptoPrice/storage/DataBase.py index bc10d7c..e7563d5 100644 --- a/CryptoPrice/storage/DataBase.py +++ b/CryptoPrice/storage/DataBase.py @@ -140,23 +140,11 @@ def drop_table(self, table: Union[Table, str]): :return: None :rtype: None """ - self.drop_tables([table]) - - def drop_tables(self, tables: List[Union[Table, str]]): - """ - Delete a list of tables if they exist - - :param tables: list of tables to delete - :type tables: List[Union[Table, str]] - :return: None - :rtype: None - """ - for table in tables: - if isinstance(table, Table): - table = table.name - execution_order = f"DROP TABLE IF EXISTS {table}" - self.db_cursor.execute(execution_order) - self.commit() + if isinstance(table, Table): + table = table.name + execution_order = f"DROP TABLE IF EXISTS {table}" + self.db_cursor.execute(execution_order) + self.db_conn.commit() def drop_all_tables(self): """ @@ -165,12 +153,14 @@ def drop_all_tables(self): :return: None :rtype: None """ - tables = [t[1] for t in self.get_tables_descriptions()] - self.drop_tables(tables) + tables_desc = self.get_all_tables() + for table_desc in tables_desc: + self.drop_table(table_desc[1]) + self.commit() - def get_tables_descriptions(self) -> List[Tuple]: + def get_all_tables(self) -> List[Tuple]: """ - return the descriptions of all the tables existing in the database + return all the tables existing in the database :return: tables descriptions :rtype: List[Tuple] diff --git a/CryptoPrice/storage/KlineDataBase.py b/CryptoPrice/storage/KlineDataBase.py index dc4475d..5109544 100644 --- a/CryptoPrice/storage/KlineDataBase.py +++ b/CryptoPrice/storage/KlineDataBase.py @@ -187,14 +187,3 @@ def add_cache_closest(self, asset: str, ref_asset: str, timeframe: TIMEFRAME, ti row = (timestamp, closest_timestamp, window) self.add_row(table, row, update_if_exists=True) - def drop_cache_tables(self): - """ - Delete all the cache tables stored in the database - - :return: None - :rtype: None - """ - tables = [t[1] for t in self.get_tables_descriptions()] - tables = [table for table in tables if table.endswith('_cache')] - self.drop_tables(tables) -