exchanges-wrapper 2.1.9__tar.gz → 2.1.10__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.
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/PKG-INFO +1 -1
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/__init__.py +1 -1
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/client.py +32 -22
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/bitfinex_parser.py +17 -4
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/LICENSE.md +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/README.md +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/definitions.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/errors.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/events.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/exch_srv.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/exch_srv_cfg.toml.template +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/http_client.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/lib.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/martin/__init__.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/bybit_parser.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/huobi_parser.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/okx_parser.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/proto/martin.proto +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/web_sockets.py +0 -0
- {exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: exchanges-wrapper
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.10
|
|
4
4
|
Summary: REST API and WebSocket asyncio wrapper with grpc powered multiplexer server
|
|
5
5
|
Author-email: Thomas Marchand <thomas.marchand@tuta.io>, Jerry Fedorenko <jerry.fedorenko@yahoo.com>
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -12,7 +12,7 @@ __maintainer__ = "Jerry Fedorenko"
|
|
|
12
12
|
__contact__ = "https://github.com/DogsTailFarmer"
|
|
13
13
|
__email__ = "jerry.fedorenko@yahoo.com"
|
|
14
14
|
__credits__ = ["https://github.com/DanyaSWorlD"]
|
|
15
|
-
__version__ = "2.1.
|
|
15
|
+
__version__ = "2.1.10"
|
|
16
16
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import shutil
|
|
@@ -344,7 +344,7 @@ class Client:
|
|
|
344
344
|
"v2/tickers",
|
|
345
345
|
send_api_key=False,
|
|
346
346
|
endpoint=self.endpoint_api_public,
|
|
347
|
-
symbols=bfx.get_symbols(symbols_details)
|
|
347
|
+
symbols=bfx.get_symbols(symbols_details, symbol)
|
|
348
348
|
)
|
|
349
349
|
if symbols_details and tickers:
|
|
350
350
|
binance_res = bfx.exchange_info(symbols_details, tickers, symbol)
|
|
@@ -879,18 +879,22 @@ class Client:
|
|
|
879
879
|
if new_client_order_id:
|
|
880
880
|
params["cid"] = new_client_order_id
|
|
881
881
|
self.active_order(new_client_order_id, quantity)
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
882
|
+
|
|
883
|
+
res = await self.user_wss_session.handle_request(trade_id, "on", _params=params)
|
|
884
|
+
|
|
885
|
+
if not res or (res and isinstance(res, list) and res[6] != 'SUCCESS'):
|
|
886
|
+
logger.debug(f"create_order.bitfinex {new_client_order_id}: {res}")
|
|
887
|
+
res = await self.http.send_api_call(
|
|
888
|
+
"v2/auth/w/order/submit",
|
|
889
|
+
method="POST",
|
|
890
|
+
signed=True,
|
|
891
|
+
**params
|
|
892
|
+
)
|
|
891
893
|
if res and isinstance(res, list) and res[6] == 'SUCCESS':
|
|
892
894
|
self.active_order(res[4][0][0], quantity)
|
|
893
895
|
binance_res = bfx.order(res[4][0], response_type=False)
|
|
896
|
+
else:
|
|
897
|
+
logger.debug(f"create_order.bitfinex {new_client_order_id}: {res}")
|
|
894
898
|
elif self.exchange == 'huobi':
|
|
895
899
|
params = {
|
|
896
900
|
'account-id': str(self.account_id),
|
|
@@ -966,9 +970,7 @@ class Client:
|
|
|
966
970
|
response_type=None,
|
|
967
971
|
):
|
|
968
972
|
self.assert_symbol(symbol)
|
|
969
|
-
if
|
|
970
|
-
raise ValueError("This query requires an order_id")
|
|
971
|
-
elif self.exchange in ('binance', 'huobi', 'okx', 'bybit') and not order_id and not origin_client_order_id:
|
|
973
|
+
if not order_id and not origin_client_order_id:
|
|
972
974
|
raise ValueError("This query requires an order_id or an origin_client_order_id")
|
|
973
975
|
|
|
974
976
|
b_res = {}
|
|
@@ -995,20 +997,28 @@ class Client:
|
|
|
995
997
|
)
|
|
996
998
|
)
|
|
997
999
|
elif self.exchange == 'bitfinex':
|
|
998
|
-
params = {
|
|
999
|
-
|
|
1000
|
+
params = {}
|
|
1001
|
+
if order_id:
|
|
1002
|
+
params['id'] = [order_id]
|
|
1003
|
+
_res = await self.http.send_api_call(
|
|
1000
1004
|
f"v2/auth/r/orders/{self.symbol_to_bfx(symbol)}",
|
|
1001
1005
|
method="POST",
|
|
1002
1006
|
signed=True,
|
|
1003
1007
|
**params
|
|
1004
|
-
) or await self.http.send_api_call(
|
|
1005
|
-
f"v2/auth/r/orders/{self.symbol_to_bfx(symbol)}/hist",
|
|
1006
|
-
method="POST",
|
|
1007
|
-
signed=True,
|
|
1008
|
-
**params
|
|
1009
1008
|
)
|
|
1009
|
+
res = bfx.find_order(_res, order_id, origin_client_order_id)
|
|
1010
|
+
if not res:
|
|
1011
|
+
if not order_id:
|
|
1012
|
+
params['start'] = int(time.time() * 1000) - 600000 # 10 mins
|
|
1013
|
+
_res = await self.http.send_api_call(
|
|
1014
|
+
f"v2/auth/r/orders/{self.symbol_to_bfx(symbol)}/hist",
|
|
1015
|
+
method="POST",
|
|
1016
|
+
signed=True,
|
|
1017
|
+
**params
|
|
1018
|
+
)
|
|
1019
|
+
res = bfx.find_order(_res, order_id, origin_client_order_id)
|
|
1010
1020
|
if res:
|
|
1011
|
-
b_res = bfx.order(res
|
|
1021
|
+
b_res = bfx.order(res, response_type=response_type)
|
|
1012
1022
|
self.active_order(b_res['orderId'], b_res['origQty'], b_res['executedQty'])
|
|
1013
1023
|
elif self.exchange == 'huobi':
|
|
1014
1024
|
if origin_client_order_id:
|
|
@@ -1185,7 +1195,7 @@ class Client:
|
|
|
1185
1195
|
orders_id = [order.get('orderId') for order in orders]
|
|
1186
1196
|
params = {'id': orders_id}
|
|
1187
1197
|
res = await self.user_wss_session.handle_request(trade_id, "oc_multi", _params=params)
|
|
1188
|
-
if res
|
|
1198
|
+
if not res or (res and isinstance(res, list) and res[6] != 'SUCCESS'):
|
|
1189
1199
|
logger.debug(f"cancel_all_orders.bitfinex {orders_id}: res1: {res}")
|
|
1190
1200
|
res = await self.http.send_api_call(
|
|
1191
1201
|
"v2/auth/w/order/cancel/multi",
|
{exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/bitfinex_parser.py
RENAMED
|
@@ -50,13 +50,13 @@ class OrderBook:
|
|
|
50
50
|
return self
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
def get_symbols(symbols_details: []) -> str:
|
|
53
|
+
def get_symbols(symbols_details: [], symbol) -> str:
|
|
54
54
|
symbols = []
|
|
55
55
|
res = ",t"
|
|
56
56
|
for symbol_details in symbols_details:
|
|
57
|
-
|
|
58
|
-
if 'f0' not in symbol:
|
|
59
|
-
symbols.append(
|
|
57
|
+
_symbol = symbol_details['pair']
|
|
58
|
+
if 'f0' not in _symbol and _symbol.replace(":", "").upper() == symbol:
|
|
59
|
+
symbols.append(_symbol.upper())
|
|
60
60
|
return f"t{res.join(symbols)}"
|
|
61
61
|
|
|
62
62
|
|
|
@@ -623,3 +623,16 @@ def funding_wallet(res: []) -> []:
|
|
|
623
623
|
balances.append(_binance_res)
|
|
624
624
|
|
|
625
625
|
return balances
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
def find_order(_res, order_id, origin_client_order_id):
|
|
629
|
+
res = []
|
|
630
|
+
if _res:
|
|
631
|
+
if order_id:
|
|
632
|
+
res = _res[0]
|
|
633
|
+
else:
|
|
634
|
+
for i in _res:
|
|
635
|
+
if i[2] == int(origin_client_order_id):
|
|
636
|
+
res = i
|
|
637
|
+
break
|
|
638
|
+
return res
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/exch_srv_cfg.toml.template
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/bybit_parser.py
RENAMED
|
File without changes
|
{exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/huobi_parser.py
RENAMED
|
File without changes
|
{exchanges_wrapper-2.1.9 → exchanges_wrapper-2.1.10}/exchanges_wrapper/parsers/okx_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|