Skip to content

Commit

Permalink
Merge pull request #59 from cowprotocol/initialize_empty_price_feed_o…
Browse files Browse the repository at this point in the history
…bject_in_other_chains

Initialize empty price feed object on other chains
  • Loading branch information
harisang authored Sep 25, 2024
2 parents 513df43 + e18a4a4 commit bf7e09d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/price_providers/price_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
class PriceFeed:
"""Class encapsulating the different price providers."""

def __init__(self):
self.providers = [
CoingeckoPriceProvider(),
MoralisPriceProvider(),
AuctionPriceProvider(),
]
def __init__(self, activate: bool):
if activate:
self.providers = [
CoingeckoPriceProvider(),
MoralisPriceProvider(),
AuctionPriceProvider(),
]
else:
self.providers = []

def get_price(self, price_params: dict) -> tuple[float, str] | None:
"""Function iterates over list of price provider objects and attempts to get a price."""
Expand Down
2 changes: 1 addition & 1 deletion src/transaction_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
self.process_prices = process_prices

self.imbalances = RawTokenImbalances(self.blockchain_data.web3, self.chain_name)
self.price_providers = PriceFeed()
self.price_providers = PriceFeed(activate=process_prices)
self.log_message: list[str] = []

def get_start_block(self) -> int:
Expand Down

0 comments on commit bf7e09d

Please sign in to comment.