exchanges-wrapper 2.1.25__tar.gz → 2.1.26__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.25 → exchanges_wrapper-2.1.26}/PKG-INFO +1 -1
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/__init__.py +1 -1
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/client.py +1 -1
- exchanges_wrapper-2.1.25/.deepsource.toml +0 -13
- exchanges_wrapper-2.1.25/.dockerignore +0 -3
- exchanges_wrapper-2.1.25/.github/FUNDING.yml +0 -1
- exchanges_wrapper-2.1.25/.github/dependabot.yml +0 -11
- exchanges_wrapper-2.1.25/.github/workflows/docker-image.yml +0 -32
- exchanges_wrapper-2.1.25/.github/workflows/python-publish.yml +0 -40
- exchanges_wrapper-2.1.25/.run/exchanges-wrapper-image.run.xml +0 -15
- exchanges_wrapper-2.1.25/.run/exchanges-wrapper.run.xml +0 -32
- exchanges_wrapper-2.1.25/CHANGELOG.md +0 -621
- exchanges_wrapper-2.1.25/Dockerfile +0 -23
- exchanges_wrapper-2.1.25/example/exch_client.py +0 -436
- exchanges_wrapper-2.1.25/example/ms_cfg.toml +0 -5
- exchanges_wrapper-2.1.25/requirements.txt +0 -10
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/LICENSE.md +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/README.md +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/definitions.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/errors.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/events.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/exch_srv.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/exch_srv_cfg.toml.template +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/http_client.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/lib.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/martin/__init__.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/parsers/bitfinex.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/parsers/bybit.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/parsers/huobi.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/parsers/okx.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/proto/martin.proto +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/exchanges_wrapper/web_sockets.py +0 -0
- {exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: exchanges-wrapper
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.26
|
|
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.26"
|
|
16
16
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import shutil
|
|
@@ -987,7 +987,7 @@ class Client:
|
|
|
987
987
|
except ExchangeError as ex:
|
|
988
988
|
# https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id
|
|
989
989
|
# If an order is created via API, then it's no longer queryable after being cancelled for 2 hours
|
|
990
|
-
if "base-record-invalid" in ex:
|
|
990
|
+
if "base-record-invalid" in str(ex):
|
|
991
991
|
return hbp.order_cancelled(symbol, order_id, origin_client_order_id)
|
|
992
992
|
else:
|
|
993
993
|
raise
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
custom: ['https://github.com/DogsTailFarmer/exchanges-wrapper#donate']
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "pip" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "weekly"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: Docker Image CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
release:
|
|
6
|
-
types: [published]
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout
|
|
13
|
-
uses: actions/checkout@v3
|
|
14
|
-
|
|
15
|
-
- name: PrepareReg Names
|
|
16
|
-
run: |
|
|
17
|
-
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
|
|
18
|
-
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV
|
|
19
|
-
|
|
20
|
-
- name: Login to GHCR
|
|
21
|
-
uses: docker/login-action@v2
|
|
22
|
-
with:
|
|
23
|
-
registry: ghcr.io
|
|
24
|
-
username: ${{ github.repository_owner }}
|
|
25
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
26
|
-
|
|
27
|
-
- name: Build and push
|
|
28
|
-
run: |
|
|
29
|
-
docker build . --tag ghcr.io/$IMAGE_REPOSITORY:$IMAGE_TAG
|
|
30
|
-
docker push ghcr.io/$IMAGE_REPOSITORY:$IMAGE_TAG
|
|
31
|
-
docker build . --tag ghcr.io/$IMAGE_REPOSITORY:latest
|
|
32
|
-
docker push ghcr.io/$IMAGE_REPOSITORY:latest
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
-
|
|
4
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
-
# They are provided by a third-party and are governed by
|
|
6
|
-
# separate terms of service, privacy policy, and support
|
|
7
|
-
# documentation.
|
|
8
|
-
|
|
9
|
-
name: Upload Python Package
|
|
10
|
-
|
|
11
|
-
on:
|
|
12
|
-
workflow_dispatch:
|
|
13
|
-
release:
|
|
14
|
-
types: [published]
|
|
15
|
-
|
|
16
|
-
permissions:
|
|
17
|
-
contents: read
|
|
18
|
-
|
|
19
|
-
jobs:
|
|
20
|
-
deploy:
|
|
21
|
-
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v3
|
|
26
|
-
- name: Set up Python
|
|
27
|
-
uses: actions/setup-python@v3
|
|
28
|
-
with:
|
|
29
|
-
python-version: '3.x'
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: |
|
|
32
|
-
python -m pip install --upgrade pip
|
|
33
|
-
pip install build
|
|
34
|
-
- name: Build package
|
|
35
|
-
run: python -m build
|
|
36
|
-
- name: Publish package
|
|
37
|
-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
38
|
-
with:
|
|
39
|
-
user: __token__
|
|
40
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="exchanges-wrapper-image" type="docker-deploy" factoryName="dockerfile" editBeforeRun="true" server-name="Docker">
|
|
3
|
-
<deployment type="dockerfile">
|
|
4
|
-
<settings>
|
|
5
|
-
<option name="imageTag" value="exchanges-wrapper:last" />
|
|
6
|
-
<option name="buildCliOptions" value="--no-cache --network=host" />
|
|
7
|
-
<option name="buildOnly" value="true" />
|
|
8
|
-
<option name="containerName" value="" />
|
|
9
|
-
<option name="showCommandPreview" value="true" />
|
|
10
|
-
<option name="sourceFilePath" value="Dockerfile" />
|
|
11
|
-
</settings>
|
|
12
|
-
</deployment>
|
|
13
|
-
<method v="2" />
|
|
14
|
-
</configuration>
|
|
15
|
-
</component>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="exchanges-wrapper" type="docker-deploy" factoryName="docker-image" editBeforeRun="true" server-name="Docker">
|
|
3
|
-
<deployment type="docker-image">
|
|
4
|
-
<settings>
|
|
5
|
-
<option name="imageTag" value="ghcr.io/dogstailfarmer/exchanges-wrapper:latest" />
|
|
6
|
-
<option name="containerName" value="exchanges-wrapper" />
|
|
7
|
-
<option name="commandLineOptions" value="-i -t -P" />
|
|
8
|
-
<option name="showCommandPreview" value="true" />
|
|
9
|
-
<option name="volumeBindings">
|
|
10
|
-
<list>
|
|
11
|
-
<DockerVolumeBindingImpl>
|
|
12
|
-
<option name="containerPath" value="$PROJECT_DIR$/../../../appuser/.MartinBinance" />
|
|
13
|
-
<option name="hostPath" value="$USER_HOME$/.MartinBinance" />
|
|
14
|
-
</DockerVolumeBindingImpl>
|
|
15
|
-
</list>
|
|
16
|
-
</option>
|
|
17
|
-
</settings>
|
|
18
|
-
</deployment>
|
|
19
|
-
<method v="2" />
|
|
20
|
-
</configuration>
|
|
21
|
-
<configuration default="false" name="exchanges-wrapper" type="docker-deploy" factoryName="docker-image" editBeforeRun="true" server-name="Docker">
|
|
22
|
-
<deployment type="docker-image">
|
|
23
|
-
<settings>
|
|
24
|
-
<option name="imageTag" value="exchanges-wrapper:last" />
|
|
25
|
-
<option name="containerName" value="exchanges-wrapper" />
|
|
26
|
-
<option name="commandLineOptions" value="-i -t -P --mount type=bind,source=$USER_HOME$/.MartinBinance,target=$PROJECT_DIR$/../../../appuser/.MartinBinance --network=host" />
|
|
27
|
-
<option name="showCommandPreview" value="true" />
|
|
28
|
-
</settings>
|
|
29
|
-
</deployment>
|
|
30
|
-
<method v="2" />
|
|
31
|
-
</configuration>
|
|
32
|
-
</component>
|
|
@@ -1,621 +0,0 @@
|
|
|
1
|
-
## 2.1.25 2025-01-17
|
|
2
|
-
### Update
|
|
3
|
-
* Some minor improvements
|
|
4
|
-
|
|
5
|
-
## 2.1.24 2025-01-16
|
|
6
|
-
### Fix
|
|
7
|
-
* `HTX`: `fetch_order`:
|
|
8
|
-
https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id
|
|
9
|
-
If an order is created via API, then it's no longer queryable after being cancelled for 2 hours
|
|
10
|
-
* `Bitfinex`: improving the generation and control of `nonce` values for authorized HTTP requests
|
|
11
|
-
|
|
12
|
-
## 2.1.23 2025-01-14
|
|
13
|
-
### Fix
|
|
14
|
-
* `web_sockets` module logging
|
|
15
|
-
|
|
16
|
-
## 2.1.21 2025-01-13
|
|
17
|
-
### Update
|
|
18
|
-
* Structure optimization
|
|
19
|
-
* Bump requirements
|
|
20
|
-
* `ByBit`: `on_funds_update`: `availableToWithdraw`: this field is deprecated for accountType=UNIFIED
|
|
21
|
-
|
|
22
|
-
## 2.1.20 2024-09-14
|
|
23
|
-
### Fix
|
|
24
|
-
* Downgraded `betterproto` to `2.0.0b6`
|
|
25
|
-
|
|
26
|
-
## 2.1.19 2024-09-13
|
|
27
|
-
### Fix
|
|
28
|
-
* `pyproject.toml`
|
|
29
|
-
|
|
30
|
-
## 2.1.18 2024-09-13
|
|
31
|
-
### Fix
|
|
32
|
-
* Dependency conflict
|
|
33
|
-
|
|
34
|
-
## 2.1.17 2024-09-13
|
|
35
|
-
### Update
|
|
36
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.13
|
|
37
|
-
|
|
38
|
-
## 2.1.16 2024-09-13
|
|
39
|
-
### Fix
|
|
40
|
-
* `OKX`: get_exchange_info: <class 'decimal.ConversionSyntax'> [#82](https://github.com/DogsTailFarmer/martin-binance/issues/82#issue-2467548368)
|
|
41
|
-
|
|
42
|
-
### Update
|
|
43
|
-
* `HTX`: monitoring PING interval from server for each WSS channel and restart if timing out
|
|
44
|
-
* Dependency
|
|
45
|
-
|
|
46
|
-
## 2.1.15 2024-07-12
|
|
47
|
-
### Added for new features
|
|
48
|
-
* `Binance`: add method `transfer_to_sub()`. See use example in `example/exch_client.py`
|
|
49
|
-
|
|
50
|
-
## 2.1.14 2024-07-07
|
|
51
|
-
### Fix
|
|
52
|
-
* `Bybit`: `fetch_ledgers()` doubling of incoming transfers to a subaccount
|
|
53
|
-
|
|
54
|
-
## 2.1.13 2024-06-26
|
|
55
|
-
### Fix
|
|
56
|
-
* `HTX`: WSS missed account change event
|
|
57
|
-
|
|
58
|
-
### Update
|
|
59
|
-
* Dependency
|
|
60
|
-
|
|
61
|
-
## 2.1.12 2024-04-30
|
|
62
|
-
### Fix
|
|
63
|
-
* `Docker`: [#49 ImportError: cannot import name 'version' from 'exchanges_wrapper'](https://github.com/DogsTailFarmer/exchanges-wrapper/issues/49#issue-2272432093)
|
|
64
|
-
|
|
65
|
-
### Update
|
|
66
|
-
* `send_request`: controlling rate_limit by changing exception handling
|
|
67
|
-
* `Bitfinex`: sync `nonce` for connections group
|
|
68
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.11
|
|
69
|
-
|
|
70
|
-
## 2.1.11 2024-04-19
|
|
71
|
-
### Update
|
|
72
|
-
* Some minor improvements
|
|
73
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.10
|
|
74
|
-
|
|
75
|
-
## 2.1.10 2024-04-16
|
|
76
|
-
### Update
|
|
77
|
-
* `Bitfinex`: `client.fetch_order()`: searching on `origin_client_order_id` also
|
|
78
|
-
|
|
79
|
-
## 2.1.9 2024-04-14
|
|
80
|
-
### Fix
|
|
81
|
-
* Creating and manage asynchronous tasks
|
|
82
|
-
|
|
83
|
-
## 2.1.8 2024-04-08
|
|
84
|
-
### Update
|
|
85
|
-
* `Bitfinex`: add logging for `cancel_order()` and `cancel_all_orders()` methods
|
|
86
|
-
* Add debug logging for `open_client_connection()` and `client.load()`
|
|
87
|
-
|
|
88
|
-
## 2.1.7 2024-03-29
|
|
89
|
-
### Fix
|
|
90
|
-
* `Bybit`: http error handling: handling events that are not explicitly described
|
|
91
|
-
|
|
92
|
-
## 2.1.6 2024-03-29
|
|
93
|
-
### Fix
|
|
94
|
-
* `Bybit`: `on_balance_update`: missed event during transfer from API
|
|
95
|
-
|
|
96
|
-
### Update
|
|
97
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.8
|
|
98
|
-
|
|
99
|
-
## 2.1.5 2024-03-25
|
|
100
|
-
### Fix
|
|
101
|
-
* `Bybit`: `on_balance_update`: duplication during transfer from web-interface
|
|
102
|
-
* Some exception handling
|
|
103
|
-
|
|
104
|
-
### Update
|
|
105
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.7
|
|
106
|
-
|
|
107
|
-
## 2.1.4 2024-03-22
|
|
108
|
-
### Update
|
|
109
|
-
* Refine HTTP handle errors
|
|
110
|
-
|
|
111
|
-
## 2.1.3 2024-03-21
|
|
112
|
-
### Fix
|
|
113
|
-
* Change `datetime.now(timezone.utc).replace(tzinfo=None)` for format compatibility
|
|
114
|
-
|
|
115
|
-
### Update
|
|
116
|
-
* HTTP handle errors, for `response.status == 400` differ pure `Bad Request` and other reasons
|
|
117
|
-
|
|
118
|
-
## 2.1.2 2024-03-19
|
|
119
|
-
### Fix
|
|
120
|
-
* Some SonarLint issues
|
|
121
|
-
|
|
122
|
-
## 2.1.1 2024-03-16
|
|
123
|
-
### Update
|
|
124
|
-
* `Bybit`: `fetch_order`, `fetch_order_trade_list`: deep refine
|
|
125
|
-
* Some minor improvements
|
|
126
|
-
|
|
127
|
-
## 2.1.0 2024-03-15
|
|
128
|
-
### Update
|
|
129
|
-
* `on_order_book_update`: skip partially empty event
|
|
130
|
-
* `fetch_order_trade_list`: `ByBit`: remove `endTime` limit
|
|
131
|
-
* `exch_srv.py`: request processing is carried out in the method `send_request`
|
|
132
|
-
|
|
133
|
-
## 2.0.1 2024-03-11
|
|
134
|
-
### Added for new features
|
|
135
|
-
* `gRPC` proto: `OpenClientConnectionId` add `real_market` field
|
|
136
|
-
|
|
137
|
-
## 2.0.0.post1 2024-03-10
|
|
138
|
-
### Fix
|
|
139
|
-
* Incomplete description of dependencies
|
|
140
|
-
|
|
141
|
-
## 2.0.0 2024-03-09
|
|
142
|
-
### Update
|
|
143
|
-
* Example
|
|
144
|
-
|
|
145
|
-
## 2.0.0b2 2024-03-08
|
|
146
|
-
### Update
|
|
147
|
-
* Migrate `gRPC` from [grpcio](https://grpc.io/) to [grpclib](https://github.com/vmagamedov/grpclib) + [python-betterproto](https://github.com/danielgtaylor/python-betterproto)
|
|
148
|
-
|
|
149
|
-
## 1.4.17 2024-03-04
|
|
150
|
-
### Update
|
|
151
|
-
* `CreateLimitOrder()` and `FetchOpenOrders`: Exception handling reduced to one type
|
|
152
|
-
* Dependency: Up requirements for `grpcio` and `grpcio-tools` to 1.62.0
|
|
153
|
-
* Dependency: Up requirements for aiohttp==3.9.3
|
|
154
|
-
|
|
155
|
-
## 1.4.16 2024-02-25
|
|
156
|
-
### Fix
|
|
157
|
-
* `CreateLimitOrder()`: Missed `trade_id` parameter in fetch_order() call
|
|
158
|
-
|
|
159
|
-
### Update
|
|
160
|
-
* Refine error handling in `http_client`
|
|
161
|
-
|
|
162
|
-
## 1.4.15 2024-02-02
|
|
163
|
-
### Fix
|
|
164
|
-
* `HTX`: order Status set on cumulative_filled_quantity value only and `status` from event is ignored
|
|
165
|
-
|
|
166
|
-
## 1.4.14 2024-02-19
|
|
167
|
-
### Fix
|
|
168
|
-
* Exception in fetch_order: 'KeyError': 'commission'
|
|
169
|
-
* `fetch_order_trade_list()`: variables type inconsistent
|
|
170
|
-
* HTX: correcting order Status depending on cumulative_filled_quantity
|
|
171
|
-
|
|
172
|
-
## 1.4.13 2024-02-18
|
|
173
|
-
### Fix
|
|
174
|
-
* `FetchOrder()`: conditions for generating a trading event(s)
|
|
175
|
-
|
|
176
|
-
## 1.4.12 2024-02-12
|
|
177
|
-
### Fix
|
|
178
|
-
* `c_structures.OrderTradesEvent`: some fields are mixed up
|
|
179
|
-
* Bybit: generating a redundant order fill event
|
|
180
|
-
* `create_trade_stream_event`: using actual order status instead of estimated status
|
|
181
|
-
|
|
182
|
-
## 1.4.11.post1 2024-02-11
|
|
183
|
-
### Fix
|
|
184
|
-
* Bitfinex: setting original order quantity for placed order when first getting event is `te` type
|
|
185
|
-
|
|
186
|
-
## 1.4.11 2024-02-11
|
|
187
|
-
### Fix
|
|
188
|
-
* Bitfinex: use `symbol` parameter for cancel all order
|
|
189
|
-
|
|
190
|
-
## 1.4.10 2024-02-09
|
|
191
|
-
### Fix
|
|
192
|
-
* Generate trading events on the partial filled missing event
|
|
193
|
-
* Dependency: Rollback `grpcio` and `grpcio-tools` to 1.48.2
|
|
194
|
-
|
|
195
|
-
## 1.4.9 2024-02-07
|
|
196
|
-
### Fix
|
|
197
|
-
* Some minor fixes
|
|
198
|
-
|
|
199
|
-
## 1.4.9b5 2024-02-07
|
|
200
|
-
### Update
|
|
201
|
-
* Dependency: Up requirements for `grpcio` and `grpcio-tools` to 1.60.1
|
|
202
|
-
|
|
203
|
-
## 1.4.9b3 2024-02-07
|
|
204
|
-
### Update
|
|
205
|
-
* Bitfinex: refining order processing
|
|
206
|
-
|
|
207
|
-
## 1.4.9b2 2024-02-05
|
|
208
|
-
### Fix
|
|
209
|
-
* Binance: `TransferToMaster`: sentence `Email address should be encoded. e.g. alice@test.com should be encoded into
|
|
210
|
-
alice%40test.com` from API docs they are False, must be `content += urlencode(kwargs["params"], safe="@")`
|
|
211
|
-
|
|
212
|
-
### Update
|
|
213
|
-
* HTX: changed deprecated endpoint "v1/common/symbols" to "v1/settings/common/market-symbols"
|
|
214
|
-
* Binance: `GET /api/v3/exchangeInfo` from response remove deprecated `quotePrecision`
|
|
215
|
-
|
|
216
|
-
## 1.4.8 2024-02-02
|
|
217
|
-
### Added for new features
|
|
218
|
-
* Binance: `TransferToMaster` now can be used for collect assets on the subaccount
|
|
219
|
-
|
|
220
|
-
## 1.4.7.post6 2024-01-31
|
|
221
|
-
### Fix
|
|
222
|
-
* Bitfinex: order processing
|
|
223
|
-
|
|
224
|
-
## 1.4.7 2024-01-25
|
|
225
|
-
### Fix
|
|
226
|
-
* Bybit: filter LOT_SIZE.stepSize
|
|
227
|
-
* Bitfinex: filter LOT_SIZE.stepSize
|
|
228
|
-
|
|
229
|
-
### Added for new features
|
|
230
|
-
* Binance: new method [`OneClickArrivalDeposit`](https://binance-docs.github.io/apidocs/spot/en/#one-click-arrival-deposit-apply-for-expired-address-deposit-user_data)
|
|
231
|
-
|
|
232
|
-
### Update
|
|
233
|
-
* Bitfinex: refine the order processing
|
|
234
|
-
* Dependency: Up requirements for Python>=3.9
|
|
235
|
-
|
|
236
|
-
## v1.4.6 2024-01-06
|
|
237
|
-
### Update
|
|
238
|
-
* FetchOrder: Bitfinex: generate trades events for orders older than the last two weeks
|
|
239
|
-
|
|
240
|
-
## v1.4.5 2024-01-05
|
|
241
|
-
### Fix
|
|
242
|
-
* `exch_client.py` init error
|
|
243
|
-
|
|
244
|
-
### Update
|
|
245
|
-
* replacing json with ujson to improve performance
|
|
246
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.6
|
|
247
|
-
|
|
248
|
-
## v1.4.4 2023-12-13
|
|
249
|
-
### Update
|
|
250
|
-
* Before send cancel order result checking if it was being executed and generating trade event
|
|
251
|
-
* Rollback 1.4.3
|
|
252
|
-
- Binance: in create Limit order parameters adding parameter "selfTradePreventionMode": "NONE"
|
|
253
|
-
|
|
254
|
-
## v1.4.3 2023-12-12
|
|
255
|
-
### Fix
|
|
256
|
-
* For limit order get status EXPIRED_IN_MATCH on Binance testnet #42
|
|
257
|
-
+ Binance: in create Limit order parameters adding parameter "selfTradePreventionMode": "NONE"
|
|
258
|
-
+ For method json_format.ParseDict(..., ignore_unknown_fields=True) parameter added
|
|
259
|
-
|
|
260
|
-
## v1.4.2 2023-12-11
|
|
261
|
-
### Update
|
|
262
|
-
* Some minor improvements
|
|
263
|
-
|
|
264
|
-
## v1.4.1 2023-12-01
|
|
265
|
-
### Update
|
|
266
|
-
* Bybit: fetch_ledgers(): get transfer event from Sub account to Main account on Main account
|
|
267
|
-
|
|
268
|
-
## v1.4.0 2023-11-23
|
|
269
|
-
### Update
|
|
270
|
-
* Some minor improvements
|
|
271
|
-
|
|
272
|
-
## v1.4.0rc6 2023-11-11
|
|
273
|
-
### Fix
|
|
274
|
-
* FetchOrder for Demo - ByBitSub01: BTCUSDT: 0 exception: list index out of range
|
|
275
|
-
* OKX: get ws_api endpoint from config
|
|
276
|
-
* ByBit: send and handling WSS keepalive message
|
|
277
|
-
|
|
278
|
-
## v1.4.0rc3 2023-11-01
|
|
279
|
-
### Fix
|
|
280
|
-
* websockets v12.0 raised `ConnectionClosed` exception
|
|
281
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.5.post3
|
|
282
|
-
|
|
283
|
-
## v1.4.0rc1 2023-10-31
|
|
284
|
-
### Fix
|
|
285
|
-
* Bitfinex: WSS Information message processing logic adjusted
|
|
286
|
-
|
|
287
|
-
### Update
|
|
288
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.5
|
|
289
|
-
* Other dependency
|
|
290
|
-
* protobuf format for:
|
|
291
|
-
+ OpenClientConnectionRequest
|
|
292
|
-
+ FetchOrderRequest
|
|
293
|
-
|
|
294
|
-
### Added for new features
|
|
295
|
-
* Bybit exchange V5 API support implemented. Supported account type is
|
|
296
|
-
[Unified Trading Account](https://testnet.bybit.com/en/help-center/article/Introduction-to-Bybit-Unified-Trading-Account),
|
|
297
|
-
for main and sub-accounts. Spot Trading only.
|
|
298
|
-
|
|
299
|
-
## v1.3.7.post4 2023-10-09
|
|
300
|
-
### Update
|
|
301
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.4
|
|
302
|
-
|
|
303
|
-
## v1.3.7.post3 2023-10-05
|
|
304
|
-
### Update
|
|
305
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.3.post1
|
|
306
|
-
|
|
307
|
-
## v1.3.7.post2 2023-09-30
|
|
308
|
-
### Update
|
|
309
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.3
|
|
310
|
-
|
|
311
|
-
## v1.3.7.post1 2023-09-24
|
|
312
|
-
### Fix
|
|
313
|
-
* [2023-09-24 07:10:21,076: ERROR] Fetch order trades for HuobiSub2: HTUSDT exception: Client.fetch_order_trade_list()
|
|
314
|
-
missing 1 required positional argument: 'trade_id'
|
|
315
|
-
* exchanges_wrapper.huobi_parser.account_trade_list: incorrect key for `orderId`
|
|
316
|
-
|
|
317
|
-
### Update
|
|
318
|
-
* Dependency: Up requirements for crypto-ws-api==2.0.2.post1
|
|
319
|
-
|
|
320
|
-
## v1.3.7 2023-09-19
|
|
321
|
-
### Fix
|
|
322
|
-
* Bitfinex: fix 500 `Internal server error`, caused by a Nonce value sequence failure
|
|
323
|
-
|
|
324
|
-
### Update
|
|
325
|
-
* For web socket connection migrated from aiohttp.ws_connection to websockets.client
|
|
326
|
-
* Bitfinex: Implemented rate limit control for the Bitfinex REST API.
|
|
327
|
-
* Bitfinex: Refine handling of active orders
|
|
328
|
-
* OnOrderBookUpdate: change queue to LifoQueue, for get last actual order book row
|
|
329
|
-
|
|
330
|
-
### Don't fix
|
|
331
|
-
* gRPC [(grpcio + grpcio-tools)](https://github.com/grpc/grpc): massive memory leak for version later than 1.48.2
|
|
332
|
-
|
|
333
|
-
## v1.3.6b7 2023-08-20
|
|
334
|
-
### Fix
|
|
335
|
-
* The `exch_srv_cfg.toml` wants to be updated from `exch_srv_cfg.toml.template`:
|
|
336
|
-
```toml
|
|
337
|
-
[endpoint.okx]
|
|
338
|
-
api_public = 'https://aws.okx.com'
|
|
339
|
-
api_auth = 'https://aws.okx.com'
|
|
340
|
-
ws_public = 'wss://wsaws.okx.com:8443/ws/v5/public'
|
|
341
|
-
ws_auth = 'wss://wsaws.okx.com:8443/ws/v5/private'
|
|
342
|
-
ws_business = 'wss://ws.okx.com:8443/ws/v5/business'
|
|
343
|
-
api_test = 'https://aws.okx.com'
|
|
344
|
-
ws_test = 'wss://wspap.okx.com:8443/ws/v5/private?brokerId=9999'
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
## v1.3.6b4 2023-08-18
|
|
348
|
-
### Fix
|
|
349
|
-
* [ Can't resolve missed PARTIALLY_FILLED event #29 ](https://github.com/DogsTailFarmer/exchanges-wrapper/issues/29#issue-1857179139)
|
|
350
|
-
* [ OKX changed WSS endpoint for Candlesticks channel #27 ](https://github.com/DogsTailFarmer/exchanges-wrapper/issues/27#issue-1852639540)
|
|
351
|
-
|
|
352
|
-
The `exch_srv_cfg.toml` wants to be updated from `exch_srv_cfg.toml.template`:
|
|
353
|
-
```toml
|
|
354
|
-
[endpoint.okx]
|
|
355
|
-
api_public = 'https://aws.okx.com'
|
|
356
|
-
api_auth = 'https://aws.okx.com'
|
|
357
|
-
ws_public = 'wss://wsaws.okx.com:8443/ws/v5/public'
|
|
358
|
-
ws_business = 'wss://ws.okx.com:8443/ws/v5/business'
|
|
359
|
-
api_test = 'https://aws.okx.com'
|
|
360
|
-
ws_test = 'wss://wspap.okx.com:8443/ws/v5/private?brokerId=9999'
|
|
361
|
-
```
|
|
362
|
-
## v1.3.5rc1 2023-08-08
|
|
363
|
-
### Update
|
|
364
|
-
* Dependency: Up requirements for crypto-ws-api~=2.0.0rc3
|
|
365
|
-
* Optimise code by [Sourcery AI](https://docs.sourcery.ai/Guides/Getting-Started/PyCharm/) refactoring engine
|
|
366
|
-
* Some minor improvements
|
|
367
|
-
|
|
368
|
-
## v1.3.5b0 - 2023-07-26
|
|
369
|
-
### Added for new features
|
|
370
|
-
* Binance, OKX: Most requests use WSS first, REST API is used as a backup and in the case of single rare requests
|
|
371
|
-
|
|
372
|
-
## v1.3.4-1 2023-07-19
|
|
373
|
-
### Fix
|
|
374
|
-
```
|
|
375
|
-
ERROR: Cannot install crypto_ws_api and grpcio==1.56.0 because these package versions have conflicting dependencies.
|
|
376
|
-
|
|
377
|
-
The conflict is caused by:
|
|
378
|
-
The user requested grpcio==1.56.0
|
|
379
|
-
exchanges-wrapper 1.3.3 depends on grpcio==1.48.1
|
|
380
|
-
The user requested grpcio==1.56.0
|
|
381
|
-
exchanges-wrapper 1.3.2 depends on grpcio==1.48.1
|
|
382
|
-
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
## v1.3.4 2023-07-17
|
|
386
|
-
### Update
|
|
387
|
-
* Up requirements for grpcio to 1.56.0
|
|
388
|
-
```bazaar
|
|
389
|
-
Known security vulnerabilities detected
|
|
390
|
-
Dependency grpcio Version < 1.53.0 Upgrade to ~> 1.53.0
|
|
391
|
-
```
|
|
392
|
-
* Bitfinex: `exchanges_wrapper.client.Client.cancel_all_orders()`: removed unnecessary status check after cancel request
|
|
393
|
-
|
|
394
|
-
## v1.3.3 2023-07-04
|
|
395
|
-
### Update
|
|
396
|
-
* UserWSSession moved to crypto-ws-api pkg
|
|
397
|
-
* Refactoring logging
|
|
398
|
-
* CheckStream(): fix log spamming on passed check
|
|
399
|
-
* Up requirements for crypto-ws-api to 1.0.1
|
|
400
|
-
|
|
401
|
-
## v1.3.2 - 2023-06-29
|
|
402
|
-
### Added for new features
|
|
403
|
-
* Binance: ws_api package implemented, last version
|
|
404
|
-
[Websocket API](https://developers.binance.com/docs/binance-trading-api/websocket_api#general-api-information)
|
|
405
|
-
used for the most commonly used methods
|
|
406
|
-
|
|
407
|
-
In `exch_srv_cfg.toml` added:
|
|
408
|
-
|
|
409
|
-
```bazaar
|
|
410
|
-
[endpoint]
|
|
411
|
-
[endpoint.binance]
|
|
412
|
-
...
|
|
413
|
-
ws_api = 'wss://ws-api.binance.com:443/ws-api/v3'
|
|
414
|
-
ws_api_test = 'wss://testnet.binance.vision/ws-api/v3'
|
|
415
|
-
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
## v1.3.1 - 2023-06-20
|
|
419
|
-
### Update
|
|
420
|
-
* Optimizing installation and initial settings
|
|
421
|
-
|
|
422
|
-
## v1.3.0-2 - 2023-06-19
|
|
423
|
-
### Update
|
|
424
|
-
* Binance: keepalive WSS
|
|
425
|
-
|
|
426
|
-
## v1.3.0 - 2023-06-01
|
|
427
|
-
### Fix
|
|
428
|
-
* exchanges_wrapper.client.Client.cancel_all_orders() set correct 'status' for cancelled orders
|
|
429
|
-
|
|
430
|
-
### Update
|
|
431
|
-
* protobuf format for CancelAllOrders() and OnOrderUpdate(). Now simple use ```result = eval(json.loads(res.result))```
|
|
432
|
-
for unpack incoming message. **Not compatible with earlier versions**
|
|
433
|
-
* dependencies
|
|
434
|
-
|
|
435
|
-
## v1.2.10-6-HotFix - 2023-04-12
|
|
436
|
-
### Fix
|
|
437
|
-
* Binance: REST API update for endpoint: GET /api/v3/exchangeInfo was changed MIN_NOTIONAL filter
|
|
438
|
-
|
|
439
|
-
## v1.2.10-5 - 2023-04-05
|
|
440
|
-
### Update
|
|
441
|
-
* Minor improvements
|
|
442
|
-
|
|
443
|
-
## v1.2.10-4 - 2023-03-04
|
|
444
|
-
### Fix
|
|
445
|
-
* OKX: intersection wss streams for several trades on one client (same account). WSS buffer moved from
|
|
446
|
-
client instance to EventsDataStream instance
|
|
447
|
-
|
|
448
|
-
## v1.2.10-3 - 2023-03-01
|
|
449
|
-
### Fix
|
|
450
|
-
* OKX: FetchOpenOrders(): getting orders list for all pair per account instead specific one pair
|
|
451
|
-
|
|
452
|
-
## v1.2.10-2 - 2023-02-26
|
|
453
|
-
### Added for new features
|
|
454
|
-
* CheckStream() method which request active WSS for trade_id
|
|
455
|
-
|
|
456
|
-
## v1.2.10 - 2023-02-22
|
|
457
|
-
### Added for new features
|
|
458
|
-
* Add method TransferToMaster():
|
|
459
|
-
|
|
460
|
-
>Send request to transfer asset from subaccount to main account
|
|
461
|
-
Binance, OKX: not additional settings needed
|
|
462
|
-
Bitfinex: for subaccount setting 2FA method, set WITHDRAWAL permission for API key,
|
|
463
|
-
in config for subaccount set 2FA key and master account EMail
|
|
464
|
-
Huobi: in config for subaccount set master_name for Main account
|
|
465
|
-
|
|
466
|
-
### Update
|
|
467
|
-
* Up requirements aiohttp to 3.8.4
|
|
468
|
-
* Some minor improvements
|
|
469
|
-
|
|
470
|
-
## v1.2.9-2 - 2023-02-04
|
|
471
|
-
### Fixed
|
|
472
|
-
* Fix DogsTailFarmer/martin-binance#50
|
|
473
|
-
|
|
474
|
-
### Update
|
|
475
|
-
* Remove unnecessary shebang
|
|
476
|
-
|
|
477
|
-
## v1.2.9-1 - 2023-01-23
|
|
478
|
-
### Update
|
|
479
|
-
* Additional check for order status if its can't place during timeout period for avoid place duplicate order
|
|
480
|
-
|
|
481
|
-
## v1.2.9 - 2023-01-08
|
|
482
|
-
### Update
|
|
483
|
-
* Removing FTX smell
|
|
484
|
-
|
|
485
|
-
## v1.2.8 - 2023-01-01
|
|
486
|
-
### Added for new features
|
|
487
|
-
* Add connection to binance.us
|
|
488
|
-
|
|
489
|
-
## v1.2.7-7 2022-12-15
|
|
490
|
-
### Fixed
|
|
491
|
-
* DogsTailFarmer/martin-binance#42
|
|
492
|
-
|
|
493
|
-
## v1.2.7-6 2022-12-08
|
|
494
|
-
### Fixed
|
|
495
|
-
* Bitfinex: handling canceled TP order after it partially filled
|
|
496
|
-
|
|
497
|
-
### Update
|
|
498
|
-
* Binance: REST API: filter type "PERCENT_PRICE" to "PERCENT_PRICE_BY_SIDE"
|
|
499
|
-
|
|
500
|
-
## v1.2.7-5 2022-12-04
|
|
501
|
-
### Update
|
|
502
|
-
* FetchOpenOrders() add handler for errors.QueryCanceled, in case RateLimitReached was raised elsewhere
|
|
503
|
-
* Some minor improvements
|
|
504
|
-
|
|
505
|
-
## v1.2.7-4 2022-11-25
|
|
506
|
-
### Fixed
|
|
507
|
-
* Clearing cancel previous wss start() before restart from 1.2.7-3 was a bad idea. It's kill himself. Rollback.
|
|
508
|
-
|
|
509
|
-
## v1.2.7-3 2022-11-24
|
|
510
|
-
### Fixed
|
|
511
|
-
* Huobi: incorrect handling for incoming ping for private channel
|
|
512
|
-
* OKX: refactoring wss heartbeat
|
|
513
|
-
* Clearing cancel previous wss start() before restart
|
|
514
|
-
|
|
515
|
-
## v1.2.7-2 2022-11-23
|
|
516
|
-
### Update
|
|
517
|
-
* Bitfinex: add "receive_timeout=30" parameter in ws_connect(), this is a reliable solution for monitoring the presence
|
|
518
|
-
of a connection
|
|
519
|
-
|
|
520
|
-
## v1.2.7-1 2022-11-21
|
|
521
|
-
### Update
|
|
522
|
-
* Add OKX section in config file
|
|
523
|
-
|
|
524
|
-
## v1.2.7 2022-11-21
|
|
525
|
-
### Added for new features
|
|
526
|
-
* OKX exchange
|
|
527
|
-
|
|
528
|
-
## v1.2.6-1 2022-11-11
|
|
529
|
-
### Fixed
|
|
530
|
-
* FTX: OnFundsUpdate() did not return a result
|
|
531
|
-
|
|
532
|
-
### Added for new features
|
|
533
|
-
* OnBalanceUpdate() for autocorrect depo and initial balance
|
|
534
|
-
|
|
535
|
-
### Update
|
|
536
|
-
* refactoring http_client module for multi exchanges purposes
|
|
537
|
-
* added _percent_price filter dummy for all parsers
|
|
538
|
-
|
|
539
|
-
## v1.2.6 2022-10-13
|
|
540
|
-
### Fixed
|
|
541
|
-
* Huobi Restart WSS for PING timeout, 20s for market and 60s for user streams
|
|
542
|
-
* Removed unnecessary refine amount/price in create_order() for Bitfinex, FTX and Huobi
|
|
543
|
-
|
|
544
|
-
## v1.2.6b1 2022-10-12
|
|
545
|
-
### Added for new features
|
|
546
|
-
* Huobi exchange
|
|
547
|
-
|
|
548
|
-
## v1.2.5-3 2022-09-26
|
|
549
|
-
### Fixed
|
|
550
|
-
* #2 FTX WS market stream lies down quietly
|
|
551
|
-
|
|
552
|
-
### Update
|
|
553
|
-
* Slightly optimized process of docker container setup and start-up
|
|
554
|
-
|
|
555
|
-
## v1.2.5-2 2022-09-23
|
|
556
|
-
### Added for new features
|
|
557
|
-
* Published as Docker image
|
|
558
|
-
|
|
559
|
-
### Update
|
|
560
|
-
* README.md add info about Docker image use
|
|
561
|
-
|
|
562
|
-
## v1.2.5-1 2022-09-21
|
|
563
|
-
### Update
|
|
564
|
-
* Restoring the closed WSS for any reason other than forced explicit shutdown
|
|
565
|
-
|
|
566
|
-
## v1.2.5 2022-09-20
|
|
567
|
-
### Update
|
|
568
|
-
* Correct max size on queue() for book WSS
|
|
569
|
-
|
|
570
|
-
## v1.2.5b0 2022-09-18
|
|
571
|
-
### Fixed
|
|
572
|
-
* [Doesn't work on bitfinex: trading rules, step_size restriction not applicable, check](https://github.com/DogsTailFarmer/martin-binance/issues/28#issue-1366945816)
|
|
573
|
-
* [FTX WS market stream lies down quietly](https://github.com/DogsTailFarmer/exchanges-wrapper/issues/2#issue-1362214342) Refactoring WSS control
|
|
574
|
-
* Keep alive Binance combined market WSS, correct restart after stop pair
|
|
575
|
-
|
|
576
|
-
### Update
|
|
577
|
-
* FetchOrder for 'PARTIALLY_FILLED' event on 'binance' and 'ftx'
|
|
578
|
-
* User data and settings config are moved outside the package to simplify the upgrade
|
|
579
|
-
* Version accounting of the configuration file is given to the package
|
|
580
|
-
|
|
581
|
-
### Added for new features
|
|
582
|
-
* Published as Docker image
|
|
583
|
-
* On first run create catalog structure for user files at ```/home/user/.MartinBinance/```
|
|
584
|
-
|
|
585
|
-
## v1.2.4 2022-08-27
|
|
586
|
-
### Fixed
|
|
587
|
-
* [Incomplete account setup](DogsTailFarmer/martin-binance#17)
|
|
588
|
-
* 1.2.3-2 Fix wss market handler, was stopped after get int type message instead of dict
|
|
589
|
-
* 1.2.3-5 clear console output
|
|
590
|
-
* 1.2.3-6 Bitfinex WSServerHandshakeError handling
|
|
591
|
-
* refactoring web_socket.py for correct handling and restart wss
|
|
592
|
-
|
|
593
|
-
### Update
|
|
594
|
-
* up to Python 3.10.6 compatible
|
|
595
|
-
* reuse aiohttp.ClientSession().ws_connect() for client session
|
|
596
|
-
|
|
597
|
-
## v1.2.3 - 2022-08-14
|
|
598
|
-
### Fixed
|
|
599
|
-
* Bitfinex: restore active orders list after restart
|
|
600
|
-
* [exch_server not exiting if it can't obtain port](https://github.com/DogsTailFarmer/martin-binance/issues/12#issue-1328603498)
|
|
601
|
-
|
|
602
|
-
## v1.2.2 - 2022-08-06
|
|
603
|
-
### Fixed
|
|
604
|
-
* Incorrect handling fetch_open_orders response after reinit connection
|
|
605
|
-
|
|
606
|
-
## v1.2.1 - 2022-08-04
|
|
607
|
-
### Added for new features
|
|
608
|
-
* FTX: WSS 'orderbook' check status by provided checksum value
|
|
609
|
-
|
|
610
|
-
### Fixed
|
|
611
|
-
* FTX: WSS 'ticker' incorrect init
|
|
612
|
-
* Bitfinex: changed priority for order status, CANCELED priority raised
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
## v1.2.0 - 2022-06-30
|
|
616
|
-
### Added for new features
|
|
617
|
-
* Bitfinex REST API / WSS implemented
|
|
618
|
-
|
|
619
|
-
### Updated
|
|
620
|
-
* Optimized WSS processing methods to improve performance and fault tolerance
|
|
621
|
-
* Updated configuration file format for multi-exchange use
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# syntax=docker/dockerfile:1
|
|
2
|
-
FROM python:3.10.6-slim
|
|
3
|
-
|
|
4
|
-
RUN useradd -ms /bin/bash appuser
|
|
5
|
-
USER appuser
|
|
6
|
-
|
|
7
|
-
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
|
8
|
-
ENV PATH="/home/appuser/.local/lib/python3.10/site-packages:${PATH}"
|
|
9
|
-
ENV PYTHONUNBUFFERED=1
|
|
10
|
-
|
|
11
|
-
COPY requirements.txt requirements.txt
|
|
12
|
-
|
|
13
|
-
RUN pip3 install -r requirements.txt
|
|
14
|
-
|
|
15
|
-
COPY ./exchanges_wrapper /home/appuser/.local/lib/python3.10/site-packages/exchanges_wrapper/
|
|
16
|
-
|
|
17
|
-
WORKDIR "/home/appuser/.local/lib/python3.10/site-packages"
|
|
18
|
-
|
|
19
|
-
LABEL org.opencontainers.image.description="See README.md 'Get started' for setup and run package"
|
|
20
|
-
|
|
21
|
-
EXPOSE 50051
|
|
22
|
-
|
|
23
|
-
CMD ["python3","exchanges_wrapper/exch_srv.py"]
|
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
Client example for exchanges-wrapper, examples of use of server methods are given
|
|
5
|
-
"""
|
|
6
|
-
import ast
|
|
7
|
-
import asyncio
|
|
8
|
-
import toml
|
|
9
|
-
import uuid
|
|
10
|
-
import simplejson as json
|
|
11
|
-
|
|
12
|
-
from exchanges_wrapper import martin as mr, Channel, Status, GRPCError
|
|
13
|
-
|
|
14
|
-
RATE_LIMITER = 5
|
|
15
|
-
FILE_CONFIG = 'ms_cfg.toml'
|
|
16
|
-
config = toml.load(FILE_CONFIG)
|
|
17
|
-
EXCHANGE = config.get('exchange')
|
|
18
|
-
SYMBOL = 'BNBUSDT'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
async def main(_exchange, _symbol):
|
|
22
|
-
print(f"main.account_name: {_exchange}")
|
|
23
|
-
# Create connection to the grpc powered server
|
|
24
|
-
channel = Channel('127.0.0.1', 50051)
|
|
25
|
-
stub = mr.MartinStub(channel)
|
|
26
|
-
trade_id = str(uuid.uuid4().hex)
|
|
27
|
-
client_id = None
|
|
28
|
-
# Register client and get client_id for reuse connection
|
|
29
|
-
# Example of exception handling by grpc connection
|
|
30
|
-
try:
|
|
31
|
-
client_id_msg = await stub.open_client_connection(mr.OpenClientConnectionRequest(
|
|
32
|
-
trade_id=trade_id,
|
|
33
|
-
account_name=_exchange,
|
|
34
|
-
symbol=SYMBOL,
|
|
35
|
-
rate_limiter=RATE_LIMITER))
|
|
36
|
-
except asyncio.CancelledError:
|
|
37
|
-
pass # Task cancellation should not be logged as an error.
|
|
38
|
-
except GRPCError as ex:
|
|
39
|
-
channel.close()
|
|
40
|
-
status_code = ex.status
|
|
41
|
-
print(f"Exception on register client: {status_code.name}, {ex.message}")
|
|
42
|
-
return
|
|
43
|
-
else:
|
|
44
|
-
client_id = client_id_msg.client_id
|
|
45
|
-
exchange = client_id_msg.exchange
|
|
46
|
-
print(f"main.exchange: {exchange}")
|
|
47
|
-
print(f"main.client_id: {client_id}")
|
|
48
|
-
print(f"main.srv_version: {client_id_msg.srv_version}")
|
|
49
|
-
|
|
50
|
-
# Sample async call server method
|
|
51
|
-
_exchange_info_symbol = await stub.fetch_exchange_info_symbol(mr.MarketRequest(
|
|
52
|
-
trade_id=trade_id,
|
|
53
|
-
client_id=client_id,
|
|
54
|
-
symbol=_symbol))
|
|
55
|
-
# Unpack result
|
|
56
|
-
exchange_info_symbol = _exchange_info_symbol.to_pydict()
|
|
57
|
-
print("\n".join(f"{k}\t{v}" for k, v in exchange_info_symbol.items()))
|
|
58
|
-
|
|
59
|
-
# Sample async functon call
|
|
60
|
-
open_orders = await fetch_open_orders(stub, client_id, _symbol)
|
|
61
|
-
print(f"open_orders: {open_orders}")
|
|
62
|
-
|
|
63
|
-
# Subscribe to WSS
|
|
64
|
-
# First you want to create all WSS task
|
|
65
|
-
# Market stream
|
|
66
|
-
# noinspection PyAsyncCall
|
|
67
|
-
asyncio.create_task(on_ticker_update(stub, client_id, _symbol, trade_id))
|
|
68
|
-
# User Stream
|
|
69
|
-
# noinspection PyAsyncCall
|
|
70
|
-
asyncio.create_task(on_order_update(stub, client_id, _symbol, trade_id))
|
|
71
|
-
# Other market and user methods are used similarly: OnKlinesUpdate, OnFundsUpdate, OnOrderBookUpdate
|
|
72
|
-
# Start WSS
|
|
73
|
-
# The values of market_stream_count directly depend on the number of market
|
|
74
|
-
# ws streams used in the strategy and declared above
|
|
75
|
-
await stub.start_stream(mr.StartStreamRequest(
|
|
76
|
-
trade_id=trade_id,
|
|
77
|
-
client_id=client_id,
|
|
78
|
-
symbol=_symbol,
|
|
79
|
-
market_stream_count=1))
|
|
80
|
-
await asyncio.sleep(RATE_LIMITER)
|
|
81
|
-
# Before stop program call StopStream() method
|
|
82
|
-
await stub.stop_stream(mr.MarketRequest(trade_id=trade_id, client_id=client_id, symbol=_symbol))
|
|
83
|
-
channel.close()
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
async def on_ticker_update(_stub, _client_id, _symbol, trade_id):
|
|
87
|
-
"""
|
|
88
|
-
24hr rolling window mini-ticker statistics. Truncated sample.
|
|
89
|
-
:param trade_id:
|
|
90
|
-
:param _stub:
|
|
91
|
-
:param _client_id:
|
|
92
|
-
:param _symbol:
|
|
93
|
-
:return: {}
|
|
94
|
-
"""
|
|
95
|
-
async for ticker in _stub.on_ticker_update(mr.MarketRequest(
|
|
96
|
-
trade_id=trade_id,
|
|
97
|
-
client_id=_client_id,
|
|
98
|
-
symbol=_symbol)):
|
|
99
|
-
print(f"on_ticker_update: {ticker.to_pydict()}")
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
async def on_order_update(_stub, _client_id, _symbol, trade_id):
|
|
103
|
-
"""
|
|
104
|
-
Orders are updated with the executionReport event.
|
|
105
|
-
:param trade_id:
|
|
106
|
-
:param _stub:
|
|
107
|
-
:param _client_id:
|
|
108
|
-
:param _symbol:
|
|
109
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/user-data-stream.md#order-update
|
|
110
|
-
"""
|
|
111
|
-
async for event in _stub.on_order_update(mr.MarketRequest(
|
|
112
|
-
trade_id=trade_id,
|
|
113
|
-
client_id=_client_id,
|
|
114
|
-
symbol=_symbol)):
|
|
115
|
-
print(json.loads(event.result))
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
async def on_balance_update(_stub, _client_id, _symbol, trade_id):
|
|
119
|
-
"""
|
|
120
|
-
Get data when asset transferred or withdrawal from account
|
|
121
|
-
:param _stub:
|
|
122
|
-
:param _client_id:
|
|
123
|
-
:param _symbol:
|
|
124
|
-
:param trade_id:
|
|
125
|
-
:return:
|
|
126
|
-
"""
|
|
127
|
-
async for res in _stub.on_balance_update(mr.MarketRequest(
|
|
128
|
-
trade_id=trade_id,
|
|
129
|
-
client_id=_client_id,
|
|
130
|
-
symbol=_symbol)):
|
|
131
|
-
print(json.loads(res.event))
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async def fetch_open_orders(_stub, _client_id, _symbol):
|
|
135
|
-
"""
|
|
136
|
-
Get all open orders on a symbol.
|
|
137
|
-
:param _stub:
|
|
138
|
-
:param _client_id:
|
|
139
|
-
:param _symbol:
|
|
140
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#current-open-orders-user_data
|
|
141
|
-
"""
|
|
142
|
-
_active_orders = await _stub.fetch_open_orders(mr.MarketRequest(client_id=_client_id, symbol=_symbol))
|
|
143
|
-
active_orders = list(map(json.loads, _active_orders.orders))
|
|
144
|
-
print(f"active_orders: {active_orders}")
|
|
145
|
-
return active_orders
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
async def fetch_order(_stub, _client_id, _symbol, _id: int, _filled_update_call: bool = False):
|
|
149
|
-
"""
|
|
150
|
-
Check an order's status.
|
|
151
|
-
:param _stub:
|
|
152
|
-
:param _client_id:
|
|
153
|
-
:param _symbol:
|
|
154
|
-
:param _id: order id
|
|
155
|
-
:param _filled_update_call: if True and order's status is 'FILLED' generated event for OnOrderUpdate user stream
|
|
156
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#query-order-user_data
|
|
157
|
-
"""
|
|
158
|
-
try:
|
|
159
|
-
res = await _stub.fetch_order(mr.FetchOrderRequest(
|
|
160
|
-
client_id=_client_id,
|
|
161
|
-
symbol=_symbol,
|
|
162
|
-
order_id=_id,
|
|
163
|
-
filled_update_call=_filled_update_call))
|
|
164
|
-
result = res.to_pydict()
|
|
165
|
-
except asyncio.CancelledError:
|
|
166
|
-
pass # Task cancellation should not be logged as an error.
|
|
167
|
-
except Exception as _ex:
|
|
168
|
-
print(f"Exception in fetch_order: {_ex}")
|
|
169
|
-
return {}
|
|
170
|
-
else:
|
|
171
|
-
print(f"For order {result.get('orderId')} fetched status is {result.get('status')}")
|
|
172
|
-
return result
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
async def cancel_all_orders(_stub, _client_id, _symbol):
|
|
176
|
-
"""
|
|
177
|
-
Cancel All Open Orders on a Symbol
|
|
178
|
-
:param _stub:
|
|
179
|
-
:param _client_id:
|
|
180
|
-
:param _symbol:
|
|
181
|
-
:return:
|
|
182
|
-
https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#cancel-all-open-orders-on-a-symbol-trade
|
|
183
|
-
"""
|
|
184
|
-
res = await _stub.cancel_all_orders(mr.MarketRequest(
|
|
185
|
-
client_id=_client_id,
|
|
186
|
-
symbol=_symbol))
|
|
187
|
-
result = ast.literal_eval(json.loads(res.result))
|
|
188
|
-
print(f"cancel_all_orders.result: {result}")
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
async def fetch_account_information(_stub, _client_id):
|
|
192
|
-
"""
|
|
193
|
-
Account information (USER_DATA)
|
|
194
|
-
:param _stub:
|
|
195
|
-
:param _client_id:
|
|
196
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#account-information-user_data
|
|
197
|
-
"""
|
|
198
|
-
try:
|
|
199
|
-
res = await _stub.fetch_account_information(mr.OpenClientConnectionId(client_id=_client_id))
|
|
200
|
-
except asyncio.CancelledError:
|
|
201
|
-
pass
|
|
202
|
-
except Exception as _ex:
|
|
203
|
-
print(f"Exception fetch_account_information: {_ex}")
|
|
204
|
-
else:
|
|
205
|
-
balances = list(map(json.loads, res.items))
|
|
206
|
-
print(f"fetch_account_information.balances: {balances}")
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
async def fetch_funding_wallet(_stub, _client_id):
|
|
210
|
-
"""
|
|
211
|
-
Get balances from Funding wallet for Binance and assets from 'main' account for FTX
|
|
212
|
-
:param _stub:
|
|
213
|
-
:param _client_id:
|
|
214
|
-
:return: https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data
|
|
215
|
-
"""
|
|
216
|
-
try:
|
|
217
|
-
res = await _stub.fetch_funding_wallet(mr.FetchFundingWalletRequest(
|
|
218
|
-
client_id=_client_id))
|
|
219
|
-
except asyncio.CancelledError:
|
|
220
|
-
pass
|
|
221
|
-
except Exception as _ex:
|
|
222
|
-
print(f"fetch_funding_wallet: {_ex}")
|
|
223
|
-
else:
|
|
224
|
-
funding_wallet = list(map(json.loads, res.items))
|
|
225
|
-
print(f"fetch_funding_wallet.funding_wallet: {funding_wallet}")
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
async def fetch_order_book(_stub, _client_id, _symbol):
|
|
229
|
-
"""
|
|
230
|
-
Get order book, limit=5
|
|
231
|
-
:param _stub:
|
|
232
|
-
:param _client_id:
|
|
233
|
-
:param _symbol:
|
|
234
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#order-book
|
|
235
|
-
"""
|
|
236
|
-
_order_book = await _stub.fetch_order_book(mr.MarketRequest(
|
|
237
|
-
client_id=_client_id,
|
|
238
|
-
symbol=_symbol))
|
|
239
|
-
order_book = _order_book.to_pydict()
|
|
240
|
-
print(f"fetch_order_book.order_book: {order_book}")
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
async def fetch_symbol_price_ticker(_stub, _client_id, _symbol):
|
|
244
|
-
"""
|
|
245
|
-
Get symbol price ticker
|
|
246
|
-
:param _stub:
|
|
247
|
-
:param _client_id:
|
|
248
|
-
:param _symbol:
|
|
249
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#symbol-price-ticker
|
|
250
|
-
"""
|
|
251
|
-
_price = await _stub.fetch_symbol_price_ticker(mr.MarketRequest(
|
|
252
|
-
client_id=_client_id,
|
|
253
|
-
symbol=_symbol))
|
|
254
|
-
price = _price.to_pydict()
|
|
255
|
-
print(f"fetch_symbol_price_ticker.price: {price}")
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
async def fetch_ticker_price_change_statistics(_stub, _client_id, _symbol):
|
|
259
|
-
"""
|
|
260
|
-
24hr ticker price change statistics
|
|
261
|
-
:param _stub:
|
|
262
|
-
:param _client_id:
|
|
263
|
-
:param _symbol:
|
|
264
|
-
:return:
|
|
265
|
-
https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#24hr-ticker-price-change-statistics
|
|
266
|
-
"""
|
|
267
|
-
_ticker = await _stub.fetch_ticker_price_change_statistics(mr.MarketRequest(
|
|
268
|
-
client_id=_client_id,
|
|
269
|
-
symbol=_symbol))
|
|
270
|
-
ticker = _ticker.to_pydict()
|
|
271
|
-
print(f"fetch_ticker_price_change_statistics.ticker: {ticker}")
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
async def fetch_klines(_stub, _client_id, _symbol, _interval, _limit):
|
|
275
|
-
"""
|
|
276
|
-
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
|
|
277
|
-
:param _stub:
|
|
278
|
-
:param _client_id:
|
|
279
|
-
:param _symbol:
|
|
280
|
-
:param _interval: ENUM https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#enum-definitions
|
|
281
|
-
:param _limit: Default 500; max 1000.
|
|
282
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#klinecandlestick-data
|
|
283
|
-
"""
|
|
284
|
-
res = await _stub.fetch_klines(mr.FetchKlinesRequest(
|
|
285
|
-
client_id=_client_id,
|
|
286
|
-
symbol=_symbol,
|
|
287
|
-
interval=_interval,
|
|
288
|
-
limit=_limit))
|
|
289
|
-
kline = list(map(json.loads, res.items))
|
|
290
|
-
print(f"fetch_klines.kline: {kline}")
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
async def fetch_account_trade_list(_stub, _client_id, _symbol, _limit, _start_time_ms):
|
|
294
|
-
"""
|
|
295
|
-
Get trades for a specific account and symbol.
|
|
296
|
-
:param _stub:
|
|
297
|
-
:param _client_id:
|
|
298
|
-
:param _symbol:
|
|
299
|
-
:param _limit: int: Default 500; max 1000
|
|
300
|
-
:param _start_time_ms: int: optional, minimum time of fills to return, in Unix time (ms since 1970-01-01)
|
|
301
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#account-trade-list-user_data
|
|
302
|
-
"""
|
|
303
|
-
_trades = await _stub.fetch_account_trade_list(mr.AccountTradeListRequest(
|
|
304
|
-
client_id=_client_id,
|
|
305
|
-
symbol=_symbol,
|
|
306
|
-
limit=_limit,
|
|
307
|
-
start_time=_start_time_ms)
|
|
308
|
-
)
|
|
309
|
-
trades = list(map(json.loads, _trades.items))
|
|
310
|
-
print(f"fetch_account_trade_list.trades: {trades}")
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
async def transfer2master(_stub, symbol: str, amount: str):
|
|
314
|
-
"""
|
|
315
|
-
Send request to transfer asset from subaccount to main account
|
|
316
|
-
Binance, OKX: not additional settings needed
|
|
317
|
-
Bitfinex: for subaccount setting 2FA method, set WITHDRAWAL permission for API key,
|
|
318
|
-
in config for subaccount set 2FA key and master account EMail
|
|
319
|
-
Huobi: in config for subaccount set master_name for Main account
|
|
320
|
-
:param _stub:
|
|
321
|
-
:param symbol:
|
|
322
|
-
:param amount:
|
|
323
|
-
:return:
|
|
324
|
-
"""
|
|
325
|
-
try:
|
|
326
|
-
res = await _stub.transfer_to_master(mr.MarketRequest, symbol=symbol, amount=amount)
|
|
327
|
-
except asyncio.CancelledError:
|
|
328
|
-
pass # Task cancellation should not be logged as an error
|
|
329
|
-
except GRPCError as ex:
|
|
330
|
-
status_code = ex.status
|
|
331
|
-
print(f"Exception transfer {symbol} to main account: {status_code.name}, {ex.message}")
|
|
332
|
-
except Exception as _ex:
|
|
333
|
-
print(f"Exception transfer {symbol} to main account: {_ex}")
|
|
334
|
-
else:
|
|
335
|
-
if res.success:
|
|
336
|
-
print(f"Sent {amount} {symbol} to main account")
|
|
337
|
-
else:
|
|
338
|
-
print(f"Not sent {amount} {symbol} to main account\n,{res.result}")
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
async def transfer2sub(_stub, email: str, symbol: str, amount: str):
|
|
342
|
-
"""
|
|
343
|
-
Send request to transfer asset from subaccount to subaccount
|
|
344
|
-
Binance sub to sub only
|
|
345
|
-
:param _stub:
|
|
346
|
-
:param email:
|
|
347
|
-
:param symbol:
|
|
348
|
-
:param amount:
|
|
349
|
-
:return:
|
|
350
|
-
"""
|
|
351
|
-
try:
|
|
352
|
-
res = await _stub.transfer_to_sub(
|
|
353
|
-
mr.MarketRequest,
|
|
354
|
-
symbol=symbol,
|
|
355
|
-
amount=amount,
|
|
356
|
-
data=email
|
|
357
|
-
)
|
|
358
|
-
except asyncio.CancelledError:
|
|
359
|
-
pass # Task cancellation should not be logged as an error
|
|
360
|
-
except GRPCError as ex:
|
|
361
|
-
status_code = ex.status
|
|
362
|
-
print(f"Exception transfer {symbol} to sub account: {status_code.name}, {ex.message}")
|
|
363
|
-
except Exception as _ex:
|
|
364
|
-
print(f"Exception transfer {symbol} to sub account: {_ex}")
|
|
365
|
-
else:
|
|
366
|
-
if res.success:
|
|
367
|
-
print(f"Sent {amount} {symbol} to sub account {email}")
|
|
368
|
-
else:
|
|
369
|
-
print(f"Not sent {amount} {symbol} to sub account {email}\n,{res.result}")
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
# Server exception handling example for methods where it's realized
|
|
373
|
-
async def create_limit_order(_stub, _client_id, _symbol, _id: int, buy: bool, amount: str, price: str):
|
|
374
|
-
"""
|
|
375
|
-
Send in a new Limit order.
|
|
376
|
-
:param _stub:
|
|
377
|
-
:param _client_id:
|
|
378
|
-
:param _symbol:
|
|
379
|
-
:param _id: A unique id among open orders. Automatically generated if not sent
|
|
380
|
-
:param buy: True id BUY_side else False
|
|
381
|
-
:param amount: Base asset quantity
|
|
382
|
-
:param price:
|
|
383
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#new-order--trade
|
|
384
|
-
"""
|
|
385
|
-
try:
|
|
386
|
-
res = await _stub.create_limit_order(mr.CreateLimitOrderRequest(
|
|
387
|
-
client_id=_client_id,
|
|
388
|
-
symbol=_symbol,
|
|
389
|
-
buy_side=buy,
|
|
390
|
-
quantity=amount,
|
|
391
|
-
price=price,
|
|
392
|
-
new_client_order_id=_id
|
|
393
|
-
))
|
|
394
|
-
result = res.to_pydict()
|
|
395
|
-
except asyncio.CancelledError:
|
|
396
|
-
pass # Task cancellation should not be logged as an error
|
|
397
|
-
except GRPCError as ex:
|
|
398
|
-
status_code = ex.status
|
|
399
|
-
print(f"Exception creating order {_id}: {status_code.name}, {ex.message}")
|
|
400
|
-
if status_code == Status.FAILED_PRECONDITION:
|
|
401
|
-
print("Do something. See except declare in exch_srv.CreateLimitOrder()")
|
|
402
|
-
except Exception as _ex:
|
|
403
|
-
print(f"Exception creating order {_id}: {_ex}")
|
|
404
|
-
else:
|
|
405
|
-
print(f"create_limit_order.result: {result}")
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
# Server exception handling example for methods where it's realized
|
|
409
|
-
async def cancel_order(_stub, _client_id, _symbol, _id: int):
|
|
410
|
-
"""
|
|
411
|
-
Cancel an active order.
|
|
412
|
-
:param _stub:
|
|
413
|
-
:param _client_id:
|
|
414
|
-
:param _symbol:
|
|
415
|
-
:param _id: exchange order id
|
|
416
|
-
:return: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#cancel-order-trade
|
|
417
|
-
"""
|
|
418
|
-
try:
|
|
419
|
-
res = await _stub.cancel_order(mr.CancelOrderRequest(
|
|
420
|
-
client_id=_client_id,
|
|
421
|
-
symbol=_symbol,
|
|
422
|
-
order_id=_id))
|
|
423
|
-
result = res.to_pydict()
|
|
424
|
-
except asyncio.CancelledError:
|
|
425
|
-
pass # Task cancellation should not be logged as an error.
|
|
426
|
-
except GRPCError as ex:
|
|
427
|
-
status_code = ex.status
|
|
428
|
-
print(f"Exception on cancel order for {_id}: {status_code.name}, {ex.message}")
|
|
429
|
-
except Exception as _ex:
|
|
430
|
-
print(f"Exception on cancel order call for {_id}:\n{_ex}")
|
|
431
|
-
else:
|
|
432
|
-
print(f"Cancel order {_id} success: {result}")
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
if __name__ == "__main__":
|
|
436
|
-
asyncio.run(main(EXCHANGE, SYMBOL))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exchanges_wrapper-2.1.25 → exchanges_wrapper-2.1.26}/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
|
|
File without changes
|
|
File without changes
|