signal handler
This commit is contained in:
parent
8a7b3d4e22
commit
3171e054e0
@ -4,6 +4,7 @@ use std::future::Future;
|
|||||||
use tokio::stream::StreamExt;
|
use tokio::stream::StreamExt;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
|
use crate::bot::BfxBot;
|
||||||
use crate::pairs::PairStatus;
|
use crate::pairs::PairStatus;
|
||||||
use crate::positions::{Position, PositionProfitState, PositionState};
|
use crate::positions::{Position, PositionProfitState, PositionState};
|
||||||
use crate::BoxError;
|
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) {
|
pub fn call_event_handlers(&self, event: &Event, status: &PairStatus) {
|
||||||
if let Some(functions) = self.event_handlers.get(&event.kind()) {
|
if let Some(functions) = self.event_handlers.get(&event.kind()) {
|
||||||
for f in functions {
|
for f in functions {
|
||||||
|
Loading…
Reference in New Issue
Block a user