2022-04-22 06:50:55 +00:00
|
|
|
from ..data import MarketDataEvent
|
2022-04-20 06:26:53 +00:00
|
|
|
from ..enums import ChannelType
|
|
|
|
from ..enums import EventType
|
|
|
|
from .handler import Handler
|
|
|
|
|
|
|
|
|
|
|
|
class KLineHandler(Handler):
|
|
|
|
|
2022-04-22 06:50:55 +00:00
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
2022-04-20 06:26:53 +00:00
|
|
|
if event.channel_type != ChannelType.KLINE:
|
|
|
|
return
|
|
|
|
|
|
|
|
super(KLineHandler, self).__call__(event)
|
|
|
|
|
|
|
|
|
|
|
|
class KLineSnapshotHandler(KLineHandler):
|
|
|
|
|
2022-04-22 06:50:55 +00:00
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
2022-04-20 06:26:53 +00:00
|
|
|
if event.event_type != EventType.SNAPSHOT:
|
|
|
|
return
|
|
|
|
|
|
|
|
super(KLineSnapshotHandler, self).__call__(event)
|
|
|
|
|
|
|
|
|
|
|
|
class KLineUpdateHandler(KLineHandler):
|
|
|
|
|
2022-04-22 06:50:55 +00:00
|
|
|
def __call__(self, event: MarketDataEvent) -> None:
|
2022-04-20 06:26:53 +00:00
|
|
|
if event.event_type != EventType.UPDATE:
|
|
|
|
return
|
|
|
|
|
|
|
|
super(KLineUpdateHandler, self).__call__(event)
|