mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
32 lines
750 B
Python
32 lines
750 B
Python
from ..data import Event
|
|
from ..enums import ChannelType
|
|
from ..enums import EventType
|
|
from .handler import Handler
|
|
|
|
|
|
class TradeHandler(Handler):
|
|
|
|
def __call__(self, event: Event) -> None:
|
|
if event.channel_type != ChannelType.TRADE:
|
|
return
|
|
|
|
super(TradeHandler, self).__call__(event)
|
|
|
|
|
|
class TradeSnapshotHandler(TradeHandler):
|
|
|
|
def __call__(self, event: Event) -> None:
|
|
if event.event_type != EventType.SNAPSHOT:
|
|
return
|
|
|
|
super(TradeSnapshotHandler, self).__call__(event)
|
|
|
|
|
|
class TradeUpdateHandler(TradeHandler):
|
|
|
|
def __call__(self, event: Event) -> None:
|
|
if event.event_type != EventType.UPDATE:
|
|
return
|
|
|
|
super(TradeUpdateHandler, self).__call__(event)
|