mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-24 15:55:14 +00:00
32 lines
800 B
Python
32 lines
800 B
Python
from ..data import UserDataEvent
|
|
from ..enums import ChannelType
|
|
from ..enums import EventType
|
|
from .handler import Handler
|
|
|
|
|
|
class BalanceHandler(Handler):
|
|
|
|
def __call__(self, event: UserDataEvent) -> None:
|
|
if event.channel_type != ChannelType.BALANCE:
|
|
return
|
|
|
|
super(BalanceHandler, self).__call__(event)
|
|
|
|
|
|
class BalanceSnapshotHandler(BalanceHandler):
|
|
|
|
def __call__(self, event: UserDataEvent) -> None:
|
|
if event.event_type != EventType.SNAPSHOT:
|
|
return
|
|
|
|
super(BalanceSnapshotHandler, self).__call__(event)
|
|
|
|
|
|
class BalanceUpdateHandler(BalanceHandler):
|
|
|
|
def __call__(self, event: UserDataEvent) -> None:
|
|
if event.event_type != EventType.UPDATE:
|
|
return
|
|
|
|
super(BalanceUpdateHandler, self).__call__(event)
|