bbgo_origin/python
2022-04-13 23:20:57 +08:00
..
bbgo python: fix lint 2022-04-13 23:20:57 +08:00
tests python: fix examples 2022-04-13 23:20:57 +08:00
.gitignore Add python gitignore 2022-03-15 18:40:53 +08:00
bbgo_pb2_grpc.py Move bbgo_pb2 files and add them to packages 2022-04-10 02:04:06 +08:00
bbgo_pb2.py python: add enum and data classess 2022-04-13 23:20:57 +08:00
poetry.lock Add grpc client 2022-03-15 18:43:57 +08:00
pyproject.toml Move bbgo_pb2 files and add them to packages 2022-04-10 02:04:06 +08:00
query_klines.py python: fix lint 2022-04-13 23:20:57 +08:00
README.md fix: readme typo 2022-03-15 22:10:39 +08:00
setup.cfg Add grpc client 2022-03-15 18:43:57 +08:00
stream.py python: simplify event handler 2022-04-13 23:20:57 +08:00
subscribe.py python: fix market service 2022-04-13 23:20:57 +08:00

pybbgo

Installation

cd <path/to/bbgo/python>
pip install .

Usage

Stream

from bbgo import Stream
from bbgo import bbgo_pb2

subscriptions = [
    bbgo_pb2.Subscription(exchange='max', channel=bbgo_pb2.Channel.BOOK, symbol='btcusdt', depth=2),
    bbgo_pb2.Subscription(exchange='max', channel=bbgo_pb2.Channel.BOOK, symbol='ethusdt', depth=2),
    ...
]

stream = Stream(host, port, subscriptions)
stream.on_book_event(book_event_callback)
stream.on_ticker_event(ticker_event_callback)
...
stream.start()