-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use multiple price feeds always #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubber stamping an merging this to continue testing.
Changes look reasonable but I do not know how to test this locally. I expect this to create lots of alerts.
for provider in self.providers: | ||
try: | ||
price = provider.get_price(price_params) | ||
if price is not None: | ||
return price, provider.name | ||
prices.append((price, provider.name)) | ||
except Exception as e: | ||
logger.error(f"Error getting price from provider {provider.name}: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being an error message sounds a bit strange. Most errors should be caught explicitly and would be more of a info type thing.
@@ -290,15 +289,21 @@ def handle_fees( | |||
) | |||
|
|||
def handle_prices( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name sounds a bit strange. Maybe store_prices
would work.
) | ||
self.log_message.append( | ||
f"Token: {token_address}, Price: {price} ETH, Source: {source}" | ||
) | ||
except Exception as err: | ||
logger.error(f"Error: {err}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.error(f"Error: {err}") | |
logger.error(f"Error writing prices to database: {err}") |
Should have probably pushed a different button to revert this. Not sure how to reopen the PR now. |
So far, we have used an ordering of price feeds, in the sense that we query the first API, and if it succeeds, we stop, and only continue with the second price feed if the first one doesn't respond. This PR changes this by forcing the use of all available price feeds/apis always.