crypticorn 2.5.0rc4__py3-none-any.whl → 2.5.1__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/auth/main.py +2 -0
- crypticorn/client.py +60 -69
- crypticorn/common/__init__.py +2 -1
- crypticorn/common/auth.py +38 -20
- crypticorn/common/enums.py +5 -34
- crypticorn/common/errors.py +33 -14
- crypticorn/common/exceptions.py +42 -25
- crypticorn/common/mixins.py +36 -0
- crypticorn/common/urls.py +2 -1
- crypticorn/common/utils.py +4 -2
- crypticorn/hive/main.py +2 -0
- crypticorn/klines/client/__init__.py +14 -42
- crypticorn/klines/client/api/__init__.py +1 -1
- crypticorn/klines/client/api/change_in_timeframe_api.py +8 -22
- crypticorn/klines/client/api/funding_rates_api.py +8 -22
- crypticorn/klines/client/api/ohlcv_data_api.py +13 -33
- crypticorn/klines/client/api/status_api.py +260 -0
- crypticorn/klines/client/api/symbols_api.py +14 -29
- crypticorn/klines/client/api/udf_api.py +48 -59
- crypticorn/klines/client/api_client.py +1 -1
- crypticorn/klines/client/configuration.py +1 -1
- crypticorn/klines/client/exceptions.py +1 -1
- crypticorn/klines/client/models/__init__.py +13 -41
- crypticorn/klines/client/models/api_error_identifier.py +108 -0
- crypticorn/klines/client/models/api_error_level.py +37 -0
- crypticorn/klines/client/models/api_error_type.py +37 -0
- crypticorn/klines/client/models/change_in_timeframe.py +86 -0
- crypticorn/klines/client/models/exception_detail.py +117 -0
- crypticorn/klines/client/models/funding_rate.py +92 -0
- crypticorn/klines/client/models/internal_exchange.py +39 -0
- crypticorn/klines/client/models/market_type.py +1 -1
- crypticorn/klines/client/models/ohlcv_history.py +105 -0
- crypticorn/klines/client/models/resolution.py +1 -1
- crypticorn/klines/client/models/search_symbol.py +94 -0
- crypticorn/klines/client/models/sort_direction.py +1 -1
- crypticorn/klines/client/models/symbol_group.py +83 -0
- crypticorn/klines/client/models/symbol_info.py +131 -0
- crypticorn/klines/client/models/symbol_type.py +1 -1
- crypticorn/klines/client/models/timeframe.py +1 -1
- crypticorn/klines/client/models/udf_config.py +149 -0
- crypticorn/klines/client/rest.py +1 -1
- crypticorn/klines/main.py +40 -23
- crypticorn/metrics/client/__init__.py +7 -21
- crypticorn/metrics/client/api/__init__.py +1 -1
- crypticorn/metrics/client/api/exchanges_api.py +36 -78
- crypticorn/metrics/client/api/indicators_api.py +12 -37
- crypticorn/metrics/client/api/logs_api.py +8 -23
- crypticorn/metrics/client/api/marketcap_api.py +22 -73
- crypticorn/metrics/client/api/markets_api.py +12 -40
- crypticorn/metrics/client/api/status_api.py +260 -0
- crypticorn/metrics/client/api/tokens_api.py +7 -21
- crypticorn/metrics/client/api_client.py +1 -1
- crypticorn/metrics/client/configuration.py +5 -3
- crypticorn/metrics/client/exceptions.py +1 -1
- crypticorn/metrics/client/models/__init__.py +6 -20
- crypticorn/{trade → metrics}/client/models/api_error_identifier.py +6 -2
- crypticorn/{trade → metrics}/client/models/api_error_level.py +2 -2
- crypticorn/{trade → metrics}/client/models/api_error_type.py +2 -2
- crypticorn/metrics/client/models/exception_detail.py +117 -0
- crypticorn/metrics/client/models/internal_exchange.py +39 -0
- crypticorn/metrics/client/models/market_type.py +1 -1
- crypticorn/metrics/client/models/severity.py +1 -1
- crypticorn/metrics/client/models/time_interval.py +1 -1
- crypticorn/metrics/client/models/trading_status.py +1 -1
- crypticorn/metrics/client/rest.py +1 -1
- crypticorn/metrics/main.py +51 -43
- crypticorn/pay/main.py +2 -0
- crypticorn/trade/client/__init__.py +0 -3
- crypticorn/trade/client/configuration.py +2 -2
- crypticorn/trade/client/models/__init__.py +0 -3
- crypticorn/trade/client/models/bot_model.py +3 -7
- crypticorn/trade/client/models/execution_ids.py +1 -1
- crypticorn/trade/client/models/notification_model.py +3 -12
- crypticorn/trade/client/models/order_model.py +3 -7
- crypticorn/trade/client/models/spot_trading_action.py +231 -0
- crypticorn/trade/main.py +2 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/METADATA +7 -5
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/RECORD +82 -65
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/WHEEL +1 -1
- crypticorn/common/sorter.py +0 -40
- /crypticorn/common/{pydantic.py → decorators.py} +0 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -17,10 +17,8 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
17
|
from typing_extensions import Annotated
|
18
18
|
|
19
19
|
from pydantic import Field, StrictStr, field_validator
|
20
|
+
from typing import Any, Dict, List
|
20
21
|
from typing_extensions import Annotated
|
21
|
-
from crypticorn.metrics.client.models.base_response_list_dict import (
|
22
|
-
BaseResponseListDict,
|
23
|
-
)
|
24
22
|
|
25
23
|
from crypticorn.metrics.client.api_client import ApiClient, RequestSerialized
|
26
24
|
from crypticorn.metrics.client.api_response import ApiResponse
|
@@ -56,7 +54,7 @@ class TokensApi:
|
|
56
54
|
_content_type: Optional[StrictStr] = None,
|
57
55
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
58
56
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
59
|
-
) ->
|
57
|
+
) -> List[Dict[str, object]]:
|
60
58
|
"""Get Stable Wrapped Tokens
|
61
59
|
|
62
60
|
Get list of stable or wrapped tokens.
|
@@ -94,11 +92,7 @@ class TokensApi:
|
|
94
92
|
)
|
95
93
|
|
96
94
|
_response_types_map: Dict[str, Optional[str]] = {
|
97
|
-
"200": "
|
98
|
-
"400": "ErrorResponse",
|
99
|
-
"404": "ErrorResponse",
|
100
|
-
"500": "ErrorResponse",
|
101
|
-
"422": "HTTPValidationError",
|
95
|
+
"200": "List[Dict[str, object]]",
|
102
96
|
}
|
103
97
|
response_data = await self.api_client.call_api(
|
104
98
|
*_param, _request_timeout=_request_timeout
|
@@ -126,7 +120,7 @@ class TokensApi:
|
|
126
120
|
_content_type: Optional[StrictStr] = None,
|
127
121
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
128
122
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
129
|
-
) -> ApiResponse[
|
123
|
+
) -> ApiResponse[List[Dict[str, object]]]:
|
130
124
|
"""Get Stable Wrapped Tokens
|
131
125
|
|
132
126
|
Get list of stable or wrapped tokens.
|
@@ -164,11 +158,7 @@ class TokensApi:
|
|
164
158
|
)
|
165
159
|
|
166
160
|
_response_types_map: Dict[str, Optional[str]] = {
|
167
|
-
"200": "
|
168
|
-
"400": "ErrorResponse",
|
169
|
-
"404": "ErrorResponse",
|
170
|
-
"500": "ErrorResponse",
|
171
|
-
"422": "HTTPValidationError",
|
161
|
+
"200": "List[Dict[str, object]]",
|
172
162
|
}
|
173
163
|
response_data = await self.api_client.call_api(
|
174
164
|
*_param, _request_timeout=_request_timeout
|
@@ -234,11 +224,7 @@ class TokensApi:
|
|
234
224
|
)
|
235
225
|
|
236
226
|
_response_types_map: Dict[str, Optional[str]] = {
|
237
|
-
"200": "
|
238
|
-
"400": "ErrorResponse",
|
239
|
-
"404": "ErrorResponse",
|
240
|
-
"500": "ErrorResponse",
|
241
|
-
"422": "HTTPValidationError",
|
227
|
+
"200": "List[Dict[str, object]]",
|
242
228
|
}
|
243
229
|
response_data = await self.api_client.call_api(
|
244
230
|
*_param, _request_timeout=_request_timeout
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -215,7 +215,9 @@ class Configuration:
|
|
215
215
|
debug: Optional[bool] = None,
|
216
216
|
) -> None:
|
217
217
|
"""Constructor"""
|
218
|
-
self._base_path =
|
218
|
+
self._base_path = (
|
219
|
+
"https://api.crypticorn.dev/v1/metrics" if host is None else host
|
220
|
+
)
|
219
221
|
"""Default Base url
|
220
222
|
"""
|
221
223
|
self.server_index = 0 if server_index is None and host is None else server_index
|
@@ -557,7 +559,7 @@ class Configuration:
|
|
557
559
|
"""
|
558
560
|
return [
|
559
561
|
{
|
560
|
-
"url": "
|
562
|
+
"url": "https://api.crypticorn.dev/v1/metrics",
|
561
563
|
"description": "No description provided",
|
562
564
|
}
|
563
565
|
]
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"""
|
5
5
|
Marketcap Service API
|
6
6
|
|
7
|
-
|
7
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
8
8
|
|
9
9
|
The version of the OpenAPI document: 1.0.0
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -14,26 +14,12 @@ Do not edit the class manually.
|
|
14
14
|
|
15
15
|
|
16
16
|
# import models into model package
|
17
|
-
from crypticorn.metrics.client.models.
|
18
|
-
from crypticorn.metrics.client.models.
|
19
|
-
|
20
|
-
|
21
|
-
from crypticorn.metrics.client.models.
|
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
|
17
|
+
from crypticorn.metrics.client.models.api_error_identifier import ApiErrorIdentifier
|
18
|
+
from crypticorn.metrics.client.models.api_error_level import ApiErrorLevel
|
19
|
+
from crypticorn.metrics.client.models.api_error_type import ApiErrorType
|
20
|
+
from crypticorn.metrics.client.models.exception_detail import ExceptionDetail
|
21
|
+
from crypticorn.metrics.client.models.internal_exchange import InternalExchange
|
32
22
|
from crypticorn.metrics.client.models.market_type import MarketType
|
33
23
|
from crypticorn.metrics.client.models.severity import Severity
|
34
24
|
from crypticorn.metrics.client.models.time_interval import TimeInterval
|
35
25
|
from crypticorn.metrics.client.models.trading_status import TradingStatus
|
36
|
-
from crypticorn.metrics.client.models.validation_error import ValidationError
|
37
|
-
from crypticorn.metrics.client.models.validation_error_loc_inner import (
|
38
|
-
ValidationErrorLocInner,
|
39
|
-
)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Marketcap Service API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
11
|
Do not edit the class manually.
|
@@ -28,6 +28,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
28
28
|
"""
|
29
29
|
ALLOCATION_BELOW_CURRENT_EXPOSURE = "allocation_below_current_exposure"
|
30
30
|
ALLOCATION_BELOW_MIN_AMOUNT = "allocation_below_min_amount"
|
31
|
+
ALPHANUMERIC_CHARACTERS_ONLY = "alphanumeric_characters_only"
|
31
32
|
BLACK_SWAN = "black_swan"
|
32
33
|
BOT_ALREADY_DELETED = "bot_already_deleted"
|
33
34
|
BOT_DISABLED = "bot_disabled"
|
@@ -52,6 +53,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
52
53
|
EXCHANGE_SYSTEM_CONFIGURATION_ERROR = "exchange_system_configuration_error"
|
53
54
|
EXCHANGE_INTERNAL_SYSTEM_ERROR = "exchange_internal_system_error"
|
54
55
|
EXCHANGE_USER_ACCOUNT_IS_FROZEN = "exchange_user_account_is_frozen"
|
56
|
+
FORBIDDEN = "forbidden"
|
55
57
|
HEDGE_MODE_NOT_ACTIVE = "hedge_mode_not_active"
|
56
58
|
HTTP_REQUEST_ERROR = "http_request_error"
|
57
59
|
INSUFFICIENT_BALANCE = "insufficient_balance"
|
@@ -59,6 +61,8 @@ class ApiErrorIdentifier(str, Enum):
|
|
59
61
|
INSUFFICIENT_SCOPES = "insufficient_scopes"
|
60
62
|
INVALID_API_KEY = "invalid_api_key"
|
61
63
|
INVALID_BEARER = "invalid_bearer"
|
64
|
+
INVALID_DATA = "invalid_data"
|
65
|
+
INVALID_DATA_RESPONSE = "invalid_data_response"
|
62
66
|
INVALID_EXCHANGE_KEY = "invalid_exchange_key"
|
63
67
|
INVALID_MARGIN_MODE = "invalid_margin_mode"
|
64
68
|
INVALID_PARAMETER_PROVIDED = "invalid_parameter_provided"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Marketcap Service API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
11
|
Do not edit the class manually.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Marketcap Service API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
11
|
Do not edit the class manually.
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
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 pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.metrics.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.metrics.client.models.api_error_level import ApiErrorLevel
|
24
|
+
from crypticorn.metrics.client.models.api_error_type import ApiErrorType
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
|
29
|
+
class ExceptionDetail(BaseModel):
|
30
|
+
"""
|
31
|
+
This is the detail of the exception. It is used to enrich the exception with additional information by unwrapping the ApiError into its components.
|
32
|
+
""" # noqa: E501
|
33
|
+
|
34
|
+
message: Optional[StrictStr] = None
|
35
|
+
code: ApiErrorIdentifier = Field(description="The unique error code")
|
36
|
+
type: ApiErrorType = Field(description="The type of error")
|
37
|
+
level: ApiErrorLevel = Field(description="The level of the error")
|
38
|
+
status_code: StrictInt = Field(description="The HTTP status code")
|
39
|
+
details: Optional[Any] = None
|
40
|
+
__properties: ClassVar[List[str]] = [
|
41
|
+
"message",
|
42
|
+
"code",
|
43
|
+
"type",
|
44
|
+
"level",
|
45
|
+
"status_code",
|
46
|
+
"details",
|
47
|
+
]
|
48
|
+
|
49
|
+
model_config = ConfigDict(
|
50
|
+
populate_by_name=True,
|
51
|
+
validate_assignment=True,
|
52
|
+
protected_namespaces=(),
|
53
|
+
)
|
54
|
+
|
55
|
+
def to_str(self) -> str:
|
56
|
+
"""Returns the string representation of the model using alias"""
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
58
|
+
|
59
|
+
def to_json(self) -> str:
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
62
|
+
return json.dumps(self.to_dict())
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of ExceptionDetail from a JSON string"""
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
68
|
+
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
"""
|
79
|
+
excluded_fields: Set[str] = set([])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# set to None if message (nullable) is None
|
87
|
+
# and model_fields_set contains the field
|
88
|
+
if self.message is None and "message" in self.model_fields_set:
|
89
|
+
_dict["message"] = None
|
90
|
+
|
91
|
+
# set to None if details (nullable) is None
|
92
|
+
# and model_fields_set contains the field
|
93
|
+
if self.details is None and "details" in self.model_fields_set:
|
94
|
+
_dict["details"] = None
|
95
|
+
|
96
|
+
return _dict
|
97
|
+
|
98
|
+
@classmethod
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
100
|
+
"""Create an instance of ExceptionDetail from a dict"""
|
101
|
+
if obj is None:
|
102
|
+
return None
|
103
|
+
|
104
|
+
if not isinstance(obj, dict):
|
105
|
+
return cls.model_validate(obj)
|
106
|
+
|
107
|
+
_obj = cls.model_validate(
|
108
|
+
{
|
109
|
+
"message": obj.get("message"),
|
110
|
+
"code": obj.get("code"),
|
111
|
+
"type": obj.get("type"),
|
112
|
+
"level": obj.get("level"),
|
113
|
+
"status_code": obj.get("status_code"),
|
114
|
+
"details": obj.get("details"),
|
115
|
+
}
|
116
|
+
)
|
117
|
+
return _obj
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Marketcap Service API
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
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 InternalExchange(str, Enum):
|
22
|
+
"""
|
23
|
+
All exchanges we are using, including public (Exchange)
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
KUCOIN = "kucoin"
|
30
|
+
BINGX = "bingx"
|
31
|
+
BINANCE = "binance"
|
32
|
+
BYBIT = "bybit"
|
33
|
+
HYPERLIQUID = "hyperliquid"
|
34
|
+
BITGET = "bitget"
|
35
|
+
|
36
|
+
@classmethod
|
37
|
+
def from_json(cls, json_str: str) -> Self:
|
38
|
+
"""Create an instance of InternalExchange from a JSON string"""
|
39
|
+
return cls(json.loads(json_str))
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Marketcap Service API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
crypticorn/metrics/main.py
CHANGED
@@ -3,18 +3,14 @@ from crypticorn.metrics import (
|
|
3
3
|
ApiClient,
|
4
4
|
Configuration,
|
5
5
|
ExchangesApi,
|
6
|
-
|
6
|
+
StatusApi,
|
7
7
|
IndicatorsApi,
|
8
8
|
LogsApi,
|
9
9
|
MarketcapApi,
|
10
10
|
MarketsApi,
|
11
11
|
TokensApi,
|
12
|
-
MarketType,
|
13
12
|
)
|
14
13
|
from crypticorn.common import optional_import
|
15
|
-
from pydantic import StrictStr, StrictInt, Field
|
16
|
-
from typing_extensions import Annotated
|
17
|
-
from typing import Optional
|
18
14
|
|
19
15
|
|
20
16
|
class MetricsClient:
|
@@ -22,6 +18,8 @@ class MetricsClient:
|
|
22
18
|
A client for interacting with the Crypticorn Metrics API.
|
23
19
|
"""
|
24
20
|
|
21
|
+
config_class = Configuration
|
22
|
+
|
25
23
|
def __init__(
|
26
24
|
self,
|
27
25
|
config: Configuration,
|
@@ -29,7 +27,7 @@ class MetricsClient:
|
|
29
27
|
self.config = config
|
30
28
|
self.base_client = ApiClient(configuration=self.config)
|
31
29
|
# Instantiate all the endpoint clients
|
32
|
-
self.status =
|
30
|
+
self.status = StatusApi(self.base_client)
|
33
31
|
self.indicators = IndicatorsApi(self.base_client)
|
34
32
|
self.logs = LogsApi(self.base_client)
|
35
33
|
self.marketcap = MarketcapApiWrapper(self.base_client)
|
@@ -43,42 +41,18 @@ class MarketcapApiWrapper(MarketcapApi):
|
|
43
41
|
A wrapper for the MarketcapApi class.
|
44
42
|
"""
|
45
43
|
|
46
|
-
async def get_marketcap_symbols_fmt(
|
47
|
-
self,
|
48
|
-
start_timestamp: Annotated[
|
49
|
-
Optional[StrictInt], Field(description="Start timestamp")
|
50
|
-
] = None,
|
51
|
-
end_timestamp: Annotated[
|
52
|
-
Optional[StrictInt], Field(description="End timestamp")
|
53
|
-
] = None,
|
54
|
-
interval: Annotated[
|
55
|
-
Optional[StrictStr],
|
56
|
-
Field(description="Interval for which to fetch symbols and marketcap data"),
|
57
|
-
] = None,
|
58
|
-
market: Annotated[
|
59
|
-
Optional[MarketType],
|
60
|
-
Field(description="Market for which to fetch symbols and marketcap data"),
|
61
|
-
] = None,
|
62
|
-
exchange: Annotated[
|
63
|
-
Optional[StrictStr],
|
64
|
-
Field(description="Exchange for which to fetch symbols and marketcap data"),
|
65
|
-
] = None,
|
66
|
-
) -> pd.DataFrame:
|
44
|
+
async def get_marketcap_symbols_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
|
67
45
|
"""
|
68
46
|
Get the marketcap symbols in a pandas dataframe
|
69
47
|
"""
|
70
48
|
pd = optional_import("pandas", "extra")
|
71
|
-
response = await self.
|
72
|
-
|
73
|
-
end_timestamp=end_timestamp,
|
74
|
-
interval=interval,
|
75
|
-
market=market,
|
76
|
-
exchange=exchange,
|
49
|
+
response = await self.get_marketcap_symbols_without_preload_content(
|
50
|
+
*args, **kwargs
|
77
51
|
)
|
52
|
+
response.raise_for_status()
|
78
53
|
json_response = await response.json()
|
79
54
|
df = pd.DataFrame(json_response["data"])
|
80
55
|
df.rename(columns={df.columns[0]: "timestamp"}, inplace=True)
|
81
|
-
df["timestamp"] = pd.to_datetime(df["timestamp"]).astype("int64") // 10**9
|
82
56
|
return df
|
83
57
|
|
84
58
|
|
@@ -87,19 +61,53 @@ class TokensApiWrapper(TokensApi):
|
|
87
61
|
A wrapper for the TokensApi class.
|
88
62
|
"""
|
89
63
|
|
90
|
-
async def
|
91
|
-
self,
|
92
|
-
token_type: Annotated[
|
93
|
-
StrictStr,
|
94
|
-
Field(description="Type of tokens to fetch"),
|
95
|
-
],
|
96
|
-
) -> pd.DataFrame:
|
64
|
+
async def get_stable_and_wrapped_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
|
97
65
|
"""
|
98
66
|
Get the tokens in a pandas dataframe
|
99
67
|
"""
|
100
68
|
pd = optional_import("pandas", "extra")
|
101
69
|
response = await self.get_stable_and_wrapped_tokens_without_preload_content(
|
102
|
-
|
70
|
+
*args, **kwargs
|
71
|
+
)
|
72
|
+
response.raise_for_status()
|
73
|
+
json_data = await response.json()
|
74
|
+
return pd.DataFrame(json_data)
|
75
|
+
|
76
|
+
|
77
|
+
class ExchangesApiWrapper(ExchangesApi):
|
78
|
+
"""
|
79
|
+
A wrapper for the ExchangesApi class.
|
80
|
+
"""
|
81
|
+
|
82
|
+
async def get_exchanges_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
|
83
|
+
"""
|
84
|
+
Get the exchanges in a pandas dataframe
|
85
|
+
"""
|
86
|
+
pd = optional_import("pandas", "extra")
|
87
|
+
response = await self.get_available_exchanges_without_preload_content(
|
88
|
+
*args, **kwargs
|
103
89
|
)
|
90
|
+
response.raise_for_status()
|
104
91
|
json_data = await response.json()
|
105
|
-
|
92
|
+
processed_results = []
|
93
|
+
for row in json_data:
|
94
|
+
data = {"timestamp": row["timestamp"]}
|
95
|
+
data.update(row["exchanges"])
|
96
|
+
processed_results.append(data)
|
97
|
+
|
98
|
+
# Create DataFrame and sort columns
|
99
|
+
df = pd.DataFrame(processed_results)
|
100
|
+
cols = ["timestamp"] + sorted([col for col in df.columns if col != "timestamp"])
|
101
|
+
df = df[cols]
|
102
|
+
|
103
|
+
# Convert timestamp to unix timestamp
|
104
|
+
df["timestamp"] = pd.to_datetime(df["timestamp"]).astype("int64") // 10**9
|
105
|
+
|
106
|
+
# Convert exchange availability to boolean integers (0/1)
|
107
|
+
df = df.astype(
|
108
|
+
{
|
109
|
+
"timestamp": "int64",
|
110
|
+
**{col: "int8" for col in df.columns if col != "timestamp"},
|
111
|
+
}
|
112
|
+
)
|
113
|
+
return df
|
crypticorn/pay/main.py
CHANGED
@@ -40,9 +40,6 @@ from crypticorn.trade.client.exceptions import ApiException
|
|
40
40
|
|
41
41
|
# import models into sdk package
|
42
42
|
from crypticorn.trade.client.models.action_model import ActionModel
|
43
|
-
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
44
|
-
from crypticorn.trade.client.models.api_error_level import ApiErrorLevel
|
45
|
-
from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
46
43
|
from crypticorn.trade.client.models.bot_model import BotModel
|
47
44
|
from crypticorn.trade.client.models.bot_status import BotStatus
|
48
45
|
from crypticorn.trade.client.models.exchange import Exchange
|
@@ -215,7 +215,7 @@ class Configuration:
|
|
215
215
|
debug: Optional[bool] = None,
|
216
216
|
) -> None:
|
217
217
|
"""Constructor"""
|
218
|
-
self._base_path = "http://
|
218
|
+
self._base_path = "http://127.0.0.1:3000/v1/trade" if host is None else host
|
219
219
|
"""Default Base url
|
220
220
|
"""
|
221
221
|
self.server_index = 0 if server_index is None and host is None else server_index
|
@@ -557,7 +557,7 @@ class Configuration:
|
|
557
557
|
"""
|
558
558
|
return [
|
559
559
|
{
|
560
|
-
"url": "http://
|
560
|
+
"url": "http://127.0.0.1:3000/v1/trade",
|
561
561
|
"description": "No description provided",
|
562
562
|
}
|
563
563
|
]
|
@@ -15,9 +15,6 @@ Do not edit the class manually.
|
|
15
15
|
|
16
16
|
# import models into model package
|
17
17
|
from crypticorn.trade.client.models.action_model import ActionModel
|
18
|
-
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
19
|
-
from crypticorn.trade.client.models.api_error_level import ApiErrorLevel
|
20
|
-
from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
21
18
|
from crypticorn.trade.client.models.bot_model import BotModel
|
22
19
|
from crypticorn.trade.client.models.bot_status import BotStatus
|
23
20
|
from crypticorn.trade.client.models.exchange import Exchange
|