forked from c9s/bbgo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00c8722
commit 7942558
Showing
6 changed files
with
86 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .error import ErrorHandler | ||
from .handler import Handler | ||
from .update import UpdateHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from ..data import Event | ||
from ..enums import EventType | ||
from .handler import Handler | ||
|
||
|
||
class ErrorHandler(Handler): | ||
|
||
def __call__(self, event: Event) -> None: | ||
if event.event_type != EventType.ERROR: | ||
return | ||
|
||
super(ErrorHandler, self).__call__(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from ..data import Event | ||
|
||
|
||
class Handler(object): | ||
|
||
def __call__(self, event: Event) -> None: | ||
self.handle(event) | ||
|
||
def handle(self, event: Event) -> None: | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from ..data import Event | ||
from ..enums import EventType | ||
from .handler import Handler | ||
|
||
|
||
class UpdateHandler(Handler): | ||
|
||
def __call__(self, event: Event) -> None: | ||
if event.event_type != EventType.UPDATE: | ||
return | ||
|
||
super(UpdateHandler, self).__call__(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters