mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
29 lines
544 B
Markdown
29 lines
544 B
Markdown
|
# 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)
|
||
|
stream.on_ticker_event(tocker_event_callback)
|
||
|
...
|
||
|
stream.start()
|
||
|
```
|