-
Notifications
You must be signed in to change notification settings - Fork 80
Add Coindesk, Lunarcrush and Alternative.me services #1629
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
base: dev
Are you sure you want to change the base?
Conversation
66b18ce to
afce280
Compare
afce280 to
36c7484
Compare
GuillaumeDSM
left a comment
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.
great implem!
| if abs(note) > self._EVAL_NOTIFICATION_THRESHOLD: | ||
| self.eval_note = note | ||
| self.save_evaluation_expiration_time(self._compute_notification_time_to_live(self.eval_note)) | ||
| await self.evaluation_completed(self.cryptocurrency, eval_time=self.get_current_exchange_time()) |
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.
I think removing this will break the evaluator
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.
my bad, thanks
| async with aiohttp.ClientSession() as session: | ||
| while not self.should_stop: | ||
| try: | ||
| await self._push_update_and_wait(session) | ||
| except Exception as e: | ||
| self.logger.exception(e, True, f"Error when receiving Alternative.me data: ({e})") | ||
| self.should_stop = True | ||
| return False |
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.
👍
| market_dominance=entry["market_dominance"], | ||
| open=entry["open"], | ||
| social_dominance=entry["social_dominance"], | ||
| volume_24h=entry["volume_24h"] |
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.
if parsed object keys are == to dataclass keys, we could use https://github.com/Drakkar-Software/OctoBot-Commons/blob/master/octobot_commons/dataclasses/flexible_dataclass.py
(make LunarCrushCoinMetrics inherit FlexibleDataclass and use LunarCrushCoinMetrics.from_dict(entry)).
The same is true for CoindeskNews
|
|
||
| async def _start_service_feed(self): | ||
| try: | ||
| asyncio.create_task(self._update_loop()) |
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.
I think we should save the handle to this task and cancel it when the feed is stopped
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.
Right! Do you want me to also update the existing google feed that has the same code?
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.
😮 yes please
36c7484 to
d5b21f4
Compare
d5b21f4 to
dd95824
Compare
|
Thanks, it's up |
GuillaumeDSM
left a comment
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.
great work!
| async def stop(self): | ||
| await super().stop() | ||
| if self.listener_task is not None: | ||
| self.listener_task.cancel() |
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.
👍
| data = fear_and_greed_data["data"] | ||
| self.data_cache[services_constants.ALTERNATIVE_ME_TOPIC_FEAR_AND_GREED] = [ | ||
| AlternativeMeFearAndGreed( | ||
| timestamp=datetime.datetime.strptime(entry["timestamp"], '%m-%d-%Y').timestamp(), |
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 will parse dates in local time. Is it a problem? if it is, we should add replace(tzinfo=datetime.timezone.utc) (to force parsing as utc)
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.
Good point, I don't think it will make any difference but I'll use UTC
| data = coin_metrics_data["data"] | ||
| self.data_cache[services_constants.LUNARCRUSH_COIN_METRICS] = { | ||
| coin: [ | ||
| LunarCrushCoinMetrics.from_dict(entry) |
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.
👍
| async def stop(self): | ||
| await super().stop() | ||
| if self.listener_task is not None: | ||
| self.listener_task.cancel() |
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.
👍
Requires Drakkar-Software/OctoBot-Services#191 and Drakkar-Software/OctoBot-Evaluators#230