exchanges-wrapper 2.1.7__tar.gz → 2.1.8__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.7 → exchanges_wrapper-2.1.8}/PKG-INFO +1 -1
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/__init__.py +1 -1
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/client.py +16 -13
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/exch_srv.py +2 -0
- {exchanges_wrapper-2.1.7/exchanges_wrapper → exchanges_wrapper-2.1.8/exchanges_wrapper/parsers}/bybit_parser.py +6 -1
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/web_sockets.py +4 -4
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/LICENSE.md +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/README.md +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/definitions.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/errors.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/events.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/exch_srv_cfg.toml.template +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/http_client.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/lib.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/martin/__init__.py +0 -0
- {exchanges_wrapper-2.1.7/exchanges_wrapper → exchanges_wrapper-2.1.8/exchanges_wrapper/parsers}/bitfinex_parser.py +0 -0
- {exchanges_wrapper-2.1.7/exchanges_wrapper → exchanges_wrapper-2.1.8/exchanges_wrapper/parsers}/huobi_parser.py +0 -0
- {exchanges_wrapper-2.1.7/exchanges_wrapper → exchanges_wrapper-2.1.8/exchanges_wrapper/parsers}/okx_parser.py +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/proto/martin.proto +0 -0
- {exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/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.8
|
|
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.8"
|
|
16
16
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import shutil
|
|
@@ -22,10 +22,10 @@ from exchanges_wrapper.web_sockets import UserEventsDataStream, \
|
|
|
22
22
|
BBTPrivateEventsDataStream
|
|
23
23
|
from exchanges_wrapper.definitions import OrderType
|
|
24
24
|
from exchanges_wrapper.events import Events
|
|
25
|
-
import exchanges_wrapper.bitfinex_parser as bfx
|
|
26
|
-
import exchanges_wrapper.huobi_parser as hbp
|
|
27
|
-
import exchanges_wrapper.okx_parser as okx
|
|
28
|
-
import exchanges_wrapper.bybit_parser as bbt
|
|
25
|
+
import exchanges_wrapper.parsers.bitfinex_parser as bfx
|
|
26
|
+
import exchanges_wrapper.parsers.huobi_parser as hbp
|
|
27
|
+
import exchanges_wrapper.parsers.okx_parser as okx
|
|
28
|
+
import exchanges_wrapper.parsers.bybit_parser as bbt
|
|
29
29
|
from crypto_ws_api.ws_session import UserWSSession
|
|
30
30
|
|
|
31
31
|
logger = logging.getLogger(__name__)
|
|
@@ -117,6 +117,7 @@ class Client:
|
|
|
117
117
|
return res
|
|
118
118
|
|
|
119
119
|
async def load(self, symbol):
|
|
120
|
+
logger.info(f"Try load {self.exchange}:{symbol} info...")
|
|
120
121
|
infos = await self.fetch_exchange_info(symbol)
|
|
121
122
|
if not infos.get('serverTime'):
|
|
122
123
|
raise UserWarning("Can't get exchange info, check availability and operational status of the exchange")
|
|
@@ -144,6 +145,7 @@ class Client:
|
|
|
144
145
|
# load rate limits
|
|
145
146
|
self.rate_limits = infos["rateLimits"]
|
|
146
147
|
self.loaded = True
|
|
148
|
+
logger.info(f"Info for {self.exchange}:{symbol} loaded success")
|
|
147
149
|
|
|
148
150
|
async def close(self):
|
|
149
151
|
await self.session.close()
|
|
@@ -1177,18 +1179,19 @@ class Client:
|
|
|
1177
1179
|
orders = await self.fetch_open_orders(trade_id, symbol, receive_window=receive_window, response_type=True)
|
|
1178
1180
|
orders_id = [order.get('orderId') for order in orders]
|
|
1179
1181
|
params = {'id': orders_id}
|
|
1180
|
-
res = (
|
|
1181
|
-
|
|
1182
|
-
|
|
1182
|
+
res = await self.user_wss_session.handle_request(trade_id, "oc_multi", _params=params)
|
|
1183
|
+
if res is None or (res and isinstance(res, list) and res[6] == 'ERROR'):
|
|
1184
|
+
logger.debug(f"cancel_all_orders.bitfinex {orders_id}: res1: {res}")
|
|
1185
|
+
res = await self.http.send_api_call(
|
|
1183
1186
|
"v2/auth/w/order/cancel/multi",
|
|
1184
1187
|
method="POST",
|
|
1185
1188
|
signed=True,
|
|
1186
|
-
**params
|
|
1187
|
-
|
|
1188
|
-
)
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1189
|
+
**params
|
|
1190
|
+
)
|
|
1191
|
+
if res and isinstance(res, list) and res[6] == 'SUCCESS':
|
|
1192
|
+
binance_res = bfx.orders(res[4], response_type=True, cancelled=True)
|
|
1193
|
+
else:
|
|
1194
|
+
logger.debug(f"bitfinex: cancel_all_orders.res: {res}")
|
|
1192
1195
|
|
|
1193
1196
|
elif self.exchange == 'huobi':
|
|
1194
1197
|
orders = await self.fetch_open_orders(trade_id, symbol, receive_window=receive_window, response_type=True)
|
|
@@ -160,9 +160,11 @@ class Martin(mr.MartinBase):
|
|
|
160
160
|
logger.info(f"OpenClientConnection start trade: {request.account_name}:{request.trade_id}")
|
|
161
161
|
client_id = OpenClient.get_id(request.account_name)
|
|
162
162
|
if client_id:
|
|
163
|
+
logger.debug(f"OpenClientConnection: {request.account_name}:{request.trade_id}:{client_id}")
|
|
163
164
|
open_client = OpenClient.get_client(client_id)
|
|
164
165
|
open_client.client.http.rate_limit_reached = False
|
|
165
166
|
else:
|
|
167
|
+
logger.debug(f"OpenClientConnection: {request.account_name}:{request.trade_id}: set new client_id")
|
|
166
168
|
try:
|
|
167
169
|
open_client = OpenClient(request.account_name)
|
|
168
170
|
client_id = id(open_client)
|
|
@@ -374,7 +374,12 @@ def on_trade_update(res: dict) -> dict:
|
|
|
374
374
|
last_executed_price = res.get("execPrice", res.get("avgPrice"))
|
|
375
375
|
last_quote_asset_transacted = res.get("execValue", cumulative_quote_asset)
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
if leaves_qty == order_quantity:
|
|
378
|
+
status = 'NEW'
|
|
379
|
+
elif leaves_qty > 0:
|
|
380
|
+
status = 'PARTIALLY_FILLED'
|
|
381
|
+
else:
|
|
382
|
+
status = 'FILLED'
|
|
378
383
|
|
|
379
384
|
return {
|
|
380
385
|
"e": "executionReport",
|
|
@@ -10,10 +10,10 @@ from datetime import datetime, timezone
|
|
|
10
10
|
from urllib.parse import urlencode, urlparse
|
|
11
11
|
import websockets
|
|
12
12
|
|
|
13
|
-
import exchanges_wrapper.bitfinex_parser as bfx
|
|
14
|
-
import exchanges_wrapper.huobi_parser as hbp
|
|
15
|
-
import exchanges_wrapper.okx_parser as okx
|
|
16
|
-
import exchanges_wrapper.bybit_parser as bbt
|
|
13
|
+
import exchanges_wrapper.parsers.bitfinex_parser as bfx
|
|
14
|
+
import exchanges_wrapper.parsers.huobi_parser as hbp
|
|
15
|
+
import exchanges_wrapper.parsers.okx_parser as okx
|
|
16
|
+
import exchanges_wrapper.parsers.bybit_parser as bbt
|
|
17
17
|
from crypto_ws_api.ws_session import generate_signature
|
|
18
18
|
from exchanges_wrapper import LOG_PATH
|
|
19
19
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exchanges_wrapper-2.1.7 → exchanges_wrapper-2.1.8}/exchanges_wrapper/exch_srv_cfg.toml.template
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|