crypticorn 2.4.7__py3-none-any.whl → 2.5.0rc2__py3-none-any.whl
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.
- crypticorn/cli/init.py +7 -4
- crypticorn/common/__init__.py +1 -0
- crypticorn/common/auth.py +7 -3
- crypticorn/common/exceptions.py +27 -0
- crypticorn/common/utils.py +7 -2
- crypticorn/klines/client/__init__.py +10 -3
- crypticorn/klines/client/api/__init__.py +1 -0
- crypticorn/klines/client/api/change_in_timeframe_api.py +331 -0
- crypticorn/klines/client/api/funding_rates_api.py +13 -13
- crypticorn/klines/client/api/health_check_api.py +8 -8
- crypticorn/klines/client/api/ohlcv_data_api.py +38 -26
- crypticorn/klines/client/api/symbols_api.py +26 -20
- crypticorn/klines/client/api/udf_api.py +229 -229
- crypticorn/klines/client/api_client.py +8 -5
- crypticorn/klines/client/configuration.py +80 -37
- crypticorn/klines/client/models/__init__.py +9 -3
- crypticorn/klines/client/models/base_response_list_change_in_timeframe_response.py +123 -0
- crypticorn/klines/client/models/change_in_timeframe_response.py +86 -0
- crypticorn/klines/client/models/market_type.py +35 -0
- crypticorn/klines/client/models/response_get_udf_history.py +198 -0
- crypticorn/klines/client/rest.py +111 -159
- crypticorn/metrics/main.py +1 -0
- crypticorn/pay/client/__init__.py +0 -3
- crypticorn/pay/client/api/now_payments_api.py +1 -53
- crypticorn/pay/client/models/__init__.py +0 -3
- crypticorn/pay/client/models/payment.py +3 -3
- crypticorn/pay/client/models/scope.py +6 -1
- crypticorn/trade/client/__init__.py +8 -6
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/api_keys_api.py +167 -273
- crypticorn/trade/client/api/bots_api.py +140 -226
- crypticorn/trade/client/api/exchanges_api.py +31 -51
- crypticorn/trade/client/api/futures_trading_panel_api.py +169 -272
- crypticorn/trade/client/api/notifications_api.py +200 -323
- crypticorn/trade/client/api/orders_api.py +40 -60
- crypticorn/trade/client/api/status_api.py +31 -49
- crypticorn/trade/client/api/strategies_api.py +137 -223
- crypticorn/trade/client/api/trading_actions_api.py +106 -170
- crypticorn/trade/client/api_client.py +111 -153
- crypticorn/trade/client/api_response.py +2 -3
- crypticorn/trade/client/configuration.py +128 -115
- crypticorn/trade/client/exceptions.py +25 -21
- crypticorn/trade/client/models/__init__.py +8 -6
- crypticorn/trade/client/models/action_model.py +108 -54
- crypticorn/trade/client/models/api_error_identifier.py +76 -72
- crypticorn/trade/client/models/api_error_level.py +9 -11
- crypticorn/trade/client/models/api_error_type.py +9 -11
- crypticorn/trade/client/models/bot_model.py +57 -36
- crypticorn/trade/client/models/bot_status.py +9 -11
- crypticorn/trade/client/models/exchange.py +7 -9
- crypticorn/trade/client/models/exchange_key_model.py +43 -32
- crypticorn/trade/client/models/execution_ids.py +18 -18
- crypticorn/trade/client/models/futures_balance.py +43 -27
- crypticorn/trade/client/models/futures_trading_action.py +102 -50
- crypticorn/trade/client/models/http_validation_error.py +19 -15
- crypticorn/trade/client/models/margin_mode.py +7 -9
- crypticorn/trade/client/models/market_type.py +7 -9
- crypticorn/trade/client/models/notification_model.py +52 -32
- crypticorn/trade/client/models/order_model.py +112 -72
- crypticorn/trade/client/models/order_status.py +10 -12
- crypticorn/trade/client/models/post_futures_action.py +20 -16
- crypticorn/trade/client/models/strategy_exchange_info.py +15 -16
- crypticorn/trade/client/models/strategy_model_input.py +61 -33
- crypticorn/trade/client/models/strategy_model_output.py +61 -33
- crypticorn/trade/client/models/tpsl.py +39 -25
- crypticorn/trade/client/models/trading_action_type.py +9 -11
- crypticorn/trade/client/models/validation_error.py +24 -18
- crypticorn/trade/client/models/validation_error_loc_inner.py +37 -16
- crypticorn/trade/client/rest.py +23 -38
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0rc2.dist-info}/METADATA +1 -1
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0rc2.dist-info}/RECORD +74 -68
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0rc2.dist-info}/WHEEL +1 -1
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0rc2.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0rc2.dist-info}/top_level.txt +0 -0
crypticorn/klines/client/rest.py
CHANGED
@@ -16,23 +16,16 @@ import io
|
|
16
16
|
import json
|
17
17
|
import re
|
18
18
|
import ssl
|
19
|
+
from typing import Optional, Union
|
19
20
|
|
20
|
-
import
|
21
|
+
import aiohttp
|
22
|
+
import aiohttp_retry
|
21
23
|
|
22
24
|
from crypticorn.klines.client.exceptions import ApiException, ApiValueError
|
23
25
|
|
24
|
-
|
25
|
-
RESTResponseType = urllib3.HTTPResponse
|
26
|
+
RESTResponseType = aiohttp.ClientResponse
|
26
27
|
|
27
|
-
|
28
|
-
def is_socks_proxy_url(url):
|
29
|
-
if url is None:
|
30
|
-
return False
|
31
|
-
split_section = url.split("://")
|
32
|
-
if len(split_section) < 2:
|
33
|
-
return False
|
34
|
-
else:
|
35
|
-
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
28
|
+
ALLOW_RETRY_METHODS = frozenset({"DELETE", "GET", "HEAD", "OPTIONS", "PUT", "TRACE"})
|
36
29
|
|
37
30
|
|
38
31
|
class RESTResponse(io.IOBase):
|
@@ -43,13 +36,13 @@ class RESTResponse(io.IOBase):
|
|
43
36
|
self.reason = resp.reason
|
44
37
|
self.data = None
|
45
38
|
|
46
|
-
def read(self):
|
39
|
+
async def read(self):
|
47
40
|
if self.data is None:
|
48
|
-
self.data = self.response.
|
41
|
+
self.data = await self.response.read()
|
49
42
|
return self.data
|
50
43
|
|
51
44
|
def getheaders(self):
|
52
|
-
"""Returns a
|
45
|
+
"""Returns a CIMultiDictProxy of the response headers."""
|
53
46
|
return self.response.headers
|
54
47
|
|
55
48
|
def getheader(self, name, default=None):
|
@@ -60,56 +53,38 @@ class RESTResponse(io.IOBase):
|
|
60
53
|
class RESTClientObject:
|
61
54
|
|
62
55
|
def __init__(self, configuration) -> None:
|
63
|
-
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
64
|
-
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
65
|
-
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
66
|
-
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
67
|
-
|
68
|
-
# cert_reqs
|
69
|
-
if configuration.verify_ssl:
|
70
|
-
cert_reqs = ssl.CERT_REQUIRED
|
71
|
-
else:
|
72
|
-
cert_reqs = ssl.CERT_NONE
|
73
|
-
|
74
|
-
pool_args = {
|
75
|
-
"cert_reqs": cert_reqs,
|
76
|
-
"ca_certs": configuration.ssl_ca_cert,
|
77
|
-
"cert_file": configuration.cert_file,
|
78
|
-
"key_file": configuration.key_file,
|
79
|
-
}
|
80
|
-
if configuration.assert_hostname is not None:
|
81
|
-
pool_args["assert_hostname"] = configuration.assert_hostname
|
82
|
-
|
83
|
-
if configuration.retries is not None:
|
84
|
-
pool_args["retries"] = configuration.retries
|
85
|
-
|
86
|
-
if configuration.tls_server_name:
|
87
|
-
pool_args["server_hostname"] = configuration.tls_server_name
|
88
|
-
|
89
|
-
if configuration.socket_options is not None:
|
90
|
-
pool_args["socket_options"] = configuration.socket_options
|
91
|
-
|
92
|
-
if configuration.connection_pool_maxsize is not None:
|
93
|
-
pool_args["maxsize"] = configuration.connection_pool_maxsize
|
94
56
|
|
95
|
-
#
|
96
|
-
self.
|
57
|
+
# maxsize is number of requests to host that are allowed in parallel
|
58
|
+
self.maxsize = configuration.connection_pool_maxsize
|
97
59
|
|
98
|
-
|
99
|
-
|
100
|
-
|
60
|
+
self.ssl_context = ssl.create_default_context(
|
61
|
+
cafile=configuration.ssl_ca_cert,
|
62
|
+
cadata=configuration.ca_cert_data,
|
63
|
+
)
|
64
|
+
if configuration.cert_file:
|
65
|
+
self.ssl_context.load_cert_chain(
|
66
|
+
configuration.cert_file, keyfile=configuration.key_file
|
67
|
+
)
|
101
68
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
69
|
+
if not configuration.verify_ssl:
|
70
|
+
self.ssl_context.check_hostname = False
|
71
|
+
self.ssl_context.verify_mode = ssl.CERT_NONE
|
72
|
+
|
73
|
+
self.proxy = configuration.proxy
|
74
|
+
self.proxy_headers = configuration.proxy_headers
|
75
|
+
|
76
|
+
self.retries = configuration.retries
|
77
|
+
|
78
|
+
self.pool_manager: Optional[aiohttp.ClientSession] = None
|
79
|
+
self.retry_client: Optional[aiohttp_retry.RetryClient] = None
|
111
80
|
|
112
|
-
def
|
81
|
+
async def close(self) -> None:
|
82
|
+
if self.pool_manager:
|
83
|
+
await self.pool_manager.close()
|
84
|
+
if self.retry_client is not None:
|
85
|
+
await self.retry_client.close()
|
86
|
+
|
87
|
+
async def request(
|
113
88
|
self,
|
114
89
|
method,
|
115
90
|
url,
|
@@ -118,7 +93,7 @@ class RESTClientObject:
|
|
118
93
|
post_params=None,
|
119
94
|
_request_timeout=None,
|
120
95
|
):
|
121
|
-
"""
|
96
|
+
"""Execute request
|
122
97
|
|
123
98
|
:param method: http request method
|
124
99
|
:param url: http request url
|
@@ -142,105 +117,82 @@ class RESTClientObject:
|
|
142
117
|
|
143
118
|
post_params = post_params or {}
|
144
119
|
headers = headers or {}
|
120
|
+
# url already contains the URL query string
|
121
|
+
timeout = _request_timeout or 5 * 60
|
122
|
+
|
123
|
+
if "Content-Type" not in headers:
|
124
|
+
headers["Content-Type"] = "application/json"
|
125
|
+
|
126
|
+
args = {"method": method, "url": url, "timeout": timeout, "headers": headers}
|
127
|
+
|
128
|
+
if self.proxy:
|
129
|
+
args["proxy"] = self.proxy
|
130
|
+
if self.proxy_headers:
|
131
|
+
args["proxy_headers"] = self.proxy_headers
|
132
|
+
|
133
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
134
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
135
|
+
if re.search("json", headers["Content-Type"], re.IGNORECASE):
|
136
|
+
if body is not None:
|
137
|
+
body = json.dumps(body)
|
138
|
+
args["data"] = body
|
139
|
+
elif headers["Content-Type"] == "application/x-www-form-urlencoded":
|
140
|
+
args["data"] = aiohttp.FormData(post_params)
|
141
|
+
elif headers["Content-Type"] == "multipart/form-data":
|
142
|
+
# must del headers['Content-Type'], or the correct
|
143
|
+
# Content-Type which generated by aiohttp
|
144
|
+
del headers["Content-Type"]
|
145
|
+
data = aiohttp.FormData()
|
146
|
+
for param in post_params:
|
147
|
+
k, v = param
|
148
|
+
if isinstance(v, tuple) and len(v) == 3:
|
149
|
+
data.add_field(k, value=v[1], filename=v[0], content_type=v[2])
|
150
|
+
else:
|
151
|
+
# Ensures that dict objects are serialized
|
152
|
+
if isinstance(v, dict):
|
153
|
+
v = json.dumps(v)
|
154
|
+
elif isinstance(v, int):
|
155
|
+
v = str(v)
|
156
|
+
data.add_field(k, v)
|
157
|
+
args["data"] = data
|
158
|
+
|
159
|
+
# Pass a `bytes` or `str` parameter directly in the body to support
|
160
|
+
# other content types than Json when `body` argument is provided
|
161
|
+
# in serialized form
|
162
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
163
|
+
args["data"] = body
|
164
|
+
else:
|
165
|
+
# Cannot generate the request from given parameters
|
166
|
+
msg = """Cannot prepare a request message for provided
|
167
|
+
arguments. Please check that your arguments match
|
168
|
+
declared content type."""
|
169
|
+
raise ApiException(status=0, reason=msg)
|
145
170
|
|
146
|
-
|
147
|
-
if _request_timeout:
|
148
|
-
if isinstance(_request_timeout, (int, float)):
|
149
|
-
timeout = urllib3.Timeout(total=_request_timeout)
|
150
|
-
elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
|
151
|
-
timeout = urllib3.Timeout(
|
152
|
-
connect=_request_timeout[0], read=_request_timeout[1]
|
153
|
-
)
|
171
|
+
pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
|
154
172
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
method,
|
176
|
-
url,
|
177
|
-
fields=post_params,
|
178
|
-
encode_multipart=False,
|
179
|
-
timeout=timeout,
|
180
|
-
headers=headers,
|
181
|
-
preload_content=False,
|
182
|
-
)
|
183
|
-
elif content_type == "multipart/form-data":
|
184
|
-
# must del headers['Content-Type'], or the correct
|
185
|
-
# Content-Type which generated by urllib3 will be
|
186
|
-
# overwritten.
|
187
|
-
del headers["Content-Type"]
|
188
|
-
# Ensures that dict objects are serialized
|
189
|
-
post_params = [
|
190
|
-
(a, json.dumps(b)) if isinstance(b, dict) else (a, b)
|
191
|
-
for a, b in post_params
|
192
|
-
]
|
193
|
-
r = self.pool_manager.request(
|
194
|
-
method,
|
195
|
-
url,
|
196
|
-
fields=post_params,
|
197
|
-
encode_multipart=True,
|
198
|
-
timeout=timeout,
|
199
|
-
headers=headers,
|
200
|
-
preload_content=False,
|
201
|
-
)
|
202
|
-
# Pass a `string` parameter directly in the body to support
|
203
|
-
# other content types than JSON when `body` argument is
|
204
|
-
# provided in serialized form.
|
205
|
-
elif isinstance(body, str) or isinstance(body, bytes):
|
206
|
-
r = self.pool_manager.request(
|
207
|
-
method,
|
208
|
-
url,
|
209
|
-
body=body,
|
210
|
-
timeout=timeout,
|
211
|
-
headers=headers,
|
212
|
-
preload_content=False,
|
213
|
-
)
|
214
|
-
elif headers["Content-Type"].startswith("text/") and isinstance(
|
215
|
-
body, bool
|
216
|
-
):
|
217
|
-
request_body = "true" if body else "false"
|
218
|
-
r = self.pool_manager.request(
|
219
|
-
method,
|
220
|
-
url,
|
221
|
-
body=request_body,
|
222
|
-
preload_content=False,
|
223
|
-
timeout=timeout,
|
224
|
-
headers=headers,
|
225
|
-
)
|
226
|
-
else:
|
227
|
-
# Cannot generate the request from given parameters
|
228
|
-
msg = """Cannot prepare a request message for provided
|
229
|
-
arguments. Please check that your arguments match
|
230
|
-
declared content type."""
|
231
|
-
raise ApiException(status=0, reason=msg)
|
232
|
-
# For `GET`, `HEAD`
|
233
|
-
else:
|
234
|
-
r = self.pool_manager.request(
|
235
|
-
method,
|
236
|
-
url,
|
237
|
-
fields={},
|
238
|
-
timeout=timeout,
|
239
|
-
headers=headers,
|
240
|
-
preload_content=False,
|
173
|
+
# https pool manager
|
174
|
+
if self.pool_manager is None:
|
175
|
+
self.pool_manager = aiohttp.ClientSession(
|
176
|
+
connector=aiohttp.TCPConnector(
|
177
|
+
limit=self.maxsize, ssl=self.ssl_context
|
178
|
+
),
|
179
|
+
trust_env=True,
|
180
|
+
)
|
181
|
+
pool_manager = self.pool_manager
|
182
|
+
|
183
|
+
if self.retries is not None and method in ALLOW_RETRY_METHODS:
|
184
|
+
if self.retry_client is None:
|
185
|
+
self.retry_client = aiohttp_retry.RetryClient(
|
186
|
+
client_session=self.pool_manager,
|
187
|
+
retry_options=aiohttp_retry.ExponentialRetry(
|
188
|
+
attempts=self.retries,
|
189
|
+
factor=2.0,
|
190
|
+
start_timeout=0.1,
|
191
|
+
max_timeout=120.0,
|
192
|
+
),
|
241
193
|
)
|
242
|
-
|
243
|
-
|
244
|
-
|
194
|
+
pool_manager = self.retry_client
|
195
|
+
|
196
|
+
r = await pool_manager.request(**args)
|
245
197
|
|
246
198
|
return RESTResponse(r)
|
crypticorn/metrics/main.py
CHANGED
@@ -38,9 +38,6 @@ from crypticorn.pay.client.models.http_validation_error import HTTPValidationErr
|
|
38
38
|
from crypticorn.pay.client.models.now_api_status_res import NowAPIStatusRes
|
39
39
|
from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
|
40
40
|
from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
|
41
|
-
from crypticorn.pay.client.models.now_fee_structure import NowFeeStructure
|
42
|
-
from crypticorn.pay.client.models.now_payment_status import NowPaymentStatus
|
43
|
-
from crypticorn.pay.client.models.now_webhook_payload import NowWebhookPayload
|
44
41
|
from crypticorn.pay.client.models.payment import Payment
|
45
42
|
from crypticorn.pay.client.models.payment_status import PaymentStatus
|
46
43
|
from crypticorn.pay.client.models.product_create import ProductCreate
|
@@ -16,13 +16,10 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
16
16
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
17
17
|
from typing_extensions import Annotated
|
18
18
|
|
19
|
-
from pydantic import Field, StrictStr
|
20
19
|
from typing import Any
|
21
|
-
from typing_extensions import Annotated
|
22
20
|
from crypticorn.pay.client.models.now_api_status_res import NowAPIStatusRes
|
23
21
|
from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
|
24
22
|
from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
|
25
|
-
from crypticorn.pay.client.models.now_webhook_payload import NowWebhookPayload
|
26
23
|
|
27
24
|
from crypticorn.pay.client.api_client import ApiClient, RequestSerialized
|
28
25
|
from crypticorn.pay.client.api_response import ApiResponse
|
@@ -526,10 +523,6 @@ class NOWPaymentsApi:
|
|
526
523
|
@validate_call
|
527
524
|
async def handle_now_webhook(
|
528
525
|
self,
|
529
|
-
x_nowpayments_sig: Annotated[
|
530
|
-
StrictStr, Field(description="Signature for the webhook")
|
531
|
-
],
|
532
|
-
now_webhook_payload: NowWebhookPayload,
|
533
526
|
_request_timeout: Union[
|
534
527
|
None,
|
535
528
|
Annotated[StrictFloat, Field(gt=0)],
|
@@ -546,10 +539,6 @@ class NOWPaymentsApi:
|
|
546
539
|
|
547
540
|
Handle NOWPayments webhook notifications (IPN). Validates the signature, updates the payment status and creates a product subscription if the payment is successful.
|
548
541
|
|
549
|
-
:param x_nowpayments_sig: Signature for the webhook (required)
|
550
|
-
:type x_nowpayments_sig: str
|
551
|
-
:param now_webhook_payload: (required)
|
552
|
-
:type now_webhook_payload: NowWebhookPayload
|
553
542
|
:param _request_timeout: timeout setting for this request. If one
|
554
543
|
number provided, it will be total request
|
555
544
|
timeout. It can also be a pair (tuple) of
|
@@ -573,8 +562,6 @@ class NOWPaymentsApi:
|
|
573
562
|
""" # noqa: E501
|
574
563
|
|
575
564
|
_param = self._handle_now_webhook_serialize(
|
576
|
-
x_nowpayments_sig=x_nowpayments_sig,
|
577
|
-
now_webhook_payload=now_webhook_payload,
|
578
565
|
_request_auth=_request_auth,
|
579
566
|
_content_type=_content_type,
|
580
567
|
_headers=_headers,
|
@@ -583,7 +570,6 @@ class NOWPaymentsApi:
|
|
583
570
|
|
584
571
|
_response_types_map: Dict[str, Optional[str]] = {
|
585
572
|
"200": "object",
|
586
|
-
"422": "HTTPValidationError",
|
587
573
|
}
|
588
574
|
response_data = await self.api_client.call_api(
|
589
575
|
*_param, _request_timeout=_request_timeout
|
@@ -597,10 +583,6 @@ class NOWPaymentsApi:
|
|
597
583
|
@validate_call
|
598
584
|
async def handle_now_webhook_with_http_info(
|
599
585
|
self,
|
600
|
-
x_nowpayments_sig: Annotated[
|
601
|
-
StrictStr, Field(description="Signature for the webhook")
|
602
|
-
],
|
603
|
-
now_webhook_payload: NowWebhookPayload,
|
604
586
|
_request_timeout: Union[
|
605
587
|
None,
|
606
588
|
Annotated[StrictFloat, Field(gt=0)],
|
@@ -617,10 +599,6 @@ class NOWPaymentsApi:
|
|
617
599
|
|
618
600
|
Handle NOWPayments webhook notifications (IPN). Validates the signature, updates the payment status and creates a product subscription if the payment is successful.
|
619
601
|
|
620
|
-
:param x_nowpayments_sig: Signature for the webhook (required)
|
621
|
-
:type x_nowpayments_sig: str
|
622
|
-
:param now_webhook_payload: (required)
|
623
|
-
:type now_webhook_payload: NowWebhookPayload
|
624
602
|
:param _request_timeout: timeout setting for this request. If one
|
625
603
|
number provided, it will be total request
|
626
604
|
timeout. It can also be a pair (tuple) of
|
@@ -644,8 +622,6 @@ class NOWPaymentsApi:
|
|
644
622
|
""" # noqa: E501
|
645
623
|
|
646
624
|
_param = self._handle_now_webhook_serialize(
|
647
|
-
x_nowpayments_sig=x_nowpayments_sig,
|
648
|
-
now_webhook_payload=now_webhook_payload,
|
649
625
|
_request_auth=_request_auth,
|
650
626
|
_content_type=_content_type,
|
651
627
|
_headers=_headers,
|
@@ -654,7 +630,6 @@ class NOWPaymentsApi:
|
|
654
630
|
|
655
631
|
_response_types_map: Dict[str, Optional[str]] = {
|
656
632
|
"200": "object",
|
657
|
-
"422": "HTTPValidationError",
|
658
633
|
}
|
659
634
|
response_data = await self.api_client.call_api(
|
660
635
|
*_param, _request_timeout=_request_timeout
|
@@ -668,10 +643,6 @@ class NOWPaymentsApi:
|
|
668
643
|
@validate_call
|
669
644
|
async def handle_now_webhook_without_preload_content(
|
670
645
|
self,
|
671
|
-
x_nowpayments_sig: Annotated[
|
672
|
-
StrictStr, Field(description="Signature for the webhook")
|
673
|
-
],
|
674
|
-
now_webhook_payload: NowWebhookPayload,
|
675
646
|
_request_timeout: Union[
|
676
647
|
None,
|
677
648
|
Annotated[StrictFloat, Field(gt=0)],
|
@@ -688,10 +659,6 @@ class NOWPaymentsApi:
|
|
688
659
|
|
689
660
|
Handle NOWPayments webhook notifications (IPN). Validates the signature, updates the payment status and creates a product subscription if the payment is successful.
|
690
661
|
|
691
|
-
:param x_nowpayments_sig: Signature for the webhook (required)
|
692
|
-
:type x_nowpayments_sig: str
|
693
|
-
:param now_webhook_payload: (required)
|
694
|
-
:type now_webhook_payload: NowWebhookPayload
|
695
662
|
:param _request_timeout: timeout setting for this request. If one
|
696
663
|
number provided, it will be total request
|
697
664
|
timeout. It can also be a pair (tuple) of
|
@@ -715,8 +682,6 @@ class NOWPaymentsApi:
|
|
715
682
|
""" # noqa: E501
|
716
683
|
|
717
684
|
_param = self._handle_now_webhook_serialize(
|
718
|
-
x_nowpayments_sig=x_nowpayments_sig,
|
719
|
-
now_webhook_payload=now_webhook_payload,
|
720
685
|
_request_auth=_request_auth,
|
721
686
|
_content_type=_content_type,
|
722
687
|
_headers=_headers,
|
@@ -725,7 +690,6 @@ class NOWPaymentsApi:
|
|
725
690
|
|
726
691
|
_response_types_map: Dict[str, Optional[str]] = {
|
727
692
|
"200": "object",
|
728
|
-
"422": "HTTPValidationError",
|
729
693
|
}
|
730
694
|
response_data = await self.api_client.call_api(
|
731
695
|
*_param, _request_timeout=_request_timeout
|
@@ -734,8 +698,6 @@ class NOWPaymentsApi:
|
|
734
698
|
|
735
699
|
def _handle_now_webhook_serialize(
|
736
700
|
self,
|
737
|
-
x_nowpayments_sig,
|
738
|
-
now_webhook_payload,
|
739
701
|
_request_auth,
|
740
702
|
_content_type,
|
741
703
|
_headers,
|
@@ -758,12 +720,8 @@ class NOWPaymentsApi:
|
|
758
720
|
# process the path parameters
|
759
721
|
# process the query parameters
|
760
722
|
# process the header parameters
|
761
|
-
if x_nowpayments_sig is not None:
|
762
|
-
_header_params["x-nowpayments-sig"] = x_nowpayments_sig
|
763
723
|
# process the form parameters
|
764
724
|
# process the body parameter
|
765
|
-
if now_webhook_payload is not None:
|
766
|
-
_body_params = now_webhook_payload
|
767
725
|
|
768
726
|
# set the HTTP header `Accept`
|
769
727
|
if "Accept" not in _header_params:
|
@@ -771,18 +729,8 @@ class NOWPaymentsApi:
|
|
771
729
|
["application/json"]
|
772
730
|
)
|
773
731
|
|
774
|
-
# set the HTTP header `Content-Type`
|
775
|
-
if _content_type:
|
776
|
-
_header_params["Content-Type"] = _content_type
|
777
|
-
else:
|
778
|
-
_default_content_type = self.api_client.select_header_content_type(
|
779
|
-
["application/json"]
|
780
|
-
)
|
781
|
-
if _default_content_type is not None:
|
782
|
-
_header_params["Content-Type"] = _default_content_type
|
783
|
-
|
784
732
|
# authentication setting
|
785
|
-
_auth_settings: List[str] = [
|
733
|
+
_auth_settings: List[str] = []
|
786
734
|
|
787
735
|
return self.api_client.param_serialize(
|
788
736
|
method="POST",
|
@@ -18,9 +18,6 @@ from crypticorn.pay.client.models.http_validation_error import HTTPValidationErr
|
|
18
18
|
from crypticorn.pay.client.models.now_api_status_res import NowAPIStatusRes
|
19
19
|
from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
|
20
20
|
from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
|
21
|
-
from crypticorn.pay.client.models.now_fee_structure import NowFeeStructure
|
22
|
-
from crypticorn.pay.client.models.now_payment_status import NowPaymentStatus
|
23
|
-
from crypticorn.pay.client.models.now_webhook_payload import NowWebhookPayload
|
24
21
|
from crypticorn.pay.client.models.payment import Payment
|
25
22
|
from crypticorn.pay.client.models.payment_status import PaymentStatus
|
26
23
|
from crypticorn.pay.client.models.product_create import ProductCreate
|
@@ -32,7 +32,7 @@ class Payment(BaseModel):
|
|
32
32
|
|
33
33
|
id: StrictStr = Field(description="Payment ID")
|
34
34
|
product_id: StrictStr = Field(description="Product ID")
|
35
|
-
|
35
|
+
timestamp: StrictInt = Field(description="Payment timestamp in seconds")
|
36
36
|
amount: Union[StrictFloat, StrictInt] = Field(description="Payment amount")
|
37
37
|
currency: StrictStr = Field(description="Payment currency")
|
38
38
|
status: PaymentStatus
|
@@ -41,7 +41,7 @@ class Payment(BaseModel):
|
|
41
41
|
__properties: ClassVar[List[str]] = [
|
42
42
|
"id",
|
43
43
|
"product_id",
|
44
|
-
"
|
44
|
+
"timestamp",
|
45
45
|
"amount",
|
46
46
|
"currency",
|
47
47
|
"status",
|
@@ -101,7 +101,7 @@ class Payment(BaseModel):
|
|
101
101
|
{
|
102
102
|
"id": obj.get("id"),
|
103
103
|
"product_id": obj.get("product_id"),
|
104
|
-
"
|
104
|
+
"timestamp": obj.get("timestamp"),
|
105
105
|
"amount": obj.get("amount"),
|
106
106
|
"currency": obj.get("currency"),
|
107
107
|
"status": obj.get("status"),
|
@@ -26,6 +26,7 @@ class Scope(str, Enum):
|
|
26
26
|
"""
|
27
27
|
allowed enum values
|
28
28
|
"""
|
29
|
+
READ_COLON_PREDICTIONS = "read:predictions"
|
29
30
|
READ_COLON_HIVE_COLON_MODEL = "read:hive:model"
|
30
31
|
READ_COLON_HIVE_COLON_DATA = "read:hive:data"
|
31
32
|
WRITE_COLON_HIVE_COLON_MODEL = "write:hive:model"
|
@@ -48,7 +49,11 @@ class Scope(str, Enum):
|
|
48
49
|
WRITE_COLON_PAY_COLON_PRODUCTS = "write:pay:products"
|
49
50
|
READ_COLON_PAY_COLON_NOW = "read:pay:now"
|
50
51
|
WRITE_COLON_PAY_COLON_NOW = "write:pay:now"
|
51
|
-
|
52
|
+
READ_COLON_METRICS_COLON_MARKETCAP = "read:metrics:marketcap"
|
53
|
+
READ_COLON_METRICS_COLON_INDICATORS = "read:metrics:indicators"
|
54
|
+
READ_COLON_METRICS_COLON_EXCHANGES = "read:metrics:exchanges"
|
55
|
+
READ_COLON_METRICS_COLON_TOKENS = "read:metrics:tokens"
|
56
|
+
READ_COLON_METRICS_COLON_MARKETS = "read:metrics:markets"
|
52
57
|
|
53
58
|
@classmethod
|
54
59
|
def from_json(cls, json_str: str) -> Self:
|
@@ -3,14 +3,14 @@
|
|
3
3
|
# flake8: noqa
|
4
4
|
|
5
5
|
"""
|
6
|
-
|
6
|
+
Trading API
|
7
7
|
|
8
|
-
|
8
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
The version of the OpenAPI document: 0.1.0
|
11
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
12
12
|
|
13
|
-
|
13
|
+
Do not edit the class manually.
|
14
14
|
""" # noqa: E501
|
15
15
|
|
16
16
|
|
@@ -63,4 +63,6 @@ from crypticorn.trade.client.models.strategy_model_output import StrategyModelOu
|
|
63
63
|
from crypticorn.trade.client.models.tpsl import TPSL
|
64
64
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
65
65
|
from crypticorn.trade.client.models.validation_error import ValidationError
|
66
|
-
from crypticorn.trade.client.models.validation_error_loc_inner import
|
66
|
+
from crypticorn.trade.client.models.validation_error_loc_inner import (
|
67
|
+
ValidationErrorLocInner,
|
68
|
+
)
|
@@ -10,4 +10,3 @@ from crypticorn.trade.client.api.orders_api import OrdersApi
|
|
10
10
|
from crypticorn.trade.client.api.status_api import StatusApi
|
11
11
|
from crypticorn.trade.client.api.strategies_api import StrategiesApi
|
12
12
|
from crypticorn.trade.client.api.trading_actions_api import TradingActionsApi
|
13
|
-
|