bbgo_origin/python
2022-05-16 12:29:09 +08:00
..
bbgo
examples
tests
.gitignore
bbgo_pb2_grpc.py
bbgo_pb2.py
poetry.lock
pyproject.toml bump version to 0.1.9 2022-05-16 12:29:09 +08:00
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()