bbgo_origin/python/README.md

30 lines
545 B
Markdown
Raw Normal View History

2022-03-07 04:06:16 +00:00
# pybbgo
## Installation
```sh
cd <path/to/bbgo/python>
pip install .
```
## Usage
### Stream
```python
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)
2022-03-15 14:10:39 +00:00
stream.on_ticker_event(ticker_event_callback)
2022-03-07 04:06:16 +00:00
...
stream.start()
2022-03-15 14:10:39 +00:00
```