crypticorn 2.1.4__py3-none-any.whl → 2.1.6__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/client.py +4 -0
- crypticorn/common/errors.py +1 -1
- crypticorn/common/sorter.py +9 -7
- crypticorn/common/urls.py +1 -0
- crypticorn/klines/client/configuration.py +2 -2
- crypticorn/metrics/__init__.py +4 -0
- crypticorn/metrics/client/__init__.py +60 -0
- crypticorn/metrics/client/api/__init__.py +10 -0
- crypticorn/metrics/client/api/exchanges_api.py +1003 -0
- crypticorn/metrics/client/api/health_check_api.py +265 -0
- crypticorn/metrics/client/api/indicators_api.py +680 -0
- crypticorn/metrics/client/api/logs_api.py +356 -0
- crypticorn/metrics/client/api/marketcap_api.py +1315 -0
- crypticorn/metrics/client/api/markets_api.py +618 -0
- crypticorn/metrics/client/api/tokens_api.py +300 -0
- crypticorn/metrics/client/api_client.py +758 -0
- crypticorn/metrics/client/api_response.py +20 -0
- crypticorn/metrics/client/configuration.py +575 -0
- crypticorn/metrics/client/exceptions.py +220 -0
- crypticorn/metrics/client/models/__init__.py +37 -0
- crypticorn/metrics/client/models/base_response_dict.py +106 -0
- crypticorn/metrics/client/models/base_response_health_check_response.py +114 -0
- crypticorn/metrics/client/models/base_response_list_dict.py +106 -0
- crypticorn/metrics/client/models/base_response_list_exchange_mapping.py +118 -0
- crypticorn/metrics/client/models/base_response_list_str.py +106 -0
- crypticorn/metrics/client/models/error_response.py +109 -0
- crypticorn/metrics/client/models/exchange_mapping.py +132 -0
- crypticorn/{trade/client/models/update_notification.py → metrics/client/models/health_check_response.py} +15 -19
- crypticorn/metrics/client/models/http_validation_error.py +99 -0
- crypticorn/metrics/client/models/market.py +35 -0
- crypticorn/metrics/client/models/severity.py +36 -0
- crypticorn/metrics/client/models/validation_error.py +105 -0
- crypticorn/metrics/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/metrics/client/py.typed +0 -0
- crypticorn/metrics/client/rest.py +195 -0
- crypticorn/metrics/main.py +112 -0
- crypticorn/pay/client/api/products_api.py +15 -15
- crypticorn/pay/client/models/now_webhook_payload.py +1 -1
- crypticorn/trade/client/api/futures_trading_panel_api.py +15 -15
- crypticorn/trade/client/models/api_error_identifier.py +49 -47
- crypticorn/trade/client/models/api_error_level.py +2 -2
- {crypticorn-2.1.4.dist-info → crypticorn-2.1.6.dist-info}/METADATA +3 -3
- {crypticorn-2.1.4.dist-info → crypticorn-2.1.6.dist-info}/RECORD +45 -17
- crypticorn/trade/client/models/notification_type.py +0 -37
- crypticorn/trade/client/models/strategy_model.py +0 -158
- {crypticorn-2.1.4.dist-info → crypticorn-2.1.6.dist-info}/WHEEL +0 -0
- {crypticorn-2.1.4.dist-info → crypticorn-2.1.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
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
|
+
from typing import Any, Optional
|
15
|
+
from typing_extensions import Self
|
16
|
+
|
17
|
+
|
18
|
+
class OpenApiException(Exception):
|
19
|
+
"""The base exception class for all OpenAPIExceptions"""
|
20
|
+
|
21
|
+
|
22
|
+
class ApiTypeError(OpenApiException, TypeError):
|
23
|
+
def __init__(
|
24
|
+
self, msg, path_to_item=None, valid_classes=None, key_type=None
|
25
|
+
) -> None:
|
26
|
+
"""Raises an exception for TypeErrors
|
27
|
+
|
28
|
+
Args:
|
29
|
+
msg (str): the exception message
|
30
|
+
|
31
|
+
Keyword Args:
|
32
|
+
path_to_item (list): a list of keys an indices to get to the
|
33
|
+
current_item
|
34
|
+
None if unset
|
35
|
+
valid_classes (tuple): the primitive classes that current item
|
36
|
+
should be an instance of
|
37
|
+
None if unset
|
38
|
+
key_type (bool): False if our value is a value in a dict
|
39
|
+
True if it is a key in a dict
|
40
|
+
False if our item is an item in a list
|
41
|
+
None if unset
|
42
|
+
"""
|
43
|
+
self.path_to_item = path_to_item
|
44
|
+
self.valid_classes = valid_classes
|
45
|
+
self.key_type = key_type
|
46
|
+
full_msg = msg
|
47
|
+
if path_to_item:
|
48
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
49
|
+
super(ApiTypeError, self).__init__(full_msg)
|
50
|
+
|
51
|
+
|
52
|
+
class ApiValueError(OpenApiException, ValueError):
|
53
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
54
|
+
"""
|
55
|
+
Args:
|
56
|
+
msg (str): the exception message
|
57
|
+
|
58
|
+
Keyword Args:
|
59
|
+
path_to_item (list) the path to the exception in the
|
60
|
+
received_data dict. None if unset
|
61
|
+
"""
|
62
|
+
|
63
|
+
self.path_to_item = path_to_item
|
64
|
+
full_msg = msg
|
65
|
+
if path_to_item:
|
66
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
67
|
+
super(ApiValueError, self).__init__(full_msg)
|
68
|
+
|
69
|
+
|
70
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
71
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
72
|
+
"""
|
73
|
+
Raised when an attribute reference or assignment fails.
|
74
|
+
|
75
|
+
Args:
|
76
|
+
msg (str): the exception message
|
77
|
+
|
78
|
+
Keyword Args:
|
79
|
+
path_to_item (None/list) the path to the exception in the
|
80
|
+
received_data dict
|
81
|
+
"""
|
82
|
+
self.path_to_item = path_to_item
|
83
|
+
full_msg = msg
|
84
|
+
if path_to_item:
|
85
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
86
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
87
|
+
|
88
|
+
|
89
|
+
class ApiKeyError(OpenApiException, KeyError):
|
90
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
91
|
+
"""
|
92
|
+
Args:
|
93
|
+
msg (str): the exception message
|
94
|
+
|
95
|
+
Keyword Args:
|
96
|
+
path_to_item (None/list) the path to the exception in the
|
97
|
+
received_data dict
|
98
|
+
"""
|
99
|
+
self.path_to_item = path_to_item
|
100
|
+
full_msg = msg
|
101
|
+
if path_to_item:
|
102
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
103
|
+
super(ApiKeyError, self).__init__(full_msg)
|
104
|
+
|
105
|
+
|
106
|
+
class ApiException(OpenApiException):
|
107
|
+
|
108
|
+
def __init__(
|
109
|
+
self,
|
110
|
+
status=None,
|
111
|
+
reason=None,
|
112
|
+
http_resp=None,
|
113
|
+
*,
|
114
|
+
body: Optional[str] = None,
|
115
|
+
data: Optional[Any] = None,
|
116
|
+
) -> None:
|
117
|
+
self.status = status
|
118
|
+
self.reason = reason
|
119
|
+
self.body = body
|
120
|
+
self.data = data
|
121
|
+
self.headers = None
|
122
|
+
|
123
|
+
if http_resp:
|
124
|
+
if self.status is None:
|
125
|
+
self.status = http_resp.status
|
126
|
+
if self.reason is None:
|
127
|
+
self.reason = http_resp.reason
|
128
|
+
if self.body is None:
|
129
|
+
try:
|
130
|
+
self.body = http_resp.data.decode("utf-8")
|
131
|
+
except Exception:
|
132
|
+
pass
|
133
|
+
self.headers = http_resp.getheaders()
|
134
|
+
|
135
|
+
@classmethod
|
136
|
+
def from_response(
|
137
|
+
cls,
|
138
|
+
*,
|
139
|
+
http_resp,
|
140
|
+
body: Optional[str],
|
141
|
+
data: Optional[Any],
|
142
|
+
) -> Self:
|
143
|
+
if http_resp.status == 400:
|
144
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
145
|
+
|
146
|
+
if http_resp.status == 401:
|
147
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
148
|
+
|
149
|
+
if http_resp.status == 403:
|
150
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
151
|
+
|
152
|
+
if http_resp.status == 404:
|
153
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
154
|
+
|
155
|
+
# Added new conditions for 409 and 422
|
156
|
+
if http_resp.status == 409:
|
157
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
158
|
+
|
159
|
+
if http_resp.status == 422:
|
160
|
+
raise UnprocessableEntityException(
|
161
|
+
http_resp=http_resp, body=body, data=data
|
162
|
+
)
|
163
|
+
|
164
|
+
if 500 <= http_resp.status <= 599:
|
165
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
166
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
167
|
+
|
168
|
+
def __str__(self):
|
169
|
+
"""Custom error messages for exception"""
|
170
|
+
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
|
171
|
+
if self.headers:
|
172
|
+
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
173
|
+
|
174
|
+
if self.data or self.body:
|
175
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
176
|
+
|
177
|
+
return error_message
|
178
|
+
|
179
|
+
|
180
|
+
class BadRequestException(ApiException):
|
181
|
+
pass
|
182
|
+
|
183
|
+
|
184
|
+
class NotFoundException(ApiException):
|
185
|
+
pass
|
186
|
+
|
187
|
+
|
188
|
+
class UnauthorizedException(ApiException):
|
189
|
+
pass
|
190
|
+
|
191
|
+
|
192
|
+
class ForbiddenException(ApiException):
|
193
|
+
pass
|
194
|
+
|
195
|
+
|
196
|
+
class ServiceException(ApiException):
|
197
|
+
pass
|
198
|
+
|
199
|
+
|
200
|
+
class ConflictException(ApiException):
|
201
|
+
"""Exception for HTTP 409 Conflict."""
|
202
|
+
|
203
|
+
pass
|
204
|
+
|
205
|
+
|
206
|
+
class UnprocessableEntityException(ApiException):
|
207
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
208
|
+
|
209
|
+
pass
|
210
|
+
|
211
|
+
|
212
|
+
def render_path(path_to_item):
|
213
|
+
"""Returns a string representation of a path"""
|
214
|
+
result = ""
|
215
|
+
for pth in path_to_item:
|
216
|
+
if isinstance(pth, int):
|
217
|
+
result += "[{0}]".format(pth)
|
218
|
+
else:
|
219
|
+
result += "['{0}']".format(pth)
|
220
|
+
return result
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# flake8: noqa
|
4
|
+
"""
|
5
|
+
Marketcap Service API
|
6
|
+
|
7
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
8
|
+
|
9
|
+
The version of the OpenAPI document: 1.0.0
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
|
+
|
12
|
+
Do not edit the class manually.
|
13
|
+
""" # noqa: E501
|
14
|
+
|
15
|
+
|
16
|
+
# import models into model package
|
17
|
+
from crypticorn.metrics.client.models.base_response_dict import BaseResponseDict
|
18
|
+
from crypticorn.metrics.client.models.base_response_health_check_response import (
|
19
|
+
BaseResponseHealthCheckResponse,
|
20
|
+
)
|
21
|
+
from crypticorn.metrics.client.models.base_response_list_dict import (
|
22
|
+
BaseResponseListDict,
|
23
|
+
)
|
24
|
+
from crypticorn.metrics.client.models.base_response_list_exchange_mapping import (
|
25
|
+
BaseResponseListExchangeMapping,
|
26
|
+
)
|
27
|
+
from crypticorn.metrics.client.models.base_response_list_str import BaseResponseListStr
|
28
|
+
from crypticorn.metrics.client.models.error_response import ErrorResponse
|
29
|
+
from crypticorn.metrics.client.models.exchange_mapping import ExchangeMapping
|
30
|
+
from crypticorn.metrics.client.models.http_validation_error import HTTPValidationError
|
31
|
+
from crypticorn.metrics.client.models.health_check_response import HealthCheckResponse
|
32
|
+
from crypticorn.metrics.client.models.market import Market
|
33
|
+
from crypticorn.metrics.client.models.severity import Severity
|
34
|
+
from crypticorn.metrics.client.models.validation_error import ValidationError
|
35
|
+
from crypticorn.metrics.client.models.validation_error_loc_inner import (
|
36
|
+
ValidationErrorLocInner,
|
37
|
+
)
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class BaseResponseDict(BaseModel):
|
28
|
+
"""
|
29
|
+
BaseResponseDict
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
success: Optional[StrictBool] = True
|
33
|
+
message: Optional[StrictStr] = None
|
34
|
+
data: Optional[Dict[str, Any]] = None
|
35
|
+
timestamp: Optional[datetime] = None
|
36
|
+
__properties: ClassVar[List[str]] = ["success", "message", "data", "timestamp"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
43
|
+
|
44
|
+
def to_str(self) -> str:
|
45
|
+
"""Returns the string representation of the model using alias"""
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
47
|
+
|
48
|
+
def to_json(self) -> str:
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
51
|
+
return json.dumps(self.to_dict())
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
55
|
+
"""Create an instance of BaseResponseDict from a JSON string"""
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
57
|
+
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
60
|
+
|
61
|
+
This has the following differences from calling pydantic's
|
62
|
+
`self.model_dump(by_alias=True)`:
|
63
|
+
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
65
|
+
were set at model initialization. Other fields with value `None`
|
66
|
+
are ignored.
|
67
|
+
"""
|
68
|
+
excluded_fields: Set[str] = set([])
|
69
|
+
|
70
|
+
_dict = self.model_dump(
|
71
|
+
by_alias=True,
|
72
|
+
exclude=excluded_fields,
|
73
|
+
exclude_none=True,
|
74
|
+
)
|
75
|
+
# set to None if message (nullable) is None
|
76
|
+
# and model_fields_set contains the field
|
77
|
+
if self.message is None and "message" in self.model_fields_set:
|
78
|
+
_dict["message"] = None
|
79
|
+
|
80
|
+
# set to None if data (nullable) is None
|
81
|
+
# and model_fields_set contains the field
|
82
|
+
if self.data is None and "data" in self.model_fields_set:
|
83
|
+
_dict["data"] = None
|
84
|
+
|
85
|
+
return _dict
|
86
|
+
|
87
|
+
@classmethod
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
89
|
+
"""Create an instance of BaseResponseDict from a dict"""
|
90
|
+
if obj is None:
|
91
|
+
return None
|
92
|
+
|
93
|
+
if not isinstance(obj, dict):
|
94
|
+
return cls.model_validate(obj)
|
95
|
+
|
96
|
+
_obj = cls.model_validate(
|
97
|
+
{
|
98
|
+
"success": (
|
99
|
+
obj.get("success") if obj.get("success") is not None else True
|
100
|
+
),
|
101
|
+
"message": obj.get("message"),
|
102
|
+
"data": obj.get("data"),
|
103
|
+
"timestamp": obj.get("timestamp"),
|
104
|
+
}
|
105
|
+
)
|
106
|
+
return _obj
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from crypticorn.metrics.client.models.health_check_response import HealthCheckResponse
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
|
28
|
+
class BaseResponseHealthCheckResponse(BaseModel):
|
29
|
+
"""
|
30
|
+
BaseResponseHealthCheckResponse
|
31
|
+
""" # noqa: E501
|
32
|
+
|
33
|
+
success: Optional[StrictBool] = True
|
34
|
+
message: Optional[StrictStr] = None
|
35
|
+
data: Optional[HealthCheckResponse] = None
|
36
|
+
timestamp: Optional[datetime] = None
|
37
|
+
__properties: ClassVar[List[str]] = ["success", "message", "data", "timestamp"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
44
|
+
|
45
|
+
def to_str(self) -> str:
|
46
|
+
"""Returns the string representation of the model using alias"""
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
48
|
+
|
49
|
+
def to_json(self) -> str:
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
52
|
+
return json.dumps(self.to_dict())
|
53
|
+
|
54
|
+
@classmethod
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
56
|
+
"""Create an instance of BaseResponseHealthCheckResponse from a JSON string"""
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
58
|
+
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
"""
|
69
|
+
excluded_fields: Set[str] = set([])
|
70
|
+
|
71
|
+
_dict = self.model_dump(
|
72
|
+
by_alias=True,
|
73
|
+
exclude=excluded_fields,
|
74
|
+
exclude_none=True,
|
75
|
+
)
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of data
|
77
|
+
if self.data:
|
78
|
+
_dict["data"] = self.data.to_dict()
|
79
|
+
# set to None if message (nullable) is None
|
80
|
+
# and model_fields_set contains the field
|
81
|
+
if self.message is None and "message" in self.model_fields_set:
|
82
|
+
_dict["message"] = None
|
83
|
+
|
84
|
+
# set to None if data (nullable) is None
|
85
|
+
# and model_fields_set contains the field
|
86
|
+
if self.data is None and "data" in self.model_fields_set:
|
87
|
+
_dict["data"] = None
|
88
|
+
|
89
|
+
return _dict
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
93
|
+
"""Create an instance of BaseResponseHealthCheckResponse from a dict"""
|
94
|
+
if obj is None:
|
95
|
+
return None
|
96
|
+
|
97
|
+
if not isinstance(obj, dict):
|
98
|
+
return cls.model_validate(obj)
|
99
|
+
|
100
|
+
_obj = cls.model_validate(
|
101
|
+
{
|
102
|
+
"success": (
|
103
|
+
obj.get("success") if obj.get("success") is not None else True
|
104
|
+
),
|
105
|
+
"message": obj.get("message"),
|
106
|
+
"data": (
|
107
|
+
HealthCheckResponse.from_dict(obj["data"])
|
108
|
+
if obj.get("data") is not None
|
109
|
+
else None
|
110
|
+
),
|
111
|
+
"timestamp": obj.get("timestamp"),
|
112
|
+
}
|
113
|
+
)
|
114
|
+
return _obj
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class BaseResponseListDict(BaseModel):
|
28
|
+
"""
|
29
|
+
BaseResponseListDict
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
success: Optional[StrictBool] = True
|
33
|
+
message: Optional[StrictStr] = None
|
34
|
+
data: Optional[List[Dict[str, Any]]] = None
|
35
|
+
timestamp: Optional[datetime] = None
|
36
|
+
__properties: ClassVar[List[str]] = ["success", "message", "data", "timestamp"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
43
|
+
|
44
|
+
def to_str(self) -> str:
|
45
|
+
"""Returns the string representation of the model using alias"""
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
47
|
+
|
48
|
+
def to_json(self) -> str:
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
51
|
+
return json.dumps(self.to_dict())
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
55
|
+
"""Create an instance of BaseResponseListDict from a JSON string"""
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
57
|
+
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
60
|
+
|
61
|
+
This has the following differences from calling pydantic's
|
62
|
+
`self.model_dump(by_alias=True)`:
|
63
|
+
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
65
|
+
were set at model initialization. Other fields with value `None`
|
66
|
+
are ignored.
|
67
|
+
"""
|
68
|
+
excluded_fields: Set[str] = set([])
|
69
|
+
|
70
|
+
_dict = self.model_dump(
|
71
|
+
by_alias=True,
|
72
|
+
exclude=excluded_fields,
|
73
|
+
exclude_none=True,
|
74
|
+
)
|
75
|
+
# set to None if message (nullable) is None
|
76
|
+
# and model_fields_set contains the field
|
77
|
+
if self.message is None and "message" in self.model_fields_set:
|
78
|
+
_dict["message"] = None
|
79
|
+
|
80
|
+
# set to None if data (nullable) is None
|
81
|
+
# and model_fields_set contains the field
|
82
|
+
if self.data is None and "data" in self.model_fields_set:
|
83
|
+
_dict["data"] = None
|
84
|
+
|
85
|
+
return _dict
|
86
|
+
|
87
|
+
@classmethod
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
89
|
+
"""Create an instance of BaseResponseListDict from a dict"""
|
90
|
+
if obj is None:
|
91
|
+
return None
|
92
|
+
|
93
|
+
if not isinstance(obj, dict):
|
94
|
+
return cls.model_validate(obj)
|
95
|
+
|
96
|
+
_obj = cls.model_validate(
|
97
|
+
{
|
98
|
+
"success": (
|
99
|
+
obj.get("success") if obj.get("success") is not None else True
|
100
|
+
),
|
101
|
+
"message": obj.get("message"),
|
102
|
+
"data": obj.get("data"),
|
103
|
+
"timestamp": obj.get("timestamp"),
|
104
|
+
}
|
105
|
+
)
|
106
|
+
return _obj
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
API for retrieving historical marketcap data, available exchanges, and indicators. ## Features - Historical marketcap data - OHLCV data with marketcap - Technical indicators (KER, SMA) - Exchange and symbol mappings - Error logs
|
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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from crypticorn.metrics.client.models.exchange_mapping import ExchangeMapping
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
|
28
|
+
class BaseResponseListExchangeMapping(BaseModel):
|
29
|
+
"""
|
30
|
+
BaseResponseListExchangeMapping
|
31
|
+
""" # noqa: E501
|
32
|
+
|
33
|
+
success: Optional[StrictBool] = True
|
34
|
+
message: Optional[StrictStr] = None
|
35
|
+
data: Optional[List[ExchangeMapping]] = None
|
36
|
+
timestamp: Optional[datetime] = None
|
37
|
+
__properties: ClassVar[List[str]] = ["success", "message", "data", "timestamp"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
44
|
+
|
45
|
+
def to_str(self) -> str:
|
46
|
+
"""Returns the string representation of the model using alias"""
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
48
|
+
|
49
|
+
def to_json(self) -> str:
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
52
|
+
return json.dumps(self.to_dict())
|
53
|
+
|
54
|
+
@classmethod
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
56
|
+
"""Create an instance of BaseResponseListExchangeMapping from a JSON string"""
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
58
|
+
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
"""
|
69
|
+
excluded_fields: Set[str] = set([])
|
70
|
+
|
71
|
+
_dict = self.model_dump(
|
72
|
+
by_alias=True,
|
73
|
+
exclude=excluded_fields,
|
74
|
+
exclude_none=True,
|
75
|
+
)
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
|
77
|
+
_items = []
|
78
|
+
if self.data:
|
79
|
+
for _item_data in self.data:
|
80
|
+
if _item_data:
|
81
|
+
_items.append(_item_data.to_dict())
|
82
|
+
_dict["data"] = _items
|
83
|
+
# set to None if message (nullable) is None
|
84
|
+
# and model_fields_set contains the field
|
85
|
+
if self.message is None and "message" in self.model_fields_set:
|
86
|
+
_dict["message"] = None
|
87
|
+
|
88
|
+
# set to None if data (nullable) is None
|
89
|
+
# and model_fields_set contains the field
|
90
|
+
if self.data is None and "data" in self.model_fields_set:
|
91
|
+
_dict["data"] = None
|
92
|
+
|
93
|
+
return _dict
|
94
|
+
|
95
|
+
@classmethod
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
97
|
+
"""Create an instance of BaseResponseListExchangeMapping from a dict"""
|
98
|
+
if obj is None:
|
99
|
+
return None
|
100
|
+
|
101
|
+
if not isinstance(obj, dict):
|
102
|
+
return cls.model_validate(obj)
|
103
|
+
|
104
|
+
_obj = cls.model_validate(
|
105
|
+
{
|
106
|
+
"success": (
|
107
|
+
obj.get("success") if obj.get("success") is not None else True
|
108
|
+
),
|
109
|
+
"message": obj.get("message"),
|
110
|
+
"data": (
|
111
|
+
[ExchangeMapping.from_dict(_item) for _item in obj["data"]]
|
112
|
+
if obj.get("data") is not None
|
113
|
+
else None
|
114
|
+
),
|
115
|
+
"timestamp": obj.get("timestamp"),
|
116
|
+
}
|
117
|
+
)
|
118
|
+
return _obj
|