Overview
The Alert System provides configurable price and indicator alerts with condition-based triggering and notification capabilities.AlertSystem Class
Constructor
alerts(List[Dict]): List of active alert configurationshistory(List[Dict]): Historical record of triggered alerts
Methods
add_alert
alert_config(Dict): Alert configuration dictionary with the following keys:type(str): Alert type (e.g., “Precio”, “RSI”, “MACD”)crypto(str): Cryptocurrency symbol (e.g., “BTC”, “ETH”)condition(str): Condition operator (“Mayor que” or “Menor que”)threshold(float): Threshold value to trigger the alertmethods(List[str], optional): Notification methods (e.g., [“App”, “Telegram”])
None
Auto-added fields:
id(int): Unique alert identifieractive(bool): Alert status (default: True)created(datetime): Creation timestamp
check_alerts
current_data(Dict): Current market data with keys matching alert types (lowercase)- Example:
{'precio': 51000, 'rsi': 72, 'macd': 'bullish'}
- Example:
List[Dict]: List of triggered alerts
Example:
Private Methods
_evaluate_condition
alert(Dict): Alert configurationdata(Dict): Current market data
bool: True if condition is met, False otherwise
Supported Conditions:
"Mayor que": Triggers when value > threshold"Menor que": Triggers when value < threshold
_send_notification
alert(Dict): Triggered alert configurationdata(Dict): Current market data
None
Notification Methods:
"App": Displays Streamlit toast notification
Global Instance
Complete Usage Example
Alert Configuration Examples
Price Alert
RSI Overbought Alert
RSI Oversold Alert
Volume Alert
Best Practices
- Set Realistic Thresholds: Use historical data to determine meaningful alert levels
- Avoid Alert Fatigue: Don’t set too many alerts that trigger frequently
- Use Multiple Conditions: Combine price and indicator alerts for better signals
- Monitor Active Alerts: Regularly review and update alert configurations
- Test Notifications: Verify notification methods work before relying on them