mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
98145d4dd1
Bumps [grpcio](https://github.com/grpc/grpc) from 1.44.0 to 1.53.0. - [Release notes](https://github.com/grpc/grpc/releases) - [Changelog](https://github.com/grpc/grpc/blob/master/doc/grpc_release_schedule.md) - [Commits](https://github.com/grpc/grpc/compare/v1.44.0...v1.53.0) --- updated-dependencies: - dependency-name: grpcio dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
bbgo | ||
examples | ||
tests | ||
.gitignore | ||
bbgo_pb2_grpc.py | ||
bbgo_pb2.py | ||
poetry.lock | ||
pyproject.toml | ||
README.md | ||
setup.cfg |
pybbgo
Installation
cd <path/to/bbgo/python>
pip install .
Usage
Stream
from loguru import logger
from bbgo import Stream
from bbgo.data import Event
from bbgo.handlers import UpdateHandler
class LogBook(UpdateHandler):
def handle(self, event: Event) -> None:
logger.info(event)
host = '127.0.0.1'
port = 50051
stream = Stream(host, port)
stream.subscribe('max', 'book', 'BTCUSDT', 'full')
stream.subscribe('max', 'book', 'ETHUSDT', 'full')
stream.add_event_handler(LogBook())
stream.start()