Skip to content

Commit 7ca4790

Browse files
author
Sam McHardy
committed
Update to v1.0.8
1 parent 49c5f37 commit 7ca4790

4 files changed

Lines changed: 49 additions & 4 deletions

File tree

PYPIREADME.rst

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
================================
2-
Welcome to python-binance v1.0.7
2+
Welcome to python-binance v1.0.8
33
================================
44

5+
Updated 11th May 2021
6+
57
.. image:: https://img.shields.io/pypi/v/python-binance.svg
68
:target: https://pypi.python.org/pypi/python-binance
79

@@ -95,7 +97,7 @@ pass `testnet=True` when creating the client.
9597
9698
.. code:: python
9799
98-
from binance.client import Client
100+
from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
99101
client = Client(api_key, api_secret)
100102
101103
# get market depth
@@ -144,6 +146,35 @@ pass `testnet=True` when creating the client.
144146
# fetch weekly klines since it listed
145147
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
146148
149+
# socket manager using threads
150+
twm = ThreadedWebsocketManager()
151+
twm.start()
152+
153+
# depth cache manager using threads
154+
dcm = ThreadedDepthCacheManager()
155+
dcm.start()
156+
157+
def handle_socket_message(msg):
158+
print(f"message type: {msg['e']}")
159+
print(msg)
160+
161+
def handle_dcm_message(depth_cache):
162+
print(f"symbol {depth_cache.symbol}")
163+
print("top 5 bids")
164+
print(depth_cache.get_bids()[:5])
165+
print("top 5 asks")
166+
print(depth_cache.get_asks()[:5])
167+
print("last update time {}".format(depth_cache.update_time))
168+
169+
twm.start_kline_socket(callback=handle_socket_message, symbol='BNBBTC')
170+
171+
dcm.start_depth_cache(callback=handle_dcm_message, symbol='ETHBTC')
172+
173+
# replace with a current options symbol
174+
options_symbol = 'BTC-210430-36000-C'
175+
dcm.start_options_depth_cache(callback=handle_dcm_message, symbol=options_symbol)
176+
177+
147178
For more `check out the documentation <https://python-binance.readthedocs.io/en/latest/>`_.
148179

149180
Async Example

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
================================
2-
Welcome to python-binance v1.0.7
2+
Welcome to python-binance v1.0.8
33
================================
44

5+
Updated 11th May 2021
6+
57
.. image:: https://img.shields.io/pypi/v/python-binance.svg
68
:target: https://pypi.python.org/pypi/python-binance
79

binance/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66

7-
__version__ = '1.0.7'
7+
__version__ = '1.0.8'
88

99
from binance.client import Client, AsyncClient # noqa
1010
from binance.depthcache import DepthCacheManager, OptionsDepthCacheManager, ThreadedDepthCacheManager # noqa

docs/changelog.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Changelog
22
=========
33

4+
v1.0.8 - 2021-05-11
5+
^^^^^^^^^^^^^^^^^^^
6+
7+
**Added**
8+
9+
- old style websocket and depth cache managers as option without interacting with asyncio
10+
11+
**Fixed**
12+
13+
- fixed issue with get_historical_klines in Client
14+
- remove print debug line
15+
416
v1.0.7
517
^^^^^^
618

0 commit comments

Comments
 (0)