From 3171e054e02dc72a9aa304599ee3f4f065a1bf29 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 11 Jan 2021 18:40:19 +0000 Subject: [PATCH] signal handler --- rustybot/src/events.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rustybot/src/events.rs b/rustybot/src/events.rs index c6a0fc3..781ca60 100644 --- a/rustybot/src/events.rs +++ b/rustybot/src/events.rs @@ -4,6 +4,7 @@ use std::future::Future; use tokio::stream::StreamExt; use tokio::task::JoinHandle; +use crate::bot::BfxBot; use crate::pairs::PairStatus; use crate::positions::{Position, PositionProfitState, PositionState}; use crate::BoxError; @@ -96,6 +97,14 @@ impl EventDispatcher { } } + pub fn call_signal_handlers(&self, signal: &SignalKind) { + if let Some(functions) = self.signal_handlers.get(&signal) { + for f in functions { + f(signal); + } + } + } + pub fn call_event_handlers(&self, event: &Event, status: &PairStatus) { if let Some(functions) = self.event_handlers.get(&event.kind()) { for f in functions {