From 4c78d15875df90131d11edad0e4e1fadb665ff87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=81=BF?= Date: Wed, 20 Apr 2022 14:26:53 +0800 Subject: [PATCH 1/2] python: add event&channel handlers --- python/bbgo/__init__.py | 1 + python/bbgo/handlers/__init__.py | 18 ++++++++ python/bbgo/handlers/balance.py | 31 ++++++++++++++ python/bbgo/handlers/book.py | 31 ++++++++++++++ python/bbgo/handlers/kline.py | 31 ++++++++++++++ python/bbgo/handlers/order.py | 31 ++++++++++++++ python/bbgo/handlers/snapshot.py | 12 ++++++ python/bbgo/handlers/ticker.py | 31 ++++++++++++++ python/bbgo/handlers/trade.py | 31 ++++++++++++++ python/bbgo_pb2.py | 72 ++++++++++++++++---------------- 10 files changed, 253 insertions(+), 36 deletions(-) create mode 100644 python/bbgo/handlers/balance.py create mode 100644 python/bbgo/handlers/book.py create mode 100644 python/bbgo/handlers/kline.py create mode 100644 python/bbgo/handlers/order.py create mode 100644 python/bbgo/handlers/snapshot.py create mode 100644 python/bbgo/handlers/ticker.py create mode 100644 python/bbgo/handlers/trade.py diff --git a/python/bbgo/__init__.py b/python/bbgo/__init__.py index e9485cbb0..bbb02050c 100644 --- a/python/bbgo/__init__.py +++ b/python/bbgo/__init__.py @@ -1,4 +1,5 @@ from . import enums +from . import handlers from . import utils from .services import MarketService from .services import TradingService diff --git a/python/bbgo/handlers/__init__.py b/python/bbgo/handlers/__init__.py index e83e84034..60d677bd0 100644 --- a/python/bbgo/handlers/__init__.py +++ b/python/bbgo/handlers/__init__.py @@ -1,3 +1,21 @@ +from .balance import BalanceHandler +from .balance import BalanceSnapshotHandler +from .balance import BalanceUpdateHandler +from .book import BookSnapshotHandler +from .book import BookUpdateHandler from .error import ErrorHandler from .handler import Handler +from .kline import KLineHandler +from .kline import KLineSnapshotHandler +from .kline import KLineUpdateHandler +from .order import OrderHandler +from .order import OrderSnapshotHandler +from .order import OrderUpdateHandler +from .snapshot import SnapshotHandler +from .ticker import TickerHandler +from .ticker import TickerSnapshotHandler +from .ticker import TickerUpdateHandler +from .trade import TradeHandler +from .trade import TradeSnapshotHandler +from .trade import TradeUpdateHandler from .update import UpdateHandler diff --git a/python/bbgo/handlers/balance.py b/python/bbgo/handlers/balance.py new file mode 100644 index 000000000..bf6858efa --- /dev/null +++ b/python/bbgo/handlers/balance.py @@ -0,0 +1,31 @@ +from ..data import Event +from ..enums import ChannelType +from ..enums import EventType +from .handler import Handler + + +class BalanceHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.channel_type != ChannelType.BALANCE: + return + + super(BalanceHandler, self).__call__(event) + + +class BalanceSnapshotHandler(BalanceHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(BalanceSnapshotHandler, self).__call__(event) + + +class BalanceUpdateHandler(BalanceHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.UPDATE: + return + + super(BalanceUpdateHandler, self).__call__(event) diff --git a/python/bbgo/handlers/book.py b/python/bbgo/handlers/book.py new file mode 100644 index 000000000..fa98325fb --- /dev/null +++ b/python/bbgo/handlers/book.py @@ -0,0 +1,31 @@ +from ..data import Event +from ..enums import ChannelType +from ..enums import EventType +from .handler import Handler + + +class BookHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.channel_type != ChannelType.BOOK: + return + + super(BookHandler, self).__call__(event) + + +class BookSnapshotHandler(BookHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(BookSnapshotHandler, self).__call__(event) + + +class BookUpdateHandler(BookHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.UPDATE: + return + + super(BookUpdateHandler, self).__call__(event) diff --git a/python/bbgo/handlers/kline.py b/python/bbgo/handlers/kline.py new file mode 100644 index 000000000..c919b4d4f --- /dev/null +++ b/python/bbgo/handlers/kline.py @@ -0,0 +1,31 @@ +from ..data import Event +from ..enums import ChannelType +from ..enums import EventType +from .handler import Handler + + +class KLineHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.channel_type != ChannelType.KLINE: + return + + super(KLineHandler, self).__call__(event) + + +class KLineSnapshotHandler(KLineHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(KLineSnapshotHandler, self).__call__(event) + + +class KLineUpdateHandler(KLineHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.UPDATE: + return + + super(KLineUpdateHandler, self).__call__(event) diff --git a/python/bbgo/handlers/order.py b/python/bbgo/handlers/order.py new file mode 100644 index 000000000..16b9f8cb2 --- /dev/null +++ b/python/bbgo/handlers/order.py @@ -0,0 +1,31 @@ +from ..data import Event +from ..enums import ChannelType +from ..enums import EventType +from .handler import Handler + + +class OrderHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.channel_type != ChannelType.ORDER: + return + + super(OrderHandler, self).__call__(event) + + +class OrderSnapshotHandler(OrderHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(OrderSnapshotHandler, self).__call__(event) + + +class OrderUpdateHandler(OrderHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.UPDATE: + return + + super(OrderUpdateHandler, self).__call__(event) diff --git a/python/bbgo/handlers/snapshot.py b/python/bbgo/handlers/snapshot.py new file mode 100644 index 000000000..8e61835c4 --- /dev/null +++ b/python/bbgo/handlers/snapshot.py @@ -0,0 +1,12 @@ +from ..data import Event +from ..enums import EventType +from .handler import Handler + + +class SnapshotHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(SnapshotHandler, self).__call__(event) diff --git a/python/bbgo/handlers/ticker.py b/python/bbgo/handlers/ticker.py new file mode 100644 index 000000000..14d26c42f --- /dev/null +++ b/python/bbgo/handlers/ticker.py @@ -0,0 +1,31 @@ +from ..data import Event +from ..enums import ChannelType +from ..enums import EventType +from .handler import Handler + + +class TickerHandler(Handler): + + def __call__(self, event: Event) -> None: + if event.channel_type != ChannelType.TICKER: + return + + super(TickerHandler, self).__call__(event) + + +class TickerSnapshotHandler(TickerHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.SNAPSHOT: + return + + super(TickerSnapshotHandler, self).__call__(event) + + +class TickerUpdateHandler(TickerHandler): + + def __call__(self, event: Event) -> None: + if event.event_type != EventType.UPDATE: + return + + super(TickerUpdateHandler, self).__call__(event) diff --git a/python/bbgo/handlers/trade.py b/python/bbgo/handlers/trade.py new file mode 100644 index 000000000..41faf0aa8 --- /dev/null +++ b/python/bbgo/handlers/trade.py @@ -0,0 +1,31 @@ +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) diff --git a/python/bbgo_pb2.py b/python/bbgo_pb2.py index 9f5b31ce6..c6d0b9180 100644 --- a/python/bbgo_pb2.py +++ b/python/bbgo_pb2.py @@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nbbgo.proto\x12\x04\x62\x62go\"\x07\n\x05\x45mpty\"2\n\x05\x45rror\x12\x12\n\nerror_code\x18\x01 \x01(\x03\x12\x15\n\rerror_message\x18\x02 \x01(\t\"\"\n\x0fUserDataRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\"\xc4\x01\n\x08UserData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x03 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x04 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1f\n\x08\x62\x61lances\x18\x05 \x03(\x0b\x32\r.bbgo.Balance\x12\x1b\n\x06trades\x18\x06 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1b\n\x06orders\x18\x07 \x03(\x0b\x32\x0b.bbgo.Order\"=\n\x10SubscribeRequest\x12)\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x12.bbgo.Subscription\"q\n\x0cSubscription\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0e\x32\r.bbgo.Channel\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\r\n\x05\x64\x65pth\x18\x04 \x01(\t\x12\x10\n\x08interval\x18\x05 \x01(\t\"\xa1\x02\n\nMarketData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x04 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x05 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1a\n\x05\x64\x65pth\x18\x06 \x01(\x0b\x32\x0b.bbgo.Depth\x12\x1a\n\x05kline\x18\x07 \x01(\x0b\x32\x0b.bbgo.KLine\x12\x1c\n\x06ticker\x18\t \x01(\x0b\x32\x0c.bbgo.Ticker\x12\x1b\n\x06trades\x18\x08 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x15\n\rsubscribed_at\x18\x0c \x01(\x03\x12\x1a\n\x05\x65rror\x18\r \x01(\x0b\x32\x0b.bbgo.Error\"k\n\x05\x44\x65pth\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x1f\n\x04\x61sks\x18\x03 \x03(\x0b\x32\x11.bbgo.PriceVolume\x12\x1f\n\x04\x62ids\x18\x04 \x03(\x0b\x32\x11.bbgo.PriceVolume\",\n\x0bPriceVolume\x12\r\n\x05price\x18\x01 \x01(\t\x12\x0e\n\x06volume\x18\x02 \x01(\t\"\xc7\x01\n\x05Trade\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\n\n\x02id\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x10\n\x08quantity\x18\x06 \x01(\t\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x18\n\x04side\x18\x08 \x01(\x0e\x32\n.bbgo.Side\x12\x14\n\x0c\x66\x65\x65_currency\x18\t \x01(\t\x12\x0b\n\x03\x66\x65\x65\x18\n \x01(\t\x12\r\n\x05maker\x18\x0b \x01(\x08\"r\n\x06Ticker\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x0c\n\x04open\x18\x03 \x01(\x01\x12\x0c\n\x04high\x18\x04 \x01(\x01\x12\x0b\n\x03low\x18\x05 \x01(\x01\x12\r\n\x05\x63lose\x18\x06 \x01(\x01\x12\x0e\n\x06volume\x18\x07 \x01(\x01\"\x93\x02\n\x05Order\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\n\n\x02id\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12#\n\norder_type\x18\x05 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\r\n\x05price\x18\x06 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x10\n\x08quantity\x18\x0b \x01(\t\x12\x19\n\x11\x65xecuted_quantity\x18\x0c \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x0e \x01(\t\x12\x10\n\x08group_id\x18\x0f \x01(\x03\x12\x12\n\ncreated_at\x18\n \x01(\x03\"\xdf\x01\n\x0bSubmitOrder\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12\r\n\x05price\x18\x06 \x01(\t\x12\x10\n\x08quantity\x18\x05 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12#\n\norder_type\x18\x08 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\x17\n\x0f\x63lient_order_id\x18\t \x01(\t\x12\x10\n\x08group_id\x18\n \x01(\x03\"s\n\x07\x42\x61lance\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x10\n\x08\x63urrency\x18\x03 \x01(\t\x12\x11\n\tavailable\x18\x04 \x01(\t\x12\x0e\n\x06locked\x18\x05 \x01(\t\x12\x10\n\x08\x62orrowed\x18\x06 \x01(\t\"O\n\x12SubmitOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12(\n\rsubmit_orders\x18\x02 \x03(\x0b\x32\x11.bbgo.SubmitOrder\"_\n\x13SubmitOrderResponse\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x1b\n\x06orders\x18\x02 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x0b.bbgo.Error\"J\n\x12\x43\x61ncelOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"M\n\x13\x43\x61ncelOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"I\n\x11QueryOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"L\n\x12QueryOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xa9\x01\n\x12QueryOrdersRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\r\n\x05state\x18\x03 \x03(\t\x12\x10\n\x08order_by\x18\x04 \x01(\t\x12\x10\n\x08group_id\x18\x05 \x01(\x03\x12\x12\n\npagination\x18\x06 \x01(\x08\x12\x0c\n\x04page\x18\x07 \x01(\x03\x12\r\n\x05limit\x18\x08 \x01(\x03\x12\x0e\n\x06offset\x18\t \x01(\x03\"N\n\x13QueryOrdersResponse\x12\x1b\n\x06orders\x18\x01 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xb6\x01\n\x12QueryTradesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\x03\x12\x0c\n\x04\x66rom\x18\x04 \x01(\x03\x12\n\n\x02to\x18\x05 \x01(\x03\x12\x10\n\x08order_by\x18\x06 \x01(\t\x12\x12\n\npagination\x18\x07 \x01(\x08\x12\x0c\n\x04page\x18\x08 \x01(\x03\x12\r\n\x05limit\x18\t \x01(\x03\x12\x0e\n\x06offset\x18\n \x01(\x03\"N\n\x13QueryTradesResponse\x12\x1b\n\x06trades\x18\x01 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"}\n\x12QueryKLinesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x10\n\x08interval\x18\x03 \x01(\t\x12\x12\n\nstart_time\x18\x04 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x05 \x01(\x03\x12\r\n\x05limit\x18\x06 \x01(\x03\"N\n\x13QueryKLinesResponse\x12\x1b\n\x06klines\x18\x01 \x03(\x0b\x32\x0b.bbgo.KLine\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xce\x01\n\x05KLine\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0c\n\x04open\x18\x04 \x01(\t\x12\x0c\n\x04high\x18\x05 \x01(\t\x12\x0b\n\x03low\x18\x06 \x01(\t\x12\r\n\x05\x63lose\x18\x07 \x01(\t\x12\x0e\n\x06volume\x18\x08 \x01(\t\x12\x14\n\x0cquote_volume\x18\t \x01(\t\x12\x12\n\nstart_time\x18\n \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x0b \x01(\x03\x12\x0e\n\x06\x63losed\x18\x0c \x01(\x08*n\n\x05\x45vent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0e\n\nSUBSCRIBED\x10\x01\x12\x10\n\x0cUNSUBSCRIBED\x10\x02\x12\x0c\n\x08SNAPSHOT\x10\x03\x12\n\n\x06UPDATE\x10\x04\x12\x11\n\rAUTHENTICATED\x10\x05\x12\t\n\x05\x45RROR\x10\x63*M\n\x07\x43hannel\x12\x08\n\x04\x42OOK\x10\x00\x12\t\n\x05TRADE\x10\x01\x12\n\n\x06TICKER\x10\x02\x12\t\n\x05KLINE\x10\x03\x12\x0b\n\x07\x42\x41LANCE\x10\x04\x12\t\n\x05ORDER\x10\x05*\x19\n\x04Side\x12\x07\n\x03\x42UY\x10\x00\x12\x08\n\x04SELL\x10\x01*a\n\tOrderType\x12\n\n\x06MARKET\x10\x00\x12\t\n\x05LIMIT\x10\x01\x12\x0f\n\x0bSTOP_MARKET\x10\x02\x12\x0e\n\nSTOP_LIMIT\x10\x03\x12\r\n\tPOST_ONLY\x10\x04\x12\r\n\tIOC_LIMIT\x10\x05\x32\x94\x01\n\x11MarketDataService\x12\x39\n\tSubscribe\x12\x16.bbgo.SubscribeRequest\x1a\x10.bbgo.MarketData\"\x00\x30\x01\x12\x44\n\x0bQueryKLines\x12\x18.bbgo.QueryKLinesRequest\x1a\x19.bbgo.QueryKLinesResponse\"\x00\x32I\n\x0fUserDataService\x12\x36\n\tSubscribe\x12\x15.bbgo.UserDataRequest\x1a\x0e.bbgo.UserData\"\x00\x30\x01\x32\xeb\x02\n\x0eTradingService\x12\x44\n\x0bSubmitOrder\x12\x18.bbgo.SubmitOrderRequest\x1a\x19.bbgo.SubmitOrderResponse\"\x00\x12\x44\n\x0b\x43\x61ncelOrder\x12\x18.bbgo.CancelOrderRequest\x1a\x19.bbgo.CancelOrderResponse\"\x00\x12\x41\n\nQueryOrder\x12\x17.bbgo.QueryOrderRequest\x1a\x18.bbgo.QueryOrderResponse\"\x00\x12\x44\n\x0bQueryOrders\x12\x18.bbgo.QueryOrdersRequest\x1a\x19.bbgo.QueryOrdersResponse\"\x00\x12\x44\n\x0bQueryTrades\x12\x18.bbgo.QueryTradesRequest\x1a\x19.bbgo.QueryTradesResponse\"\x00\x42\x07Z\x05../pbb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nbbgo.proto\x12\x04\x62\x62go\"\x07\n\x05\x45mpty\"2\n\x05\x45rror\x12\x12\n\nerror_code\x18\x01 \x01(\x03\x12\x15\n\rerror_message\x18\x02 \x01(\t\"\"\n\x0fUserDataRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\"\xc4\x01\n\x08UserData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x03 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x04 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1f\n\x08\x62\x61lances\x18\x05 \x03(\x0b\x32\r.bbgo.Balance\x12\x1b\n\x06trades\x18\x06 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1b\n\x06orders\x18\x07 \x03(\x0b\x32\x0b.bbgo.Order\"=\n\x10SubscribeRequest\x12)\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x12.bbgo.Subscription\"q\n\x0cSubscription\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0e\x32\r.bbgo.Channel\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\r\n\x05\x64\x65pth\x18\x04 \x01(\t\x12\x10\n\x08interval\x18\x05 \x01(\t\"\xa1\x02\n\nMarketData\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x1e\n\x07\x63hannel\x18\x04 \x01(\x0e\x32\r.bbgo.Channel\x12\x1a\n\x05\x65vent\x18\x05 \x01(\x0e\x32\x0b.bbgo.Event\x12\x1a\n\x05\x64\x65pth\x18\x06 \x01(\x0b\x32\x0b.bbgo.Depth\x12\x1a\n\x05kline\x18\x07 \x01(\x0b\x32\x0b.bbgo.KLine\x12\x1c\n\x06ticker\x18\t \x01(\x0b\x32\x0c.bbgo.Ticker\x12\x1b\n\x06trades\x18\x08 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x15\n\rsubscribed_at\x18\x0c \x01(\x03\x12\x1a\n\x05\x65rror\x18\r \x01(\x0b\x32\x0b.bbgo.Error\"k\n\x05\x44\x65pth\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x1f\n\x04\x61sks\x18\x03 \x03(\x0b\x32\x11.bbgo.PriceVolume\x12\x1f\n\x04\x62ids\x18\x04 \x03(\x0b\x32\x11.bbgo.PriceVolume\",\n\x0bPriceVolume\x12\r\n\x05price\x18\x01 \x01(\t\x12\x0e\n\x06volume\x18\x02 \x01(\t\"\xc7\x01\n\x05Trade\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\n\n\x02id\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x10\n\x08quantity\x18\x06 \x01(\t\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x18\n\x04side\x18\x08 \x01(\x0e\x32\n.bbgo.Side\x12\x14\n\x0c\x66\x65\x65_currency\x18\t \x01(\t\x12\x0b\n\x03\x66\x65\x65\x18\n \x01(\t\x12\r\n\x05maker\x18\x0b \x01(\x08\"r\n\x06Ticker\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x0c\n\x04open\x18\x03 \x01(\x01\x12\x0c\n\x04high\x18\x04 \x01(\x01\x12\x0b\n\x03low\x18\x05 \x01(\x01\x12\r\n\x05\x63lose\x18\x06 \x01(\x01\x12\x0e\n\x06volume\x18\x07 \x01(\x01\"\x93\x02\n\x05Order\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\n\n\x02id\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12#\n\norder_type\x18\x05 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\r\n\x05price\x18\x06 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x10\n\x08quantity\x18\x0b \x01(\t\x12\x19\n\x11\x65xecuted_quantity\x18\x0c \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x0e \x01(\t\x12\x10\n\x08group_id\x18\x0f \x01(\x03\x12\x12\n\ncreated_at\x18\n \x01(\x03\"\xdf\x01\n\x0bSubmitOrder\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x18\n\x04side\x18\x04 \x01(\x0e\x32\n.bbgo.Side\x12\r\n\x05price\x18\x06 \x01(\t\x12\x10\n\x08quantity\x18\x05 \x01(\t\x12\x12\n\nstop_price\x18\x07 \x01(\t\x12#\n\norder_type\x18\x08 \x01(\x0e\x32\x0f.bbgo.OrderType\x12\x17\n\x0f\x63lient_order_id\x18\t \x01(\t\x12\x10\n\x08group_id\x18\n \x01(\x03\"s\n\x07\x42\x61lance\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x10\n\x08\x63urrency\x18\x03 \x01(\t\x12\x11\n\tavailable\x18\x04 \x01(\t\x12\x0e\n\x06locked\x18\x05 \x01(\t\x12\x10\n\x08\x62orrowed\x18\x06 \x01(\t\"O\n\x12SubmitOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12(\n\rsubmit_orders\x18\x02 \x03(\x0b\x32\x11.bbgo.SubmitOrder\"_\n\x13SubmitOrderResponse\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x1b\n\x06orders\x18\x02 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x0b.bbgo.Error\"P\n\x12\x43\x61ncelOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08order_id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"M\n\x13\x43\x61ncelOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"I\n\x11QueryOrderRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x03 \x01(\t\"L\n\x12QueryOrderResponse\x12\x1a\n\x05order\x18\x01 \x01(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xa9\x01\n\x12QueryOrdersRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\r\n\x05state\x18\x03 \x03(\t\x12\x10\n\x08order_by\x18\x04 \x01(\t\x12\x10\n\x08group_id\x18\x05 \x01(\x03\x12\x12\n\npagination\x18\x06 \x01(\x08\x12\x0c\n\x04page\x18\x07 \x01(\x03\x12\r\n\x05limit\x18\x08 \x01(\x03\x12\x0e\n\x06offset\x18\t \x01(\x03\"N\n\x13QueryOrdersResponse\x12\x1b\n\x06orders\x18\x01 \x03(\x0b\x32\x0b.bbgo.Order\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xb6\x01\n\x12QueryTradesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\x03\x12\x0c\n\x04\x66rom\x18\x04 \x01(\x03\x12\n\n\x02to\x18\x05 \x01(\x03\x12\x10\n\x08order_by\x18\x06 \x01(\t\x12\x12\n\npagination\x18\x07 \x01(\x08\x12\x0c\n\x04page\x18\x08 \x01(\x03\x12\r\n\x05limit\x18\t \x01(\x03\x12\x0e\n\x06offset\x18\n \x01(\x03\"N\n\x13QueryTradesResponse\x12\x1b\n\x06trades\x18\x01 \x03(\x0b\x32\x0b.bbgo.Trade\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"}\n\x12QueryKLinesRequest\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x0e\n\x06symbol\x18\x02 \x01(\t\x12\x10\n\x08interval\x18\x03 \x01(\t\x12\x12\n\nstart_time\x18\x04 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x05 \x01(\x03\x12\r\n\x05limit\x18\x06 \x01(\x03\"N\n\x13QueryKLinesResponse\x12\x1b\n\x06klines\x18\x01 \x03(\x0b\x32\x0b.bbgo.KLine\x12\x1a\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x0b.bbgo.Error\"\xce\x01\n\x05KLine\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0c\n\x04open\x18\x04 \x01(\t\x12\x0c\n\x04high\x18\x05 \x01(\t\x12\x0b\n\x03low\x18\x06 \x01(\t\x12\r\n\x05\x63lose\x18\x07 \x01(\t\x12\x0e\n\x06volume\x18\x08 \x01(\t\x12\x14\n\x0cquote_volume\x18\t \x01(\t\x12\x12\n\nstart_time\x18\n \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x0b \x01(\x03\x12\x0e\n\x06\x63losed\x18\x0c \x01(\x08*n\n\x05\x45vent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0e\n\nSUBSCRIBED\x10\x01\x12\x10\n\x0cUNSUBSCRIBED\x10\x02\x12\x0c\n\x08SNAPSHOT\x10\x03\x12\n\n\x06UPDATE\x10\x04\x12\x11\n\rAUTHENTICATED\x10\x05\x12\t\n\x05\x45RROR\x10\x63*M\n\x07\x43hannel\x12\x08\n\x04\x42OOK\x10\x00\x12\t\n\x05TRADE\x10\x01\x12\n\n\x06TICKER\x10\x02\x12\t\n\x05KLINE\x10\x03\x12\x0b\n\x07\x42\x41LANCE\x10\x04\x12\t\n\x05ORDER\x10\x05*\x19\n\x04Side\x12\x07\n\x03\x42UY\x10\x00\x12\x08\n\x04SELL\x10\x01*a\n\tOrderType\x12\n\n\x06MARKET\x10\x00\x12\t\n\x05LIMIT\x10\x01\x12\x0f\n\x0bSTOP_MARKET\x10\x02\x12\x0e\n\nSTOP_LIMIT\x10\x03\x12\r\n\tPOST_ONLY\x10\x04\x12\r\n\tIOC_LIMIT\x10\x05\x32\x94\x01\n\x11MarketDataService\x12\x39\n\tSubscribe\x12\x16.bbgo.SubscribeRequest\x1a\x10.bbgo.MarketData\"\x00\x30\x01\x12\x44\n\x0bQueryKLines\x12\x18.bbgo.QueryKLinesRequest\x1a\x19.bbgo.QueryKLinesResponse\"\x00\x32I\n\x0fUserDataService\x12\x36\n\tSubscribe\x12\x15.bbgo.UserDataRequest\x1a\x0e.bbgo.UserData\"\x00\x30\x01\x32\xeb\x02\n\x0eTradingService\x12\x44\n\x0bSubmitOrder\x12\x18.bbgo.SubmitOrderRequest\x1a\x19.bbgo.SubmitOrderResponse\"\x00\x12\x44\n\x0b\x43\x61ncelOrder\x12\x18.bbgo.CancelOrderRequest\x1a\x19.bbgo.CancelOrderResponse\"\x00\x12\x41\n\nQueryOrder\x12\x17.bbgo.QueryOrderRequest\x1a\x18.bbgo.QueryOrderResponse\"\x00\x12\x44\n\x0bQueryOrders\x12\x18.bbgo.QueryOrdersRequest\x1a\x19.bbgo.QueryOrdersResponse\"\x00\x12\x44\n\x0bQueryTrades\x12\x18.bbgo.QueryTradesRequest\x1a\x19.bbgo.QueryTradesResponse\"\x00\x42\x07Z\x05../pbb\x06proto3') _EVENT = DESCRIPTOR.enum_types_by_name['Event'] Event = enum_type_wrapper.EnumTypeWrapper(_EVENT) @@ -271,14 +271,14 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'Z\005../pb' - _EVENT._serialized_start=3299 - _EVENT._serialized_end=3409 - _CHANNEL._serialized_start=3411 - _CHANNEL._serialized_end=3488 - _SIDE._serialized_start=3490 - _SIDE._serialized_end=3515 - _ORDERTYPE._serialized_start=3517 - _ORDERTYPE._serialized_end=3614 + _EVENT._serialized_start=3305 + _EVENT._serialized_end=3415 + _CHANNEL._serialized_start=3417 + _CHANNEL._serialized_end=3494 + _SIDE._serialized_start=3496 + _SIDE._serialized_end=3521 + _ORDERTYPE._serialized_start=3523 + _ORDERTYPE._serialized_end=3620 _EMPTY._serialized_start=20 _EMPTY._serialized_end=27 _ERROR._serialized_start=29 @@ -312,31 +312,31 @@ if _descriptor._USE_C_DESCRIPTORS == False: _SUBMITORDERRESPONSE._serialized_start=1961 _SUBMITORDERRESPONSE._serialized_end=2056 _CANCELORDERREQUEST._serialized_start=2058 - _CANCELORDERREQUEST._serialized_end=2132 - _CANCELORDERRESPONSE._serialized_start=2134 - _CANCELORDERRESPONSE._serialized_end=2211 - _QUERYORDERREQUEST._serialized_start=2213 - _QUERYORDERREQUEST._serialized_end=2286 - _QUERYORDERRESPONSE._serialized_start=2288 - _QUERYORDERRESPONSE._serialized_end=2364 - _QUERYORDERSREQUEST._serialized_start=2367 - _QUERYORDERSREQUEST._serialized_end=2536 - _QUERYORDERSRESPONSE._serialized_start=2538 - _QUERYORDERSRESPONSE._serialized_end=2616 - _QUERYTRADESREQUEST._serialized_start=2619 - _QUERYTRADESREQUEST._serialized_end=2801 - _QUERYTRADESRESPONSE._serialized_start=2803 - _QUERYTRADESRESPONSE._serialized_end=2881 - _QUERYKLINESREQUEST._serialized_start=2883 - _QUERYKLINESREQUEST._serialized_end=3008 - _QUERYKLINESRESPONSE._serialized_start=3010 - _QUERYKLINESRESPONSE._serialized_end=3088 - _KLINE._serialized_start=3091 - _KLINE._serialized_end=3297 - _MARKETDATASERVICE._serialized_start=3617 - _MARKETDATASERVICE._serialized_end=3765 - _USERDATASERVICE._serialized_start=3767 - _USERDATASERVICE._serialized_end=3840 - _TRADINGSERVICE._serialized_start=3843 - _TRADINGSERVICE._serialized_end=4206 + _CANCELORDERREQUEST._serialized_end=2138 + _CANCELORDERRESPONSE._serialized_start=2140 + _CANCELORDERRESPONSE._serialized_end=2217 + _QUERYORDERREQUEST._serialized_start=2219 + _QUERYORDERREQUEST._serialized_end=2292 + _QUERYORDERRESPONSE._serialized_start=2294 + _QUERYORDERRESPONSE._serialized_end=2370 + _QUERYORDERSREQUEST._serialized_start=2373 + _QUERYORDERSREQUEST._serialized_end=2542 + _QUERYORDERSRESPONSE._serialized_start=2544 + _QUERYORDERSRESPONSE._serialized_end=2622 + _QUERYTRADESREQUEST._serialized_start=2625 + _QUERYTRADESREQUEST._serialized_end=2807 + _QUERYTRADESRESPONSE._serialized_start=2809 + _QUERYTRADESRESPONSE._serialized_end=2887 + _QUERYKLINESREQUEST._serialized_start=2889 + _QUERYKLINESREQUEST._serialized_end=3014 + _QUERYKLINESRESPONSE._serialized_start=3016 + _QUERYKLINESRESPONSE._serialized_end=3094 + _KLINE._serialized_start=3097 + _KLINE._serialized_end=3303 + _MARKETDATASERVICE._serialized_start=3623 + _MARKETDATASERVICE._serialized_end=3771 + _USERDATASERVICE._serialized_start=3773 + _USERDATASERVICE._serialized_end=3846 + _TRADINGSERVICE._serialized_start=3849 + _TRADINGSERVICE._serialized_end=4212 # @@protoc_insertion_point(module_scope) From 4c5843e6c569f97a58be4da373a13bf725eb5455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=81=BF?= Date: Wed, 20 Apr 2022 14:43:23 +0800 Subject: [PATCH 2/2] python: bump version to v0.1.1 --- python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index df2941183..32fdb8fa0 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bbgo" -version = "0.1.0" +version = "0.1.1" description = "" authors = ["なるみ "] packages = [