Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add crudWs #1464

Merged
merged 42 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0690e7e
first commit
pcriadoperez Nov 4, 2024
ddf5336
ruff check fix
pcriadoperez Nov 4, 2024
35de8fd
ruff format fix
pcriadoperez Nov 4, 2024
7e9d62c
fix lint warnings and error
pcriadoperez Nov 4, 2024
5672f01
type fix for 3.7
pcriadoperez Nov 4, 2024
2e54921
add testnet to test_Ws_api
pcriadoperez Nov 4, 2024
c437f56
change to testnet
pcriadoperez Nov 4, 2024
16dcd9a
ruff@
pcriadoperez Nov 4, 2024
2af3198
return test to async in test
pcriadoperez Nov 4, 2024
4a1d47c
format with ruff
carlosmiei Nov 4, 2024
752bfde
remove blank line
carlosmiei Nov 4, 2024
ae652c8
remove default tif
carlosmiei Nov 4, 2024
a9a962f
add ws_futures, refactor and add tests
pcriadoperez Nov 11, 2024
7f31a7e
lint
pcriadoperez Nov 11, 2024
0df07f1
fix tests
pcriadoperez Nov 11, 2024
a65a45b
ruff
pcriadoperez Nov 11, 2024
2239151
add tests
pcriadoperez Nov 11, 2024
9824956
remove utils
pcriadoperez Nov 11, 2024
3a62a2a
ruff format and pr comments
pcriadoperez Nov 11, 2024
37a585e
ruff format
pcriadoperez Nov 11, 2024
266e83d
fix live tests and add env vars for testnet
pcriadoperez Nov 11, 2024
bf0c0d5
github action
pcriadoperez Nov 11, 2024
3f0f26a
add tox env
pcriadoperez Nov 11, 2024
460e449
fix and test without tox
pcriadoperez Nov 12, 2024
e8dd66f
move tox command
pcriadoperez Nov 12, 2024
85a4ab0
fix test
pcriadoperez Nov 13, 2024
f0f58be
fix pyright
pcriadoperez Nov 13, 2024
1a96b52
type ignore
pcriadoperez Nov 13, 2024
7fb9662
jump test until whitelist
pcriadoperez Nov 13, 2024
057a53d
Merge branch 'master' of https://github.com/sammchardy/python-binance…
pcriadoperez Nov 15, 2024
ff8ee83
remove print
carlosmiei Nov 16, 2024
dfa3b10
add examples
carlosmiei Nov 16, 2024
010cef5
improve docs
carlosmiei Nov 16, 2024
faa6dfc
lint and format
pcriadoperez Nov 17, 2024
86998ff
Merge branch 'master' of https://github.com/sammchardy/python-binance…
pcriadoperez Nov 17, 2024
c5fda09
lint and format
pcriadoperez Nov 17, 2024
6968df2
add tests for failed requests
pcriadoperez Nov 19, 2024
f23b030
fix for 3.7
pcriadoperez Nov 19, 2024
f87b0d3
merge master
pcriadoperez Nov 20, 2024
d82a8b6
merge master
pcriadoperez Nov 20, 2024
0c08191
lint and format
pcriadoperez Nov 20, 2024
73afa84
pyright
pcriadoperez Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
runs-on: ubuntu-latest
env:
PROXY: "http://51.83.140.52:16301"
TEST_TESTNET: "true"
TEST_API_KEY: "u4L8MG2DbshTfTzkx2Xm7NfsHHigvafxeC29HrExEmah1P8JhxXkoOu6KntLICUc"
TEST_API_SECRET: "hBZEqhZUUS6YZkk7AIckjJ3iLjrgEFr5CRtFPp5gjzkrHKKC9DAv4OH25PlT6yq5"
TEST_FUTURES_API_KEY: "227719da8d8499e8d3461587d19f259c0b39c2b462a77c9b748a6119abd74401"
TEST_FUTURES_API_SECRET: "b14b935f9cfacc5dec829008733c40da0588051f29a44625c34967b45c11d73c"
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
Expand Down
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Features
- No need to generate timestamps yourself, the wrapper does it for you
- Response exception handling
- Websocket handling with reconnection and multiplexed connections
- CRUDE over websockets, create/fetch/edit through websockets for minimum latency.
- Symbol Depth Cache
- Historical Kline/Candle fetching function
- Withdraw functionality
Expand Down Expand Up @@ -160,6 +161,9 @@ pass `testnet=True` when creating the client.
# fetch weekly klines since it listed
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")

# create order through websockets
order_ws = client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)

# socket manager using threads
twm = ThreadedWebsocketManager()
twm.start()
Expand Down Expand Up @@ -237,10 +241,13 @@ for more information.
print(kline)

# fetch 30 minute klines for the last month of 2017
klines = client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")
klines = await client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")

# fetch weekly klines since it listed
klines = client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")
klines = await client.get_historical_klines("NEOBTC", Client.KLINE_INTERVAL_1WEEK, "1 Jan, 2017")

# create order through websockets
order_ws = await client.ws_create_order( symbol="LTCUSDT", side="BUY", type="MARKET", quantity=0.1)

# setup an async context the Depth Cache and exit after 5 messages
async with DepthCacheManager(client, symbol='ETHBTC') as dcm_socket:
Expand Down
17 changes: 13 additions & 4 deletions binance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@

__version__ = "1.0.22"

from binance.client import Client, AsyncClient # noqa
from binance.depthcache import DepthCacheManager, OptionsDepthCacheManager, ThreadedDepthCacheManager # noqa
from binance.streams import BinanceSocketManager, ThreadedWebsocketManager, BinanceSocketType # noqa
from binance.enums import * # noqa
from binance.async_client import AsyncClient # noqa
from binance.client import Client # noqa
from binance.ws.depthcache import (
DepthCacheManager, # noqa
OptionsDepthCacheManager, # noqa
ThreadedDepthCacheManager, # noqa
)
from binance.ws.streams import (
BinanceSocketManager, # noqa
ThreadedWebsocketManager, # noqa
BinanceSocketType, # noqa
)
from binance.enums import * # noqa
Loading
Loading