exchanges-wrapper 2.1.2__tar.gz → 2.1.3__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.2 → exchanges_wrapper-2.1.3}/PKG-INFO +1 -1
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/__init__.py +1 -1
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/exch_srv.py +9 -8
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/http_client.py +3 -3
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/LICENSE.md +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/README.md +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/bitfinex_parser.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/bybit_parser.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/client.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/definitions.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/errors.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/events.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/exch_srv_cfg.toml.template +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/huobi_parser.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/lib.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/martin/__init__.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/okx_parser.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/proto/martin.proto +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/exchanges_wrapper/web_sockets.py +0 -0
- {exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/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.3
|
|
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.3"
|
|
16
16
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import shutil
|
|
@@ -700,7 +700,7 @@ class Martin(mr.MartinBase):
|
|
|
700
700
|
else:
|
|
701
701
|
event = vars(_event)
|
|
702
702
|
event.pop('handlers', None)
|
|
703
|
-
logger.debug(f"OnOrderUpdate: {open_client.name}: {event}")
|
|
703
|
+
# logger.debug(f"OnOrderUpdate: {open_client.name}: {event}")
|
|
704
704
|
response.success = True
|
|
705
705
|
response.result = json.dumps(event)
|
|
706
706
|
yield response
|
|
@@ -709,7 +709,7 @@ class Martin(mr.MartinBase):
|
|
|
709
709
|
async def create_limit_order(self, request: mr.CreateLimitOrderRequest) -> mr.CreateLimitOrderResponse:
|
|
710
710
|
response = mr.CreateLimitOrderResponse()
|
|
711
711
|
|
|
712
|
-
res, _,
|
|
712
|
+
res, _, _ = await self.send_request(
|
|
713
713
|
'create_order',
|
|
714
714
|
request,
|
|
715
715
|
rate_limit=True,
|
|
@@ -730,13 +730,12 @@ class Martin(mr.MartinBase):
|
|
|
730
730
|
)
|
|
731
731
|
|
|
732
732
|
response.from_pydict(res)
|
|
733
|
-
logger.debug(f"{msg_header}: order created: {res.get('orderId')}")
|
|
734
733
|
return response
|
|
735
734
|
|
|
736
735
|
async def cancel_order(self, request: mr.CancelOrderRequest) -> mr.CancelOrderResponse:
|
|
737
736
|
response = mr.CancelOrderResponse()
|
|
738
737
|
|
|
739
|
-
res, _,
|
|
738
|
+
res, _, _ = await self.send_request(
|
|
740
739
|
'cancel_order',
|
|
741
740
|
request,
|
|
742
741
|
rate_limit=True,
|
|
@@ -748,7 +747,6 @@ class Martin(mr.MartinBase):
|
|
|
748
747
|
receive_window=None
|
|
749
748
|
)
|
|
750
749
|
|
|
751
|
-
logger.debug(f"{msg_header}: order canceled: {res}")
|
|
752
750
|
response.from_pydict(res)
|
|
753
751
|
return response
|
|
754
752
|
|
|
@@ -846,17 +844,20 @@ async def amain(host: str = '127.0.0.1', port: int = 50051):
|
|
|
846
844
|
logger.info(f"Starting server v:{__version__} on {host}:{port}")
|
|
847
845
|
await server.wait_closed()
|
|
848
846
|
|
|
849
|
-
[task.cancel() for task in asyncio.all_tasks() if not task.done()]
|
|
850
|
-
|
|
851
847
|
for oc in OpenClient.open_clients:
|
|
852
848
|
await oc.client.session.close()
|
|
853
849
|
|
|
850
|
+
[task.cancel() for task in asyncio.all_tasks() if not task.done()]
|
|
851
|
+
|
|
854
852
|
|
|
855
853
|
def main():
|
|
856
854
|
try:
|
|
857
855
|
asyncio.run(amain())
|
|
858
|
-
except asyncio.CancelledError:
|
|
856
|
+
except asyncio.exceptions.CancelledError:
|
|
859
857
|
pass # # Task cancellation should not be logged as an error
|
|
858
|
+
except Exception as ex:
|
|
859
|
+
print(f"Exception: {ex}")
|
|
860
|
+
print(traceback.format_exc())
|
|
860
861
|
|
|
861
862
|
|
|
862
863
|
if __name__ == '__main__':
|
|
@@ -48,16 +48,16 @@ class HttpClient:
|
|
|
48
48
|
payload = None
|
|
49
49
|
|
|
50
50
|
if response.status >= 400:
|
|
51
|
-
# TODO different handling for errors in the exchange and transport layers [400 Bad Request]
|
|
52
|
-
logger.debug(f"handle_errors: payload: {payload}, response: {response.text}")
|
|
53
51
|
if response.status == 400 and payload and payload.get("error", str()) == "ERR_RATE_LIMIT":
|
|
54
52
|
raise RateLimitReached(RateLimitReached.message)
|
|
53
|
+
elif response.status == 400 and response.reason != "Bad Request":
|
|
54
|
+
raise ExchangeError(f"ExchangeError: {payload}:{response.reason}:{response.text}")
|
|
55
55
|
elif response.status == 403 and self.exchange != 'okx':
|
|
56
56
|
raise WAFLimitViolated(WAFLimitViolated.message)
|
|
57
57
|
elif response.status == 418:
|
|
58
58
|
raise IPAddressBanned(IPAddressBanned.message)
|
|
59
59
|
else:
|
|
60
|
-
raise HTTPError(f"Malformed request:
|
|
60
|
+
raise HTTPError(f"Malformed request: {payload}:{response.reason}:{response.text}")
|
|
61
61
|
|
|
62
62
|
if self.exchange == 'bybit' and payload and payload.get('retCode') == 0:
|
|
63
63
|
return payload.get('result'), payload.get('time')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exchanges_wrapper-2.1.2 → exchanges_wrapper-2.1.3}/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
|