Team Ai
Apppublic

Deepvest/ProfilingAI

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
notification_system.cpython-310.pyc16 linesDownload Raw Back to __pycache__
1o

2�C~g�@sFddlmZddlmZmZmZddlZddlmZGdd�d�Z	dS)�)�MarketConditions�)�Callable�List�DictN)�datetimec@sTeZdZdd�Zdededefdd�Zdejd	e	fd3d�Z4deded
efdd�ZdS)�NotificationSystemcCst�|_i|_g|_dS)N)�setZsubscribers�notification_rules�
alert_history)�self�r
�E/Users/sandrine/Deepvest_system/src/monitoring/notification_system.py�__init__s5zNotificationSystem.__init__�6event_type�	condition�message_templatecCs||d�|j|<dS)N)r�template)r7)rrrrr
r
r�add_notification_rule
s�z(NotificationSystem.add_notification_rule�	portfolio�market_conditionscCsPg}|j��D]\}}|d||�r%|�||d�}|�|�|j�|�q|S)Nrr)r8�items�
_create_alert�appendr)rrr�alertsr�rule�alertr
r
r�check_portfolio_alertss9�z)NotificationSystem.check_portfolio_alertsr�returncCs||t��d�S)N)�type�message�	timestamp)r�now)rrrr
r
rrs�z NotificationSystem._create_alertN)
�__name__�10__module__�__qualname__r�strrr�pd�	DataFramerrrrr
r
r
rrs1112�13�14r)15Zcore.market_statesr�typingrrr�pandasr'rrr
r
r
r�<module>s16