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.
Files changed (68) hide show
  1. crypticorn/__init__.py +8 -1
  2. crypticorn/auth/client/models/create_api_key_request.py +3 -1
  3. crypticorn/auth/client/models/get_api_keys200_response_inner.py +3 -1
  4. crypticorn/client.py +34 -16
  5. crypticorn/common/__init__.py +5 -1
  6. crypticorn/common/ansi_colors.py +37 -0
  7. crypticorn/common/auth.py +3 -1
  8. crypticorn/common/exceptions.py +29 -11
  9. crypticorn/common/logging.py +126 -0
  10. crypticorn/common/middleware.py +27 -0
  11. crypticorn/common/mixins.py +2 -1
  12. crypticorn/common/router/admin_router.py +100 -0
  13. crypticorn/common/router/status_router.py +24 -0
  14. crypticorn/common/scopes.py +5 -0
  15. crypticorn/hive/client/__init__.py +6 -3
  16. crypticorn/hive/client/api/__init__.py +1 -0
  17. crypticorn/hive/client/api/admin_api.py +1452 -0
  18. crypticorn/hive/client/api/models_api.py +7 -7
  19. crypticorn/hive/client/api/status_api.py +4 -231
  20. crypticorn/hive/client/models/__init__.py +5 -3
  21. crypticorn/hive/client/models/api_error_identifier.py +115 -0
  22. crypticorn/hive/client/models/api_error_level.py +37 -0
  23. crypticorn/hive/client/models/api_error_type.py +37 -0
  24. crypticorn/hive/client/models/data_info.py +27 -5
  25. crypticorn/hive/client/models/data_options.py +92 -0
  26. crypticorn/hive/client/models/exception_detail.py +6 -3
  27. crypticorn/hive/client/models/log_level.py +38 -0
  28. crypticorn/hive/client/models/model.py +3 -3
  29. crypticorn/hive/main.py +22 -3
  30. crypticorn/hive/utils.py +1 -2
  31. crypticorn/metrics/client/__init__.py +11 -0
  32. crypticorn/metrics/client/api/__init__.py +2 -0
  33. crypticorn/metrics/client/api/admin_api.py +1452 -0
  34. crypticorn/metrics/client/api/exchanges_api.py +51 -40
  35. crypticorn/metrics/client/api/indicators_api.py +49 -32
  36. crypticorn/metrics/client/api/logs_api.py +7 -7
  37. crypticorn/metrics/client/api/marketcap_api.py +28 -25
  38. crypticorn/metrics/client/api/markets_api.py +50 -278
  39. crypticorn/metrics/client/api/quote_currencies_api.py +289 -0
  40. crypticorn/metrics/client/api/status_api.py +4 -231
  41. crypticorn/metrics/client/api/tokens_api.py +241 -37
  42. crypticorn/metrics/client/models/__init__.py +9 -0
  43. crypticorn/metrics/client/models/api_error_identifier.py +115 -0
  44. crypticorn/metrics/client/models/api_error_level.py +37 -0
  45. crypticorn/metrics/client/models/api_error_type.py +37 -0
  46. crypticorn/metrics/client/models/exception_detail.py +6 -3
  47. crypticorn/metrics/client/models/exchange_mapping.py +121 -0
  48. crypticorn/metrics/client/models/internal_exchange.py +39 -0
  49. crypticorn/metrics/client/models/log_level.py +38 -0
  50. crypticorn/metrics/client/models/market_type.py +35 -0
  51. crypticorn/metrics/client/models/marketcap_ranking.py +87 -0
  52. crypticorn/metrics/client/models/ohlcv.py +113 -0
  53. crypticorn/metrics/main.py +14 -2
  54. crypticorn/pay/client/__init__.py +3 -0
  55. crypticorn/pay/client/api/__init__.py +1 -0
  56. crypticorn/pay/client/api/admin_api.py +1453 -0
  57. crypticorn/pay/client/api/status_api.py +4 -231
  58. crypticorn/pay/client/models/__init__.py +2 -0
  59. crypticorn/pay/client/models/log_level.py +38 -0
  60. crypticorn/{hive/client/models/data_value_value_value_inner.py → pay/client/models/response_getuptime.py} +36 -31
  61. crypticorn/pay/client/models/scope.py +2 -0
  62. crypticorn/pay/main.py +2 -0
  63. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/METADATA +46 -21
  64. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/RECORD +67 -44
  65. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/WHEEL +1 -1
  66. crypticorn/common/status_router.py +0 -44
  67. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/entry_points.txt +0 -0
  68. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hive AI API
5
+
6
+ API for Hive AI model training and evaluation
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.hive.client.models.feature_size import FeatureSize
23
+ from crypticorn.hive.client.models.target import Target
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class DataOptions(BaseModel):
29
+ """
30
+ DataOptions
31
+ """ # noqa: E501
32
+
33
+ targets: List[Target] = Field(
34
+ description="The targets available on the latest data version."
35
+ )
36
+ feature_sizes: List[FeatureSize] = Field(
37
+ description="The feature sizes available on the latest data version."
38
+ )
39
+ __properties: ClassVar[List[str]] = ["targets", "feature_sizes"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of DataOptions from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of DataOptions from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate(
90
+ {"targets": obj.get("targets"), "feature_sizes": obj.get("feature_sizes")}
91
+ )
92
+ return _obj
@@ -19,6 +19,9 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
+ from crypticorn.hive.client.models.api_error_identifier import ApiErrorIdentifier
23
+ from crypticorn.hive.client.models.api_error_level import ApiErrorLevel
24
+ from crypticorn.hive.client.models.api_error_type import ApiErrorType
22
25
  from typing import Optional, Set
23
26
  from typing_extensions import Self
24
27
 
@@ -29,9 +32,9 @@ class ExceptionDetail(BaseModel):
29
32
  """ # noqa: E501
30
33
 
31
34
  message: Optional[StrictStr] = None
32
- code: StrictStr = Field(description="API error identifiers")
33
- type: StrictStr = Field(description="Type of API error")
34
- level: StrictStr = Field(description="API error levels")
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")
35
38
  status_code: StrictInt = Field(description="The HTTP status code")
36
39
  details: Optional[Any] = None
37
40
  __properties: ClassVar[List[str]] = [
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hive AI API
5
+
6
+ API for Hive AI model training and evaluation
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))
@@ -33,7 +33,7 @@ class Model(BaseModel):
33
33
  Pydantic model for model response
34
34
  """ # noqa: E501
35
35
 
36
- model_id: StrictInt = Field(description="Unique model identifier")
36
+ id: StrictInt = Field(description="Unique model identifier")
37
37
  name: StrictStr = Field(description="Model name")
38
38
  coin_id: Coins = Field(description="Coin ID")
39
39
  target: Target = Field(description="Target variable")
@@ -44,7 +44,7 @@ class Model(BaseModel):
44
44
  created_at: StrictInt = Field(description="Model creation unix timestamp")
45
45
  updated_at: StrictInt = Field(description="Model update unix timestamp")
46
46
  __properties: ClassVar[List[str]] = [
47
- "model_id",
47
+ "id",
48
48
  "name",
49
49
  "coin_id",
50
50
  "target",
@@ -113,7 +113,7 @@ class Model(BaseModel):
113
113
 
114
114
  _obj = cls.model_validate(
115
115
  {
116
- "model_id": obj.get("model_id"),
116
+ "id": obj.get("id"),
117
117
  "name": obj.get("name"),
118
118
  "coin_id": obj.get("coin_id"),
119
119
  "target": obj.get("target"),
crypticorn/hive/main.py CHANGED
@@ -8,9 +8,13 @@ from crypticorn.hive import (
8
8
  DataApi,
9
9
  StatusApi,
10
10
  Configuration,
11
+ AdminApi,
12
+ DataVersion,
13
+ FeatureSize,
11
14
  )
12
15
  from crypticorn.hive.utils import download_file
13
- import logging
16
+ from typing import Optional
17
+ from pydantic import StrictInt
14
18
 
15
19
 
16
20
  class DataApiWrapper(DataApi):
@@ -18,7 +22,15 @@ class DataApiWrapper(DataApi):
18
22
  A wrapper for the DataApi class.
19
23
  """
20
24
 
21
- async def download_data(self, folder: Path = "data", *args, **kwargs) -> list[Path]:
25
+ async def download_data(
26
+ self,
27
+ model_id: StrictInt,
28
+ folder: Path = Path("data"),
29
+ version: Optional[DataVersion] = None,
30
+ feature_size: Optional[FeatureSize] = None,
31
+ *args,
32
+ **kwargs,
33
+ ) -> list[Path]:
22
34
  """
23
35
  Download data for model training. All three files (y_train, x_test, x_train) are downloaded and saved under e.g. FOLDER/v1/coin_1/*.feather.
24
36
  The folder will be created if it doesn't exist.
@@ -28,7 +40,13 @@ class DataApiWrapper(DataApi):
28
40
  :param feature_size: The number of features in the data. Default is LARGE. (optional) (type: FeatureSize)
29
41
  :return: A list of paths to the downloaded files.
30
42
  """
31
- response = await super().download_data(*args, **kwargs)
43
+ response = await super().download_data(
44
+ model_id=model_id,
45
+ version=version,
46
+ feature_size=feature_size,
47
+ *args,
48
+ **kwargs,
49
+ )
32
50
  base_path = f"{folder}/v{response.version.value}/coin_{response.coin.value}/"
33
51
  os.makedirs(base_path, exist_ok=True)
34
52
 
@@ -73,3 +91,4 @@ class HiveClient:
73
91
  self.models = ModelsApi(self.base_client)
74
92
  self.data = DataApiWrapper(self.base_client)
75
93
  self.status = StatusApi(self.base_client)
94
+ self.admin = AdminApi(self.base_client)
crypticorn/hive/utils.py CHANGED
@@ -3,8 +3,7 @@ import os
3
3
  import tqdm
4
4
  import logging
5
5
 
6
- logger = logging.getLogger(__name__)
7
- logger.setLevel(logging.INFO)
6
+ logger = logging.getLogger("crypticorn")
8
7
 
9
8
 
10
9
  async def download_file(
@@ -17,11 +17,13 @@ Do not edit the class manually.
17
17
  __version__ = "1.0.0"
18
18
 
19
19
  # import apis into sdk package
20
+ from crypticorn.metrics.client.api.admin_api import AdminApi
20
21
  from crypticorn.metrics.client.api.exchanges_api import ExchangesApi
21
22
  from crypticorn.metrics.client.api.indicators_api import IndicatorsApi
22
23
  from crypticorn.metrics.client.api.logs_api import LogsApi
23
24
  from crypticorn.metrics.client.api.marketcap_api import MarketcapApi
24
25
  from crypticorn.metrics.client.api.markets_api import MarketsApi
26
+ from crypticorn.metrics.client.api.quote_currencies_api import QuoteCurrenciesApi
25
27
  from crypticorn.metrics.client.api.status_api import StatusApi
26
28
  from crypticorn.metrics.client.api.tokens_api import TokensApi
27
29
 
@@ -37,7 +39,16 @@ from crypticorn.metrics.client.exceptions import ApiAttributeError
37
39
  from crypticorn.metrics.client.exceptions import ApiException
38
40
 
39
41
  # import models into sdk package
42
+ from crypticorn.metrics.client.models.api_error_identifier import ApiErrorIdentifier
43
+ from crypticorn.metrics.client.models.api_error_level import ApiErrorLevel
44
+ from crypticorn.metrics.client.models.api_error_type import ApiErrorType
40
45
  from crypticorn.metrics.client.models.exception_detail import ExceptionDetail
46
+ from crypticorn.metrics.client.models.exchange_mapping import ExchangeMapping
47
+ from crypticorn.metrics.client.models.internal_exchange import InternalExchange
48
+ from crypticorn.metrics.client.models.log_level import LogLevel
49
+ from crypticorn.metrics.client.models.market_type import MarketType
50
+ from crypticorn.metrics.client.models.marketcap_ranking import MarketcapRanking
51
+ from crypticorn.metrics.client.models.ohlcv import OHLCV
41
52
  from crypticorn.metrics.client.models.severity import Severity
42
53
  from crypticorn.metrics.client.models.time_interval import TimeInterval
43
54
  from crypticorn.metrics.client.models.trading_status import TradingStatus
@@ -1,10 +1,12 @@
1
1
  # flake8: noqa
2
2
 
3
3
  # import apis into api package
4
+ from crypticorn.metrics.client.api.admin_api import AdminApi
4
5
  from crypticorn.metrics.client.api.exchanges_api import ExchangesApi
5
6
  from crypticorn.metrics.client.api.indicators_api import IndicatorsApi
6
7
  from crypticorn.metrics.client.api.logs_api import LogsApi
7
8
  from crypticorn.metrics.client.api.marketcap_api import MarketcapApi
8
9
  from crypticorn.metrics.client.api.markets_api import MarketsApi
10
+ from crypticorn.metrics.client.api.quote_currencies_api import QuoteCurrenciesApi
9
11
  from crypticorn.metrics.client.api.status_api import StatusApi
10
12
  from crypticorn.metrics.client.api.tokens_api import TokensApi