Documentation
¶
Index ¶
- func AlertConnectionError(ctx context.Context, exchange string, err error)
- func AlertOrderCancelFailed(ctx context.Context, orderID, symbol string, err error)
- func AlertOrderFailed(ctx context.Context, symbol, side string, quantity float64, err error)
- func AlertPositionRisk(ctx context.Context, symbol string, riskLevel float64, reason string)
- func AlertSystemError(ctx context.Context, component string, err error)
- func SetDefaultManager(manager *Manager)
- type Alert
- type Alerter
- type ConsoleAlerter
- type EmailAlerter
- type EmailConfig
- type LogAlerter
- type Manager
- func (m *Manager) Send(ctx context.Context, alert Alert) error
- func (m *Manager) SendCritical(ctx context.Context, title, message string, metadata map[string]interface{}) error
- func (m *Manager) SendInfo(ctx context.Context, title, message string, metadata map[string]interface{}) error
- func (m *Manager) SendWarning(ctx context.Context, title, message string, metadata map[string]interface{}) error
- type Severity
- type SlackAlerter
- type SlackConfig
- type TelegramAlerter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlertConnectionError ¶
AlertConnectionError sends an alert for exchange connection issues
func AlertOrderCancelFailed ¶
AlertOrderCancelFailed sends an alert for order cancellation failure
func AlertOrderFailed ¶
AlertOrderFailed sends an alert for order placement failure
func AlertPositionRisk ¶
AlertPositionRisk sends an alert for position risk violations
func AlertSystemError ¶
AlertSystemError sends an alert for critical system errors
func SetDefaultManager ¶
func SetDefaultManager(manager *Manager)
SetDefaultManager sets the default alert manager
Types ¶
type Alert ¶
type Alert struct {
Title string
Message string
Severity Severity
Timestamp time.Time
Metadata map[string]interface{}
}
Alert represents an alert message
type ConsoleAlerter ¶
type ConsoleAlerter struct{}
ConsoleAlerter prints alerts to console with prominent formatting using zerolog
func NewConsoleAlerter ¶
func NewConsoleAlerter() *ConsoleAlerter
NewConsoleAlerter creates a new console-based alerter
type EmailAlerter ¶
type EmailAlerter struct {
// contains filtered or unexported fields
}
EmailAlerter sends alerts via email
func NewEmailAlerter ¶
func NewEmailAlerter(config EmailConfig, recipients []string) (*EmailAlerter, error)
NewEmailAlerter creates a new email-based alerter
func (*EmailAlerter) AddRecipient ¶
func (e *EmailAlerter) AddRecipient(email string)
AddRecipient adds a recipient to the alerter
func (*EmailAlerter) GetRecipients ¶
func (e *EmailAlerter) GetRecipients() []string
GetRecipients returns the list of recipients
func (*EmailAlerter) RemoveRecipient ¶
func (e *EmailAlerter) RemoveRecipient(email string)
RemoveRecipient removes a recipient from the alerter
func (*EmailAlerter) Send ¶
func (e *EmailAlerter) Send(ctx context.Context, alert Alert) error
Send sends an alert via email
func (*EmailAlerter) SetRecipients ¶
func (e *EmailAlerter) SetRecipients(recipients []string)
SetRecipients sets the list of recipients
type EmailConfig ¶
type EmailConfig struct {
Host string
Port int
Username string
Password string
FromAddress string
FromName string
UseTLS bool
UseStartTLS bool
SkipVerify bool
AuthRequired bool
}
EmailConfig holds email alerter configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple alert channels
func GetDefaultManager ¶
func GetDefaultManager() *Manager
GetDefaultManager returns the default alert manager
func NewManager ¶
NewManager creates a new alert manager
func (*Manager) SendCritical ¶
func (m *Manager) SendCritical(ctx context.Context, title, message string, metadata map[string]interface{}) error
SendCritical is a convenience method for sending critical alerts
type SlackAlerter ¶
type SlackAlerter struct {
// contains filtered or unexported fields
}
SlackAlerter sends alerts via Slack webhook
func NewSlackAlerter ¶
func NewSlackAlerter(config SlackConfig) (*SlackAlerter, error)
NewSlackAlerter creates a new Slack-based alerter
func (*SlackAlerter) GetChannel ¶
func (s *SlackAlerter) GetChannel() string
GetChannel returns the default channel
func (*SlackAlerter) Send ¶
func (s *SlackAlerter) Send(ctx context.Context, alert Alert) error
Send sends an alert via Slack webhook
func (*SlackAlerter) SetChannel ¶
func (s *SlackAlerter) SetChannel(channel string)
SetChannel sets the default channel
type SlackConfig ¶
type SlackConfig struct {
WebhookURL string
Channel string // Optional channel override
Username string
IconEmoji string
IconURL string
TimeoutSeconds int
}
SlackConfig holds Slack alerter configuration
type TelegramAlerter ¶
type TelegramAlerter struct {
// contains filtered or unexported fields
}
TelegramAlerter sends alerts via Telegram bot
func NewTelegramAlerter ¶
func NewTelegramAlerter(botToken string, chatIDs []int64) (*TelegramAlerter, error)
NewTelegramAlerter creates a new Telegram-based alerter botToken: Telegram bot API token chatIDs: List of chat IDs to send alerts to
func (*TelegramAlerter) AddChatID ¶
func (t *TelegramAlerter) AddChatID(chatID int64)
AddChatID adds a chat ID to the alerter
func (*TelegramAlerter) GetChatIDs ¶
func (t *TelegramAlerter) GetChatIDs() []int64
GetChatIDs returns the list of configured chat IDs
func (*TelegramAlerter) RemoveChatID ¶
func (t *TelegramAlerter) RemoveChatID(chatID int64)
RemoveChatID removes a chat ID from the alerter
func (*TelegramAlerter) Send ¶
func (t *TelegramAlerter) Send(ctx context.Context, alert Alert) error
Send sends an alert via Telegram
func (*TelegramAlerter) SetChatIDs ¶
func (t *TelegramAlerter) SetChatIDs(chatIDs []int64)
SetChatIDs sets the list of chat IDs