bbgo_origin/python
dependabot[bot] 98145d4dd1
build(deps): bump grpcio from 1.44.0 to 1.53.0 in /python
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>
2023-08-01 12:20:44 +00:00
..
bbgo python: parse balance borrowed 2022-05-16 12:27:53 +08:00
examples python: fix query kline example 2022-04-20 16:13:43 +08:00
tests python: parse balance borrowed 2022-05-16 12:27:53 +08:00
.gitignore Add python gitignore 2022-03-15 18:40:53 +08:00
bbgo_pb2_grpc.py python: update grpc code 2022-04-13 23:22:13 +08:00
bbgo_pb2.py python: add event&channel handlers 2022-04-20 14:33:47 +08:00
poetry.lock build(deps): bump grpcio from 1.44.0 to 1.53.0 in /python 2023-08-01 12:20:44 +00:00
pyproject.toml bump version to 0.1.9 2022-05-16 12:29:09 +08:00
README.md python: update README.md 2022-04-13 23:25:23 +08:00
setup.cfg Add grpc client 2022-03-15 18:43:57 +08:00

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()