mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-27 01:05:15 +00:00
32 lines
781 B
Python
32 lines
781 B
Python
from ..data import MarketDataEvent
|
|
from ..enums import ChannelType
|
|
from ..enums import EventType
|
|
from .handler import Handler
|
|
|
|
|
|
class BookHandler(Handler):
|
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
|
if event.channel_type != ChannelType.BOOK:
|
|
return
|
|
|
|
super(BookHandler, self).__call__(event)
|
|
|
|
|
|
class BookSnapshotHandler(BookHandler):
|
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
|
if event.event_type != EventType.SNAPSHOT:
|
|
return
|
|
|
|
super(BookSnapshotHandler, self).__call__(event)
|
|
|
|
|
|
class BookUpdateHandler(BookHandler):
|
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
|
if event.event_type != EventType.UPDATE:
|
|
return
|
|
|
|
super(BookUpdateHandler, self).__call__(event)
|