bbgo_origin/python/bbgo/handlers/order.py

32 lines
782 B
Python
Raw Permalink Normal View History

2022-04-22 06:50:55 +00:00
from ..data import UserDataEvent
2022-04-20 06:26:53 +00:00
from ..enums import ChannelType
from ..enums import EventType
from .handler import Handler
class OrderHandler(Handler):
2022-04-22 06:50:55 +00:00
def __call__(self, event: UserDataEvent) -> None:
2022-04-20 06:26:53 +00:00
if event.channel_type != ChannelType.ORDER:
return
super(OrderHandler, self).__call__(event)
class OrderSnapshotHandler(OrderHandler):
2022-04-22 06:50:55 +00:00
def __call__(self, event: UserDataEvent) -> None:
2022-04-20 06:26:53 +00:00
if event.event_type != EventType.SNAPSHOT:
return
super(OrderSnapshotHandler, self).__call__(event)
class OrderUpdateHandler(OrderHandler):
2022-04-22 06:50:55 +00:00
def __call__(self, event: UserDataEvent) -> None:
2022-04-20 06:26:53 +00:00
if event.event_type != EventType.UPDATE:
return
super(OrderUpdateHandler, self).__call__(event)