Skip to content

Conversation

@Herklos
Copy link
Member

@Herklos Herklos commented Oct 28, 2025

@Herklos Herklos self-assigned this Oct 28, 2025
@Herklos Herklos requested a review from GuillaumeDSM October 28, 2025 11:13
@Herklos Herklos changed the base branch from master to dev October 28, 2025 11:13
@Herklos Herklos marked this pull request as draft October 28, 2025 11:13
@Herklos Herklos force-pushed the feature/add-new-feeds branch 14 times, most recently from 66b18ce to afce280 Compare October 29, 2025 10:32
@Herklos Herklos marked this pull request as ready for review October 29, 2025 10:32
@Herklos Herklos force-pushed the feature/add-new-feeds branch from afce280 to 36c7484 Compare October 29, 2025 13:46
Copy link
Member

@GuillaumeDSM GuillaumeDSM left a 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())
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, thanks

Comment on lines +113 to +121
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
Copy link
Member

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"]
Copy link
Member

@GuillaumeDSM GuillaumeDSM Oct 29, 2025

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())
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮 yes please

@Herklos Herklos force-pushed the feature/add-new-feeds branch from 36c7484 to d5b21f4 Compare October 30, 2025 10:00
@Herklos Herklos force-pushed the feature/add-new-feeds branch from d5b21f4 to dd95824 Compare October 30, 2025 10:16
@Herklos
Copy link
Member Author

Herklos commented Oct 30, 2025

Thanks, it's up

Copy link
Member

@GuillaumeDSM GuillaumeDSM left a 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()
Copy link
Member

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(),
Copy link
Member

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)

Copy link
Member Author

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)
Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants