python-binance 1.0.22__tar.gz → 1.0.24__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-binance-1.0.22 → python_binance-1.0.24}/PKG-INFO +29 -7
- {python-binance-1.0.22 → python_binance-1.0.24}/README.rst +28 -5
- python_binance-1.0.24/binance/__init__.py +30 -0
- python_binance-1.0.24/binance/async_client.py +3707 -0
- python_binance-1.0.24/binance/base_client.py +493 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/binance/client.py +682 -3455
- {python-binance-1.0.22 → python_binance-1.0.24}/binance/enums.py +1 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/binance/helpers.py +8 -0
- python_binance-1.0.24/binance/ws/__init__.py +0 -0
- python_binance-1.0.24/binance/ws/constants.py +10 -0
- {python-binance-1.0.22/binance → python_binance-1.0.24/binance/ws}/depthcache.py +1 -1
- python_binance-1.0.24/binance/ws/keepalive_websocket.py +93 -0
- python_binance-1.0.24/binance/ws/reconnecting_websocket.py +270 -0
- {python-binance-1.0.22/binance → python_binance-1.0.24/binance/ws}/streams.py +14 -318
- {python-binance-1.0.22/binance → python_binance-1.0.24/binance/ws}/threaded_stream.py +4 -2
- python_binance-1.0.24/binance/ws/websocket_api.py +131 -0
- python_binance-1.0.24/pyproject.toml +8 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/python_binance.egg-info/PKG-INFO +29 -7
- python_binance-1.0.24/python_binance.egg-info/SOURCES.txt +55 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/python_binance.egg-info/requires.txt +0 -1
- python_binance-1.0.24/setup.py +56 -0
- python_binance-1.0.24/tests/test_async_client.py +169 -0
- python_binance-1.0.24/tests/test_async_client_futures.py +581 -0
- python_binance-1.0.24/tests/test_async_client_gift_card copy.py +46 -0
- python_binance-1.0.24/tests/test_async_client_margin.py +562 -0
- python_binance-1.0.24/tests/test_async_client_options.py +123 -0
- python_binance-1.0.24/tests/test_async_client_portfolio.py +398 -0
- python_binance-1.0.24/tests/test_async_client_ws_api.py +76 -0
- python_binance-1.0.24/tests/test_async_client_ws_futures_requests.py +122 -0
- python_binance-1.0.24/tests/test_client.py +185 -0
- python_binance-1.0.24/tests/test_client_futures.py +569 -0
- python_binance-1.0.24/tests/test_client_gift_card.py +62 -0
- python_binance-1.0.24/tests/test_client_margin.py +594 -0
- python_binance-1.0.24/tests/test_client_options.py +123 -0
- python_binance-1.0.24/tests/test_client_portfolio.py +398 -0
- python_binance-1.0.24/tests/test_client_ws_api.py +62 -0
- python_binance-1.0.24/tests/test_client_ws_futures_requests.py +76 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_cryptography.py +4 -4
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_depth_cache.py +1 -1
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_get_order_book.py +13 -22
- python_binance-1.0.24/tests/test_headers.py +92 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_ids.py +83 -10
- python_binance-1.0.24/tests/test_order.py +5 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_ping.py +4 -17
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_streams.py +2 -2
- python_binance-1.0.24/tests/test_ws_api.py +153 -0
- python-binance-1.0.22/binance/__init__.py +0 -12
- python-binance-1.0.22/pyproject.toml +0 -3
- python-binance-1.0.22/python_binance.egg-info/SOURCES.txt +0 -30
- python-binance-1.0.22/setup.py +0 -53
- python-binance-1.0.22/tests/test_client.py +0 -4
- {python-binance-1.0.22 → python_binance-1.0.24}/LICENSE +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/binance/exceptions.py +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/python_binance.egg-info/dependency_links.txt +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/python_binance.egg-info/top_level.txt +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/setup.cfg +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_api_request.py +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_futures.py +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_historical_klines.py +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_socket_manager.py +0 -0
- {python-binance-1.0.22 → python_binance-1.0.24}/tests/test_threaded_socket_manager.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-binance
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.24
|
|
4
4
|
Summary: Binance REST API python implementation
|
|
5
5
|
Home-page: https://github.com/sammchardy/python-binance
|
|
6
6
|
Author: Sam McHardy
|
|
@@ -27,12 +27,11 @@ Requires-Dist: requests
|
|
|
27
27
|
Requires-Dist: six
|
|
28
28
|
Requires-Dist: dateparser
|
|
29
29
|
Requires-Dist: aiohttp
|
|
30
|
-
Requires-Dist: ujson
|
|
31
30
|
Requires-Dist: websockets
|
|
32
31
|
Requires-Dist: pycryptodome
|
|
33
32
|
|
|
34
33
|
=================================
|
|
35
|
-
Welcome to python-binance v1.0.
|
|
34
|
+
Welcome to python-binance v1.0.24
|
|
36
35
|
=================================
|
|
37
36
|
|
|
38
37
|
.. image:: https://img.shields.io/pypi/v/python-binance.svg
|
|
@@ -66,6 +65,9 @@ If you want to automate interactions with Binance stick around.
|
|
|
66
65
|
|
|
67
66
|
**This project is powered by** |ico1|
|
|
68
67
|
|
|
68
|
+
*Please make sure your* `python-binance` *version is* **v.1.0.20** *or higher.*
|
|
69
|
+
*The previous versions are no longer recommended because some endpoints have been deprecated.*
|
|
70
|
+
|
|
69
71
|
Source code
|
|
70
72
|
https://github.com/sammchardy/python-binance
|
|
71
73
|
|
|
@@ -96,8 +98,11 @@ Features
|
|
|
96
98
|
- Testnet support for Spot, Futures and Vanilla Options
|
|
97
99
|
- Simple handling of authentication include RSA and EDDSA keys
|
|
98
100
|
- No need to generate timestamps yourself, the wrapper does it for you
|
|
101
|
+
- RecvWindow sent by default
|
|
99
102
|
- Response exception handling
|
|
103
|
+
- Customizable HTTP headers
|
|
100
104
|
- Websocket handling with reconnection and multiplexed connections
|
|
105
|
+
- CRUD over websockets, create/fetch/edit through websockets for minimum latency.
|
|
101
106
|
- Symbol Depth Cache
|
|
102
107
|
- Historical Kline/Candle fetching function
|
|
103
108
|
- Withdraw functionality
|
|
@@ -106,8 +111,10 @@ Features
|
|
|
106
111
|
- Futures Trading
|
|
107
112
|
- Porfolio Margin Trading
|
|
108
113
|
- Vanilla Options
|
|
109
|
-
- Proxy support
|
|
114
|
+
- Proxy support (REST and WS)
|
|
115
|
+
- Orjson support for faster JSON parsing
|
|
110
116
|
- Support other domains (.us, .jp, etc)
|
|
117
|
+
- Support for the Gift Card API
|
|
111
118
|
|
|
112
119
|
Upgrading to v1.0.0+
|
|
113
120
|
--------------------
|
|
@@ -190,6 +197,12 @@ pass `testnet=True` when creating the client.
|
|
|
190
197
|
# fetch weekly klines since it listed
|
|
191
198
|
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
192
199
|
|
|
200
|
+
# create order through websockets
|
|
201
|
+
order_ws = client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)
|
|
202
|
+
|
|
203
|
+
# get account using custom headers
|
|
204
|
+
account = client.get_account(headers={'MyCustomKey': 'MyCustomValue'})
|
|
205
|
+
|
|
193
206
|
# socket manager using threads
|
|
194
207
|
twm = ThreadedWebsocketManager()
|
|
195
208
|
twm.start()
|
|
@@ -267,10 +280,13 @@ for more information.
|
|
|
267
280
|
print(kline)
|
|
268
281
|
|
|
269
282
|
# fetch 30 minute klines for the last month of 2017
|
|
270
|
-
klines = client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")
|
|
283
|
+
klines = await client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")
|
|
271
284
|
|
|
272
285
|
# fetch weekly klines since it listed
|
|
273
|
-
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
286
|
+
klines = await client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
287
|
+
|
|
288
|
+
# create order through websockets
|
|
289
|
+
order_ws = await client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)
|
|
274
290
|
|
|
275
291
|
# setup an async context the Depth Cache and exit after 5 messages
|
|
276
292
|
async with DepthCacheManager(client, symbol='ETHBTC') as dcm_socket:
|
|
@@ -297,7 +313,6 @@ for more information.
|
|
|
297
313
|
await client.close_connection()
|
|
298
314
|
|
|
299
315
|
if __name__ == "__main__":
|
|
300
|
-
|
|
301
316
|
loop = asyncio.get_event_loop()
|
|
302
317
|
loop.run_until_complete(main())
|
|
303
318
|
|
|
@@ -305,6 +320,13 @@ for more information.
|
|
|
305
320
|
The library is under `MIT license`, that means it's absolutely free for any developer to build commercial and opensource software on top of it, but use it at your own risk with no warranties, as is.
|
|
306
321
|
|
|
307
322
|
|
|
323
|
+
Orjson support
|
|
324
|
+
-------------------
|
|
325
|
+
|
|
326
|
+
Python-binance also supports `orjson` for parsing JSON since it is much faster than the builtin library. This is especially important when using websockets because some exchanges return big messages that need to be parsed and dispatched as quickly as possible.
|
|
327
|
+
|
|
328
|
+
However, `orjson` is not enabled by default because it is not supported by every python interpreter. If you want to opt-in, you just need to install it (`pip install orjson`) on your local environment. Python-binance will detect the installion and pick it up automatically.
|
|
329
|
+
|
|
308
330
|
Star history
|
|
309
331
|
------------
|
|
310
332
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
=================================
|
|
2
|
-
Welcome to python-binance v1.0.
|
|
2
|
+
Welcome to python-binance v1.0.24
|
|
3
3
|
=================================
|
|
4
4
|
|
|
5
5
|
.. image:: https://img.shields.io/pypi/v/python-binance.svg
|
|
@@ -33,6 +33,9 @@ If you want to automate interactions with Binance stick around.
|
|
|
33
33
|
|
|
34
34
|
**This project is powered by** |ico1|
|
|
35
35
|
|
|
36
|
+
*Please make sure your* `python-binance` *version is* **v.1.0.20** *or higher.*
|
|
37
|
+
*The previous versions are no longer recommended because some endpoints have been deprecated.*
|
|
38
|
+
|
|
36
39
|
Source code
|
|
37
40
|
https://github.com/sammchardy/python-binance
|
|
38
41
|
|
|
@@ -63,8 +66,11 @@ Features
|
|
|
63
66
|
- Testnet support for Spot, Futures and Vanilla Options
|
|
64
67
|
- Simple handling of authentication include RSA and EDDSA keys
|
|
65
68
|
- No need to generate timestamps yourself, the wrapper does it for you
|
|
69
|
+
- RecvWindow sent by default
|
|
66
70
|
- Response exception handling
|
|
71
|
+
- Customizable HTTP headers
|
|
67
72
|
- Websocket handling with reconnection and multiplexed connections
|
|
73
|
+
- CRUD over websockets, create/fetch/edit through websockets for minimum latency.
|
|
68
74
|
- Symbol Depth Cache
|
|
69
75
|
- Historical Kline/Candle fetching function
|
|
70
76
|
- Withdraw functionality
|
|
@@ -73,8 +79,10 @@ Features
|
|
|
73
79
|
- Futures Trading
|
|
74
80
|
- Porfolio Margin Trading
|
|
75
81
|
- Vanilla Options
|
|
76
|
-
- Proxy support
|
|
82
|
+
- Proxy support (REST and WS)
|
|
83
|
+
- Orjson support for faster JSON parsing
|
|
77
84
|
- Support other domains (.us, .jp, etc)
|
|
85
|
+
- Support for the Gift Card API
|
|
78
86
|
|
|
79
87
|
Upgrading to v1.0.0+
|
|
80
88
|
--------------------
|
|
@@ -157,6 +165,12 @@ pass `testnet=True` when creating the client.
|
|
|
157
165
|
# fetch weekly klines since it listed
|
|
158
166
|
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
159
167
|
|
|
168
|
+
# create order through websockets
|
|
169
|
+
order_ws = client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)
|
|
170
|
+
|
|
171
|
+
# get account using custom headers
|
|
172
|
+
account = client.get_account(headers={'MyCustomKey': 'MyCustomValue'})
|
|
173
|
+
|
|
160
174
|
# socket manager using threads
|
|
161
175
|
twm = ThreadedWebsocketManager()
|
|
162
176
|
twm.start()
|
|
@@ -234,10 +248,13 @@ for more information.
|
|
|
234
248
|
print(kline)
|
|
235
249
|
|
|
236
250
|
# fetch 30 minute klines for the last month of 2017
|
|
237
|
-
klines = client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")
|
|
251
|
+
klines = await client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")
|
|
238
252
|
|
|
239
253
|
# fetch weekly klines since it listed
|
|
240
|
-
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
254
|
+
klines = await client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
|
|
255
|
+
|
|
256
|
+
# create order through websockets
|
|
257
|
+
order_ws = await client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)
|
|
241
258
|
|
|
242
259
|
# setup an async context the Depth Cache and exit after 5 messages
|
|
243
260
|
async with DepthCacheManager(client, symbol='ETHBTC') as dcm_socket:
|
|
@@ -264,7 +281,6 @@ for more information.
|
|
|
264
281
|
await client.close_connection()
|
|
265
282
|
|
|
266
283
|
if __name__ == "__main__":
|
|
267
|
-
|
|
268
284
|
loop = asyncio.get_event_loop()
|
|
269
285
|
loop.run_until_complete(main())
|
|
270
286
|
|
|
@@ -272,6 +288,13 @@ for more information.
|
|
|
272
288
|
The library is under `MIT license`, that means it's absolutely free for any developer to build commercial and opensource software on top of it, but use it at your own risk with no warranties, as is.
|
|
273
289
|
|
|
274
290
|
|
|
291
|
+
Orjson support
|
|
292
|
+
-------------------
|
|
293
|
+
|
|
294
|
+
Python-binance also supports `orjson` for parsing JSON since it is much faster than the builtin library. This is especially important when using websockets because some exchanges return big messages that need to be parsed and dispatched as quickly as possible.
|
|
295
|
+
|
|
296
|
+
However, `orjson` is not enabled by default because it is not supported by every python interpreter. If you want to opt-in, you just need to install it (`pip install orjson`) on your local environment. Python-binance will detect the installion and pick it up automatically.
|
|
297
|
+
|
|
275
298
|
Star history
|
|
276
299
|
------------
|
|
277
300
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""An unofficial Python wrapper for the Binance exchange API v3
|
|
2
|
+
|
|
3
|
+
.. moduleauthor:: Sam McHardy
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "1.0.24"
|
|
8
|
+
|
|
9
|
+
from binance.async_client import AsyncClient # noqa
|
|
10
|
+
from binance.client import Client # noqa
|
|
11
|
+
from binance.ws.depthcache import (
|
|
12
|
+
DepthCacheManager, # noqa
|
|
13
|
+
OptionsDepthCacheManager, # noqa
|
|
14
|
+
ThreadedDepthCacheManager, # noqa
|
|
15
|
+
)
|
|
16
|
+
from binance.ws.streams import (
|
|
17
|
+
BinanceSocketManager, # noqa
|
|
18
|
+
ThreadedWebsocketManager, # noqa
|
|
19
|
+
BinanceSocketType, # noqa
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from binance.ws.keepalive_websocket import KeepAliveWebsocket # noqa
|
|
23
|
+
|
|
24
|
+
from binance.ws.reconnecting_websocket import ReconnectingWebsocket # noqa
|
|
25
|
+
|
|
26
|
+
from binance.ws.constants import * # noqa
|
|
27
|
+
|
|
28
|
+
from binance.exceptions import * # noqa
|
|
29
|
+
|
|
30
|
+
from binance.enums import * # noqa
|