crypticorn 2.7.4__py3-none-any.whl → 2.8.0__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/__init__.py +8 -1
- crypticorn/auth/client/models/create_api_key_request.py +3 -1
- crypticorn/auth/client/models/get_api_keys200_response_inner.py +3 -1
- crypticorn/client.py +34 -16
- crypticorn/common/__init__.py +5 -1
- crypticorn/common/ansi_colors.py +37 -0
- crypticorn/common/auth.py +3 -1
- crypticorn/common/exceptions.py +29 -11
- crypticorn/common/logging.py +126 -0
- crypticorn/common/middleware.py +27 -0
- crypticorn/common/mixins.py +2 -1
- crypticorn/common/router/admin_router.py +100 -0
- crypticorn/common/router/status_router.py +24 -0
- crypticorn/common/scopes.py +5 -0
- crypticorn/hive/client/__init__.py +6 -3
- crypticorn/hive/client/api/__init__.py +1 -0
- crypticorn/hive/client/api/admin_api.py +1452 -0
- crypticorn/hive/client/api/models_api.py +7 -7
- crypticorn/hive/client/api/status_api.py +4 -231
- crypticorn/hive/client/models/__init__.py +5 -3
- crypticorn/hive/client/models/api_error_identifier.py +115 -0
- crypticorn/hive/client/models/api_error_level.py +37 -0
- crypticorn/hive/client/models/api_error_type.py +37 -0
- crypticorn/hive/client/models/data_info.py +27 -5
- crypticorn/hive/client/models/data_options.py +92 -0
- crypticorn/hive/client/models/exception_detail.py +6 -3
- crypticorn/hive/client/models/log_level.py +38 -0
- crypticorn/hive/client/models/model.py +3 -3
- crypticorn/hive/main.py +22 -3
- crypticorn/hive/utils.py +1 -2
- crypticorn/metrics/client/__init__.py +11 -0
- crypticorn/metrics/client/api/__init__.py +2 -0
- crypticorn/metrics/client/api/admin_api.py +1452 -0
- crypticorn/metrics/client/api/exchanges_api.py +51 -40
- crypticorn/metrics/client/api/indicators_api.py +49 -32
- crypticorn/metrics/client/api/logs_api.py +7 -7
- crypticorn/metrics/client/api/marketcap_api.py +28 -25
- crypticorn/metrics/client/api/markets_api.py +50 -278
- crypticorn/metrics/client/api/quote_currencies_api.py +289 -0
- crypticorn/metrics/client/api/status_api.py +4 -231
- crypticorn/metrics/client/api/tokens_api.py +241 -37
- crypticorn/metrics/client/models/__init__.py +9 -0
- crypticorn/metrics/client/models/api_error_identifier.py +115 -0
- crypticorn/metrics/client/models/api_error_level.py +37 -0
- crypticorn/metrics/client/models/api_error_type.py +37 -0
- crypticorn/metrics/client/models/exception_detail.py +6 -3
- crypticorn/metrics/client/models/exchange_mapping.py +121 -0
- crypticorn/metrics/client/models/internal_exchange.py +39 -0
- crypticorn/metrics/client/models/log_level.py +38 -0
- crypticorn/metrics/client/models/market_type.py +35 -0
- crypticorn/metrics/client/models/marketcap_ranking.py +87 -0
- crypticorn/metrics/client/models/ohlcv.py +113 -0
- crypticorn/metrics/main.py +14 -2
- crypticorn/pay/client/__init__.py +3 -0
- crypticorn/pay/client/api/__init__.py +1 -0
- crypticorn/pay/client/api/admin_api.py +1453 -0
- crypticorn/pay/client/api/status_api.py +4 -231
- crypticorn/pay/client/models/__init__.py +2 -0
- crypticorn/pay/client/models/log_level.py +38 -0
- crypticorn/{hive/client/models/data_value_value_value_inner.py → pay/client/models/response_getuptime.py} +36 -31
- crypticorn/pay/client/models/scope.py +2 -0
- crypticorn/pay/main.py +2 -0
- {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/METADATA +46 -21
- {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/RECORD +67 -44
- {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/WHEEL +1 -1
- crypticorn/common/status_router.py +0 -44
- {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/top_level.txt +0 -0
@@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
17
|
from typing_extensions import Annotated
|
18
18
|
|
19
19
|
from pydantic import StrictStr, field_validator
|
20
|
-
from typing import
|
20
|
+
from typing import Optional
|
21
21
|
|
22
22
|
from crypticorn.pay.client.api_client import ApiClient, RequestSerialized
|
23
23
|
from crypticorn.pay.client.api_response import ApiResponse
|
@@ -36,233 +36,6 @@ class StatusApi:
|
|
36
36
|
api_client = ApiClient.get_default()
|
37
37
|
self.api_client = api_client
|
38
38
|
|
39
|
-
@validate_call
|
40
|
-
async def get_config(
|
41
|
-
self,
|
42
|
-
_request_timeout: Union[
|
43
|
-
None,
|
44
|
-
Annotated[StrictFloat, Field(gt=0)],
|
45
|
-
Tuple[
|
46
|
-
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
47
|
-
],
|
48
|
-
] = None,
|
49
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
50
|
-
_content_type: Optional[StrictStr] = None,
|
51
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
52
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
53
|
-
) -> Dict[str, object]:
|
54
|
-
"""Config
|
55
|
-
|
56
|
-
Returns the version of the crypticorn library and the environment.
|
57
|
-
|
58
|
-
:param _request_timeout: timeout setting for this request. If one
|
59
|
-
number provided, it will be total request
|
60
|
-
timeout. It can also be a pair (tuple) of
|
61
|
-
(connection, read) timeouts.
|
62
|
-
:type _request_timeout: int, tuple(int, int), optional
|
63
|
-
:param _request_auth: set to override the auth_settings for an a single
|
64
|
-
request; this effectively ignores the
|
65
|
-
authentication in the spec for a single request.
|
66
|
-
:type _request_auth: dict, optional
|
67
|
-
:param _content_type: force content-type for the request.
|
68
|
-
:type _content_type: str, Optional
|
69
|
-
:param _headers: set to override the headers for a single
|
70
|
-
request; this effectively ignores the headers
|
71
|
-
in the spec for a single request.
|
72
|
-
:type _headers: dict, optional
|
73
|
-
:param _host_index: set to override the host_index for a single
|
74
|
-
request; this effectively ignores the host_index
|
75
|
-
in the spec for a single request.
|
76
|
-
:type _host_index: int, optional
|
77
|
-
:return: Returns the result object.
|
78
|
-
""" # noqa: E501
|
79
|
-
|
80
|
-
_param = self._get_config_serialize(
|
81
|
-
_request_auth=_request_auth,
|
82
|
-
_content_type=_content_type,
|
83
|
-
_headers=_headers,
|
84
|
-
_host_index=_host_index,
|
85
|
-
)
|
86
|
-
|
87
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
88
|
-
"200": "Dict[str, object]",
|
89
|
-
}
|
90
|
-
response_data = await self.api_client.call_api(
|
91
|
-
*_param, _request_timeout=_request_timeout
|
92
|
-
)
|
93
|
-
await response_data.read()
|
94
|
-
return self.api_client.response_deserialize(
|
95
|
-
response_data=response_data,
|
96
|
-
response_types_map=_response_types_map,
|
97
|
-
).data
|
98
|
-
|
99
|
-
@validate_call
|
100
|
-
async def get_config_with_http_info(
|
101
|
-
self,
|
102
|
-
_request_timeout: Union[
|
103
|
-
None,
|
104
|
-
Annotated[StrictFloat, Field(gt=0)],
|
105
|
-
Tuple[
|
106
|
-
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
107
|
-
],
|
108
|
-
] = None,
|
109
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
110
|
-
_content_type: Optional[StrictStr] = None,
|
111
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
112
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
113
|
-
) -> ApiResponse[Dict[str, object]]:
|
114
|
-
"""Config
|
115
|
-
|
116
|
-
Returns the version of the crypticorn library and the environment.
|
117
|
-
|
118
|
-
:param _request_timeout: timeout setting for this request. If one
|
119
|
-
number provided, it will be total request
|
120
|
-
timeout. It can also be a pair (tuple) of
|
121
|
-
(connection, read) timeouts.
|
122
|
-
:type _request_timeout: int, tuple(int, int), optional
|
123
|
-
:param _request_auth: set to override the auth_settings for an a single
|
124
|
-
request; this effectively ignores the
|
125
|
-
authentication in the spec for a single request.
|
126
|
-
:type _request_auth: dict, optional
|
127
|
-
:param _content_type: force content-type for the request.
|
128
|
-
:type _content_type: str, Optional
|
129
|
-
:param _headers: set to override the headers for a single
|
130
|
-
request; this effectively ignores the headers
|
131
|
-
in the spec for a single request.
|
132
|
-
:type _headers: dict, optional
|
133
|
-
:param _host_index: set to override the host_index for a single
|
134
|
-
request; this effectively ignores the host_index
|
135
|
-
in the spec for a single request.
|
136
|
-
:type _host_index: int, optional
|
137
|
-
:return: Returns the result object.
|
138
|
-
""" # noqa: E501
|
139
|
-
|
140
|
-
_param = self._get_config_serialize(
|
141
|
-
_request_auth=_request_auth,
|
142
|
-
_content_type=_content_type,
|
143
|
-
_headers=_headers,
|
144
|
-
_host_index=_host_index,
|
145
|
-
)
|
146
|
-
|
147
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
148
|
-
"200": "Dict[str, object]",
|
149
|
-
}
|
150
|
-
response_data = await self.api_client.call_api(
|
151
|
-
*_param, _request_timeout=_request_timeout
|
152
|
-
)
|
153
|
-
await response_data.read()
|
154
|
-
return self.api_client.response_deserialize(
|
155
|
-
response_data=response_data,
|
156
|
-
response_types_map=_response_types_map,
|
157
|
-
)
|
158
|
-
|
159
|
-
@validate_call
|
160
|
-
async def get_config_without_preload_content(
|
161
|
-
self,
|
162
|
-
_request_timeout: Union[
|
163
|
-
None,
|
164
|
-
Annotated[StrictFloat, Field(gt=0)],
|
165
|
-
Tuple[
|
166
|
-
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
167
|
-
],
|
168
|
-
] = None,
|
169
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
170
|
-
_content_type: Optional[StrictStr] = None,
|
171
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
172
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
173
|
-
) -> RESTResponseType:
|
174
|
-
"""Config
|
175
|
-
|
176
|
-
Returns the version of the crypticorn library and the environment.
|
177
|
-
|
178
|
-
:param _request_timeout: timeout setting for this request. If one
|
179
|
-
number provided, it will be total request
|
180
|
-
timeout. It can also be a pair (tuple) of
|
181
|
-
(connection, read) timeouts.
|
182
|
-
:type _request_timeout: int, tuple(int, int), optional
|
183
|
-
:param _request_auth: set to override the auth_settings for an a single
|
184
|
-
request; this effectively ignores the
|
185
|
-
authentication in the spec for a single request.
|
186
|
-
:type _request_auth: dict, optional
|
187
|
-
:param _content_type: force content-type for the request.
|
188
|
-
:type _content_type: str, Optional
|
189
|
-
:param _headers: set to override the headers for a single
|
190
|
-
request; this effectively ignores the headers
|
191
|
-
in the spec for a single request.
|
192
|
-
:type _headers: dict, optional
|
193
|
-
:param _host_index: set to override the host_index for a single
|
194
|
-
request; this effectively ignores the host_index
|
195
|
-
in the spec for a single request.
|
196
|
-
:type _host_index: int, optional
|
197
|
-
:return: Returns the result object.
|
198
|
-
""" # noqa: E501
|
199
|
-
|
200
|
-
_param = self._get_config_serialize(
|
201
|
-
_request_auth=_request_auth,
|
202
|
-
_content_type=_content_type,
|
203
|
-
_headers=_headers,
|
204
|
-
_host_index=_host_index,
|
205
|
-
)
|
206
|
-
|
207
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
208
|
-
"200": "Dict[str, object]",
|
209
|
-
}
|
210
|
-
response_data = await self.api_client.call_api(
|
211
|
-
*_param, _request_timeout=_request_timeout
|
212
|
-
)
|
213
|
-
return response_data.response
|
214
|
-
|
215
|
-
def _get_config_serialize(
|
216
|
-
self,
|
217
|
-
_request_auth,
|
218
|
-
_content_type,
|
219
|
-
_headers,
|
220
|
-
_host_index,
|
221
|
-
) -> RequestSerialized:
|
222
|
-
|
223
|
-
_host = None
|
224
|
-
|
225
|
-
_collection_formats: Dict[str, str] = {}
|
226
|
-
|
227
|
-
_path_params: Dict[str, str] = {}
|
228
|
-
_query_params: List[Tuple[str, str]] = []
|
229
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
230
|
-
_form_params: List[Tuple[str, str]] = []
|
231
|
-
_files: Dict[
|
232
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
233
|
-
] = {}
|
234
|
-
_body_params: Optional[bytes] = None
|
235
|
-
|
236
|
-
# process the path parameters
|
237
|
-
# process the query parameters
|
238
|
-
# process the header parameters
|
239
|
-
# process the form parameters
|
240
|
-
# process the body parameter
|
241
|
-
|
242
|
-
# set the HTTP header `Accept`
|
243
|
-
if "Accept" not in _header_params:
|
244
|
-
_header_params["Accept"] = self.api_client.select_header_accept(
|
245
|
-
["application/json"]
|
246
|
-
)
|
247
|
-
|
248
|
-
# authentication setting
|
249
|
-
_auth_settings: List[str] = []
|
250
|
-
|
251
|
-
return self.api_client.param_serialize(
|
252
|
-
method="GET",
|
253
|
-
resource_path="/config",
|
254
|
-
path_params=_path_params,
|
255
|
-
query_params=_query_params,
|
256
|
-
header_params=_header_params,
|
257
|
-
body=_body_params,
|
258
|
-
post_params=_form_params,
|
259
|
-
files=_files,
|
260
|
-
auth_settings=_auth_settings,
|
261
|
-
collection_formats=_collection_formats,
|
262
|
-
_host=_host,
|
263
|
-
_request_auth=_request_auth,
|
264
|
-
)
|
265
|
-
|
266
39
|
@validate_call
|
267
40
|
async def get_time(
|
268
41
|
self,
|
@@ -281,7 +54,7 @@ class StatusApi:
|
|
281
54
|
) -> str:
|
282
55
|
"""Time
|
283
56
|
|
284
|
-
Returns the current time in
|
57
|
+
Returns the current time in either ISO or Unix timestamp (seconds) format.
|
285
58
|
|
286
59
|
:param type:
|
287
60
|
:type type: str
|
@@ -345,7 +118,7 @@ class StatusApi:
|
|
345
118
|
) -> ApiResponse[str]:
|
346
119
|
"""Time
|
347
120
|
|
348
|
-
Returns the current time in
|
121
|
+
Returns the current time in either ISO or Unix timestamp (seconds) format.
|
349
122
|
|
350
123
|
:param type:
|
351
124
|
:type type: str
|
@@ -409,7 +182,7 @@ class StatusApi:
|
|
409
182
|
) -> RESTResponseType:
|
410
183
|
"""Time
|
411
184
|
|
412
|
-
Returns the current time in
|
185
|
+
Returns the current time in either ISO or Unix timestamp (seconds) format.
|
413
186
|
|
414
187
|
:param type:
|
415
188
|
:type type: str
|
@@ -15,6 +15,7 @@ Do not edit the class manually.
|
|
15
15
|
|
16
16
|
# import models into model package
|
17
17
|
from crypticorn.pay.client.models.exception_detail import ExceptionDetail
|
18
|
+
from crypticorn.pay.client.models.log_level import LogLevel
|
18
19
|
from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
|
19
20
|
from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
|
20
21
|
from crypticorn.pay.client.models.payment import Payment
|
@@ -24,4 +25,5 @@ from crypticorn.pay.client.models.product_read import ProductRead
|
|
24
25
|
from crypticorn.pay.client.models.product_sub_read import ProductSubRead
|
25
26
|
from crypticorn.pay.client.models.product_update import ProductUpdate
|
26
27
|
from crypticorn.pay.client.models.provider import Provider
|
28
|
+
from crypticorn.pay.client.models.response_getuptime import ResponseGetuptime
|
27
29
|
from crypticorn.pay.client.models.scope import Scope
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Payment API
|
5
|
+
|
6
|
+
API for accepting payments and storing subscriptions
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class LogLevel(str, Enum):
|
22
|
+
"""
|
23
|
+
LogLevel
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
DEBUG = "DEBUG"
|
30
|
+
INFO = "INFO"
|
31
|
+
WARNING = "WARNING"
|
32
|
+
ERROR = "ERROR"
|
33
|
+
CRITICAL = "CRITICAL"
|
34
|
+
|
35
|
+
@classmethod
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
37
|
+
"""Create an instance of LogLevel from a JSON string"""
|
38
|
+
return cls(json.loads(json_str))
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Payment API
|
5
5
|
|
6
|
-
API for
|
6
|
+
API for accepting payments and storing subscriptions
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -21,34 +21,33 @@ from pydantic import (
|
|
21
21
|
BaseModel,
|
22
22
|
ConfigDict,
|
23
23
|
Field,
|
24
|
+
StrictInt,
|
24
25
|
StrictStr,
|
25
26
|
ValidationError,
|
26
27
|
field_validator,
|
27
28
|
)
|
28
29
|
from typing import Optional
|
29
|
-
from crypticorn.hive.client.models.feature_size import FeatureSize
|
30
|
-
from crypticorn.hive.client.models.target import Target
|
31
30
|
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
32
31
|
from typing_extensions import Literal, Self
|
33
32
|
from pydantic import Field
|
34
33
|
|
35
|
-
|
34
|
+
RESPONSEGETUPTIME_ANY_OF_SCHEMAS = ["int", "str"]
|
36
35
|
|
37
36
|
|
38
|
-
class
|
37
|
+
class ResponseGetuptime(BaseModel):
|
39
38
|
"""
|
40
|
-
|
39
|
+
ResponseGetuptime
|
41
40
|
"""
|
42
41
|
|
43
|
-
# data type:
|
44
|
-
anyof_schema_1_validator: Optional[
|
45
|
-
# data type:
|
46
|
-
anyof_schema_2_validator: Optional[
|
42
|
+
# data type: int
|
43
|
+
anyof_schema_1_validator: Optional[StrictInt] = None
|
44
|
+
# data type: str
|
45
|
+
anyof_schema_2_validator: Optional[StrictStr] = None
|
47
46
|
if TYPE_CHECKING:
|
48
|
-
actual_instance: Optional[Union[
|
47
|
+
actual_instance: Optional[Union[int, str]] = None
|
49
48
|
else:
|
50
49
|
actual_instance: Any = None
|
51
|
-
any_of_schemas: Set[str] = {"
|
50
|
+
any_of_schemas: Set[str] = {"int", "str"}
|
52
51
|
|
53
52
|
model_config = {
|
54
53
|
"validate_assignment": True,
|
@@ -71,24 +70,24 @@ class DataValueValueValueInner(BaseModel):
|
|
71
70
|
|
72
71
|
@field_validator("actual_instance")
|
73
72
|
def actual_instance_must_validate_anyof(cls, v):
|
74
|
-
instance =
|
73
|
+
instance = ResponseGetuptime.model_construct()
|
75
74
|
error_messages = []
|
76
|
-
# validate data type:
|
77
|
-
|
78
|
-
|
79
|
-
else:
|
75
|
+
# validate data type: int
|
76
|
+
try:
|
77
|
+
instance.anyof_schema_1_validator = v
|
80
78
|
return v
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
except (ValidationError, ValueError) as e:
|
80
|
+
error_messages.append(str(e))
|
81
|
+
# validate data type: str
|
82
|
+
try:
|
83
|
+
instance.anyof_schema_2_validator = v
|
86
84
|
return v
|
87
|
-
|
85
|
+
except (ValidationError, ValueError) as e:
|
86
|
+
error_messages.append(str(e))
|
88
87
|
if error_messages:
|
89
88
|
# no match
|
90
89
|
raise ValueError(
|
91
|
-
"No match found when setting the actual_instance in
|
90
|
+
"No match found when setting the actual_instance in ResponseGetuptime with anyOf schemas: int, str. Details: "
|
92
91
|
+ ", ".join(error_messages)
|
93
92
|
)
|
94
93
|
else:
|
@@ -103,15 +102,21 @@ class DataValueValueValueInner(BaseModel):
|
|
103
102
|
"""Returns the object represented by the json string"""
|
104
103
|
instance = cls.model_construct()
|
105
104
|
error_messages = []
|
106
|
-
#
|
105
|
+
# deserialize data into int
|
107
106
|
try:
|
108
|
-
|
107
|
+
# validation
|
108
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
109
|
+
# assign value to actual_instance
|
110
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
109
111
|
return instance
|
110
112
|
except (ValidationError, ValueError) as e:
|
111
113
|
error_messages.append(str(e))
|
112
|
-
#
|
114
|
+
# deserialize data into str
|
113
115
|
try:
|
114
|
-
|
116
|
+
# validation
|
117
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
118
|
+
# assign value to actual_instance
|
119
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
115
120
|
return instance
|
116
121
|
except (ValidationError, ValueError) as e:
|
117
122
|
error_messages.append(str(e))
|
@@ -119,7 +124,7 @@ class DataValueValueValueInner(BaseModel):
|
|
119
124
|
if error_messages:
|
120
125
|
# no match
|
121
126
|
raise ValueError(
|
122
|
-
"No match found when deserializing the JSON string into
|
127
|
+
"No match found when deserializing the JSON string into ResponseGetuptime with anyOf schemas: int, str. Details: "
|
123
128
|
+ ", ".join(error_messages)
|
124
129
|
)
|
125
130
|
else:
|
@@ -137,7 +142,7 @@ class DataValueValueValueInner(BaseModel):
|
|
137
142
|
else:
|
138
143
|
return json.dumps(self.actual_instance)
|
139
144
|
|
140
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any],
|
145
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
|
141
146
|
"""Returns the dict representation of the actual instance"""
|
142
147
|
if self.actual_instance is None:
|
143
148
|
return None
|
@@ -26,6 +26,8 @@ class Scope(str, Enum):
|
|
26
26
|
"""
|
27
27
|
allowed enum values
|
28
28
|
"""
|
29
|
+
WRITE_COLON_ADMIN = "write:admin"
|
30
|
+
READ_COLON_ADMIN = "read:admin"
|
29
31
|
READ_COLON_PREDICTIONS = "read:predictions"
|
30
32
|
READ_COLON_HIVE_COLON_MODEL = "read:hive:model"
|
31
33
|
READ_COLON_HIVE_COLON_DATA = "read:hive:data"
|
crypticorn/pay/main.py
CHANGED
@@ -5,6 +5,7 @@ from crypticorn.pay import (
|
|
5
5
|
StatusApi,
|
6
6
|
PaymentsApi,
|
7
7
|
ProductsApi,
|
8
|
+
AdminApi,
|
8
9
|
)
|
9
10
|
|
10
11
|
|
@@ -25,3 +26,4 @@ class PayClient:
|
|
25
26
|
self.status = StatusApi(self.base_client)
|
26
27
|
self.payments = PaymentsApi(self.base_client)
|
27
28
|
self.products = ProductsApi(self.base_client)
|
29
|
+
self.admin = AdminApi(self.base_client)
|
@@ -1,21 +1,29 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: crypticorn
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.8.0
|
4
4
|
Summary: Maximise Your Crypto Trading Profits with Machine Learning
|
5
5
|
Author-email: Crypticorn <timon@crypticorn.com>
|
6
6
|
License: MIT
|
7
7
|
Project-URL: Homepage, https://crypticorn.com
|
8
|
+
Project-URL: Documentation, https://docs.crypticorn.com
|
9
|
+
Project-URL: Dashboard, https://app.crypticorn.com
|
8
10
|
Keywords: machine learning,data science,crypto,modelling
|
9
11
|
Classifier: Topic :: Scientific/Engineering
|
10
12
|
Classifier: Development Status :: 4 - Beta
|
11
|
-
Classifier: Intended Audience ::
|
13
|
+
Classifier: Intended Audience :: Developers
|
12
14
|
Classifier: Operating System :: OS Independent
|
13
|
-
Classifier:
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
14
20
|
Classifier: Typing :: Typed
|
15
21
|
Requires-Python: >=3.10
|
16
22
|
Description-Content-Type: text/markdown
|
17
23
|
Requires-Dist: fastapi<1.0.0,>=0.115.0
|
18
24
|
Requires-Dist: click<9.0.0,>=8.0.0
|
25
|
+
Requires-Dist: psutil<8.0.0,>=7.0.0
|
26
|
+
Requires-Dist: setuptools<81.0.0,>=80.0.0
|
19
27
|
Requires-Dist: urllib3<3.0.0,>=1.25.3
|
20
28
|
Requires-Dist: python_dateutil<3.0.0,>=2.8.2
|
21
29
|
Requires-Dist: aiohttp<4.0.0,>=3.8.4
|
@@ -34,6 +42,7 @@ Requires-Dist: ruff; extra == "dev"
|
|
34
42
|
Requires-Dist: isort; extra == "dev"
|
35
43
|
Requires-Dist: mypy; extra == "dev"
|
36
44
|
Requires-Dist: openapi-generator-cli<8.0.0,>=7.12.0; extra == "dev"
|
45
|
+
Requires-Dist: pdoc==15.0.3; extra == "dev"
|
37
46
|
Provides-Extra: test
|
38
47
|
Requires-Dist: pytest==8.3.5; extra == "test"
|
39
48
|
Requires-Dist: pytest-asyncio==0.26.0; extra == "test"
|
@@ -52,9 +61,9 @@ crypto market - and programmatically interact with the entire Crypticorn ecosyst
|
|
52
61
|
|
53
62
|
## Installation
|
54
63
|
|
55
|
-
|
64
|
+
You need Python 3.10+ installed to be able to use this library.
|
56
65
|
|
57
|
-
You can install the latest stable version from PyPi:
|
66
|
+
You can install the latest stable version from [PyPi](https://pypi.org/project/crypticorn/):
|
58
67
|
```bash
|
59
68
|
pip install crypticorn
|
60
69
|
```
|
@@ -64,7 +73,7 @@ If you want the latest version, which could be a pre release, run:
|
|
64
73
|
pip install --pre crypticorn
|
65
74
|
```
|
66
75
|
|
67
|
-
You can install extra dependencies grouped in the extras `extra
|
76
|
+
You can install extra dependencies grouped in the extras `extra`, `dev` (development) and `test` (testing). The `extra` dependencies include heavy libraries like `pandas`, which is only used in a few custom API operations (see [data processing](#data-preprocessing)), which preprocess the response data as a pandas Dataframe for convenience.
|
68
77
|
|
69
78
|
## Structure
|
70
79
|
|
@@ -72,11 +81,13 @@ Our API is available as an asynchronous Python SDK. The main entry point you nee
|
|
72
81
|
```python
|
73
82
|
from crypticorn import ApiClient
|
74
83
|
```
|
75
|
-
The ApiClient serves as the central interface for API operations. It instantiates multiple API wrappers corresponding to our micro services.
|
84
|
+
The ApiClient serves as the central interface for API operations. It instantiates multiple API wrappers corresponding to our micro services. These are structured the following:
|
76
85
|
|
77
|
-
|
86
|
+
<img src="../static/pip-structure.svg" alt="pip package structure" />
|
78
87
|
|
79
|
-
|
88
|
+
You can either explore each API by clicking through the library or checkout the [API Documentation](https://docs.crypticorn.com/api).
|
89
|
+
|
90
|
+
Request and response models for API operations should be accessed through the sub package you are using for an operation. All symbols are re-exported at the sub package level for convenience.
|
80
91
|
|
81
92
|
```python
|
82
93
|
from crypticorn.trade import BotStatus
|
@@ -93,25 +104,27 @@ To get started, [create an API key in your dashboard](https://app.crypticorn.com
|
|
93
104
|
|
94
105
|
## Basic Usage
|
95
106
|
|
96
|
-
|
107
|
+
You can use the client with the async context protocol...
|
97
108
|
```python
|
98
|
-
async with ApiClient(
|
109
|
+
async with ApiClient(api_key="your-api-key") as client:
|
99
110
|
await client.pay.products.get_products()
|
100
111
|
```
|
101
|
-
|
102
|
-
### Without Async Context Protocol
|
103
|
-
Without the context you need to close the session manually.
|
112
|
+
...or without it like this...
|
104
113
|
```python
|
105
|
-
client = ApiClient(
|
114
|
+
client = ApiClient(api_key="your-api-key")
|
106
115
|
asyncio.run(client.pay.models.get_products())
|
107
116
|
asyncio.run(client.close())
|
108
117
|
```
|
109
|
-
...or
|
118
|
+
...or this.
|
119
|
+
```python
|
120
|
+
client = ApiClient(api_key="your-api-key")
|
121
|
+
|
110
122
|
async def main():
|
111
123
|
await client.pay.products.get_products()
|
112
124
|
|
113
125
|
asyncio.run(main())
|
114
126
|
asyncio.run(client.close())
|
127
|
+
```
|
115
128
|
|
116
129
|
## Response Types
|
117
130
|
|
@@ -120,8 +133,8 @@ There are three different available output formats you can choose from:
|
|
120
133
|
### Serialized Response
|
121
134
|
You can get fully serialized responses as pydantic models. Using this, you get the full benefits of pydantic's type checking.
|
122
135
|
```python
|
123
|
-
|
124
|
-
print(
|
136
|
+
res = await client.pay.products.get_products()
|
137
|
+
print(res)
|
125
138
|
```
|
126
139
|
The output would look like this:
|
127
140
|
```python
|
@@ -130,7 +143,7 @@ The output would look like this:
|
|
130
143
|
|
131
144
|
### Serialized Response with HTTP Info
|
132
145
|
```python
|
133
|
-
await client.pay.products.get_products_with_http_info()
|
146
|
+
res = await client.pay.products.get_products_with_http_info()
|
134
147
|
print(res)
|
135
148
|
```
|
136
149
|
The output would look like this:
|
@@ -159,15 +172,27 @@ The output would look like this:
|
|
159
172
|
[{'id': '67e8146e7bae32f3838fe36a', 'name': 'Awesome Product', 'price': 5.0, 'duration': 30, 'description': 'You need to buy this', 'is_active': True}]
|
160
173
|
```
|
161
174
|
|
175
|
+
## Wrapper Utilities
|
176
|
+
|
177
|
+
Our SDK provides a collection of wrapper utilities designed to make interacting with the API more efficient and user-friendly.
|
178
|
+
|
179
|
+
### Data Preprocessing
|
180
|
+
Some API operations allow to get the returned data formatted as a pandas Dataframe. These operations are suffixed with `_fmt` and take the same inputs as the non-formatted function. They live alongside the other functions with the default [response types](#response-types). To use this functionality you have to install `pandas`, which is available in the [`extra` dependency group](#installation).
|
181
|
+
|
182
|
+
### Data Downloads
|
183
|
+
This utility allows direct data streaming to your local disk, instead of only returning download links. It is being used in the following functions:
|
184
|
+
- `client.hive.data.download_data()` (overrides the [default response](https://docs.crypticorn.com/api/?api=hive-ai-api#tag/data/GET/data))
|
185
|
+
|
162
186
|
## Advanced Usage
|
163
187
|
|
164
188
|
You can override some configuration for specific services. If you just want to use the API as is, you don't need to configure anything.
|
165
189
|
This might be of use if you are testing a specific API locally.
|
166
190
|
|
167
|
-
To override e.g. the host for the Hive client to connect to
|
191
|
+
To override e.g. the host for the Hive client to connect to localhost:8000 instead of the default proxy, you would do:
|
168
192
|
```python
|
169
193
|
from crypticorn.hive import Configuration as Hiveconfig
|
170
194
|
from crypticorn.common import Service
|
171
|
-
|
195
|
+
|
196
|
+
async with ApiClient() as client:
|
172
197
|
client.configure(config=HiveConfig(host="http://localhost:8000"), client=Service.HIVE)
|
173
198
|
```
|