crypticorn 2.5.2__py3-none-any.whl → 2.6.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 (102) hide show
  1. crypticorn/auth/client/__init__.py +9 -0
  2. crypticorn/auth/client/api/auth_api.py +8 -5
  3. crypticorn/auth/client/api/user_api.py +247 -0
  4. crypticorn/auth/client/models/__init__.py +9 -0
  5. crypticorn/auth/client/models/create_api_key_request.py +2 -1
  6. crypticorn/auth/client/models/get_api_keys200_response_inner.py +2 -1
  7. crypticorn/{hive/client/models/http_validation_error.py → auth/client/models/user_by_username200_response.py} +14 -22
  8. crypticorn/auth/client/models/verify200_response.py +14 -1
  9. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +14 -1
  10. crypticorn/auth/client/models/whoami200_response.py +6 -1
  11. crypticorn/cli/init.py +3 -0
  12. crypticorn/common/__init__.py +2 -1
  13. crypticorn/common/auth.py +13 -9
  14. crypticorn/common/errors.py +312 -105
  15. crypticorn/common/exceptions.py +38 -4
  16. crypticorn/common/mixins.py +19 -0
  17. crypticorn/common/pagination.py +49 -0
  18. crypticorn/common/scopes.py +27 -24
  19. crypticorn/common/status_router.py +9 -7
  20. crypticorn/common/utils.py +12 -6
  21. crypticorn/hive/client/__init__.py +3 -5
  22. crypticorn/hive/client/api/data_api.py +1 -33
  23. crypticorn/hive/client/api/models_api.py +351 -160
  24. crypticorn/hive/client/api/status_api.py +481 -9
  25. crypticorn/hive/client/configuration.py +12 -4
  26. crypticorn/hive/client/models/__init__.py +3 -5
  27. crypticorn/hive/client/models/coins.py +0 -1
  28. crypticorn/hive/client/models/data_info.py +44 -12
  29. crypticorn/hive/client/models/data_version.py +0 -1
  30. crypticorn/{pay/client/models/now_api_status_res.py → hive/client/models/data_version_info.py} +17 -11
  31. crypticorn/hive/client/models/exception_detail.py +114 -0
  32. crypticorn/hive/client/models/model.py +2 -3
  33. crypticorn/hive/client/models/{validation_error.py → target_info.py} +14 -25
  34. crypticorn/hive/client/rest.py +4 -1
  35. crypticorn/klines/client/api/status_api.py +481 -6
  36. crypticorn/klines/client/api/udf_api.py +0 -227
  37. crypticorn/metrics/client/api/status_api.py +476 -1
  38. crypticorn/pay/client/__init__.py +3 -8
  39. crypticorn/pay/client/api/now_payments_api.py +14 -17
  40. crypticorn/pay/client/api/payments_api.py +2 -11
  41. crypticorn/pay/client/api/products_api.py +2 -11
  42. crypticorn/pay/client/api/status_api.py +483 -8
  43. crypticorn/pay/client/api_client.py +2 -2
  44. crypticorn/pay/client/configuration.py +3 -3
  45. crypticorn/pay/client/exceptions.py +2 -2
  46. crypticorn/pay/client/models/__init__.py +3 -8
  47. crypticorn/pay/client/models/{validation_error.py → exception_detail.py} +37 -28
  48. crypticorn/pay/client/models/now_create_invoice_req.py +2 -2
  49. crypticorn/pay/client/models/now_create_invoice_res.py +2 -2
  50. crypticorn/pay/client/models/payment.py +2 -2
  51. crypticorn/pay/client/models/payment_status.py +2 -2
  52. crypticorn/pay/client/models/product_create.py +2 -2
  53. crypticorn/pay/client/models/product_read.py +2 -2
  54. crypticorn/pay/client/models/product_sub_read.py +2 -2
  55. crypticorn/pay/client/models/product_update.py +2 -2
  56. crypticorn/pay/client/models/scope.py +2 -2
  57. crypticorn/pay/client/models/services.py +2 -2
  58. crypticorn/pay/client/rest.py +2 -2
  59. crypticorn/trade/client/__init__.py +3 -7
  60. crypticorn/trade/client/api/api_keys_api.py +5 -20
  61. crypticorn/trade/client/api/bots_api.py +7 -19
  62. crypticorn/trade/client/api/exchanges_api.py +2 -2
  63. crypticorn/trade/client/api/futures_trading_panel_api.py +10 -22
  64. crypticorn/trade/client/api/notifications_api.py +10 -25
  65. crypticorn/trade/client/api/orders_api.py +2 -5
  66. crypticorn/trade/client/api/status_api.py +483 -8
  67. crypticorn/trade/client/api/strategies_api.py +5 -17
  68. crypticorn/trade/client/api/trading_actions_api.py +2 -11
  69. crypticorn/trade/client/api_client.py +2 -2
  70. crypticorn/trade/client/configuration.py +3 -3
  71. crypticorn/trade/client/exceptions.py +2 -2
  72. crypticorn/trade/client/models/__init__.py +3 -7
  73. crypticorn/trade/client/models/action_model.py +2 -2
  74. crypticorn/trade/client/models/bot_model.py +2 -2
  75. crypticorn/trade/client/models/bot_status.py +2 -2
  76. crypticorn/trade/client/models/{validation_error.py → exception_detail.py} +37 -28
  77. crypticorn/trade/client/models/exchange_key_model.py +2 -2
  78. crypticorn/trade/client/models/execution_ids.py +2 -2
  79. crypticorn/trade/client/models/futures_balance.py +2 -2
  80. crypticorn/trade/client/models/futures_trading_action.py +2 -2
  81. crypticorn/trade/client/models/margin_mode.py +2 -2
  82. crypticorn/trade/client/models/notification_model.py +2 -2
  83. crypticorn/trade/client/models/order_model.py +2 -2
  84. crypticorn/trade/client/models/order_status.py +2 -2
  85. crypticorn/trade/client/models/post_futures_action.py +2 -2
  86. crypticorn/trade/client/models/spot_trading_action.py +2 -2
  87. crypticorn/trade/client/models/strategy_exchange_info.py +2 -2
  88. crypticorn/trade/client/models/strategy_model_input.py +2 -2
  89. crypticorn/trade/client/models/strategy_model_output.py +2 -2
  90. crypticorn/trade/client/models/tpsl.py +2 -2
  91. crypticorn/trade/client/models/trading_action_type.py +2 -2
  92. crypticorn/trade/client/rest.py +2 -2
  93. {crypticorn-2.5.2.dist-info → crypticorn-2.6.0.dist-info}/METADATA +1 -1
  94. {crypticorn-2.5.2.dist-info → crypticorn-2.6.0.dist-info}/RECORD +97 -100
  95. {crypticorn-2.5.2.dist-info → crypticorn-2.6.0.dist-info}/WHEEL +1 -1
  96. crypticorn/hive/client/models/validation_error_loc_inner.py +0 -159
  97. crypticorn/pay/client/models/http_validation_error.py +0 -99
  98. crypticorn/pay/client/models/validation_error_loc_inner.py +0 -159
  99. crypticorn/trade/client/models/http_validation_error.py +0 -99
  100. crypticorn/trade/client/models/validation_error_loc_inner.py +0 -159
  101. {crypticorn-2.5.2.dist-info → crypticorn-2.6.0.dist-info}/entry_points.txt +0 -0
  102. {crypticorn-2.5.2.dist-info → crypticorn-2.6.0.dist-info}/top_level.txt +0 -0
@@ -17,15 +17,15 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
21
- from typing import Any, ClassVar, Dict, List, Union
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List
22
22
  from crypticorn.hive.client.models.coins import Coins
23
23
  from crypticorn.hive.client.models.data_value_value_value_inner import (
24
24
  DataValueValueValueInner,
25
25
  )
26
- from crypticorn.hive.client.models.data_version import DataVersion
26
+ from crypticorn.hive.client.models.data_version_info import DataVersionInfo
27
27
  from crypticorn.hive.client.models.feature_size import FeatureSize
28
- from crypticorn.hive.client.models.target_type import TargetType
28
+ from crypticorn.hive.client.models.target_info import TargetInfo
29
29
  from typing import Optional, Set
30
30
  from typing_extensions import Self
31
31
 
@@ -38,16 +38,16 @@ class DataInfo(BaseModel):
38
38
  data: Dict[str, Dict[str, Dict[str, List[DataValueValueValueInner]]]]
39
39
  coins: List[Coins]
40
40
  feature_sizes: List[FeatureSize]
41
- targets: Dict[str, TargetType]
42
- versions: Dict[str, Union[StrictFloat, StrictInt]]
43
- latest_version: DataVersion
41
+ targets: List[TargetInfo]
42
+ all_versions: List[DataVersionInfo]
43
+ available_versions: List[DataVersionInfo]
44
44
  __properties: ClassVar[List[str]] = [
45
45
  "data",
46
46
  "coins",
47
47
  "feature_sizes",
48
48
  "targets",
49
- "versions",
50
- "latest_version",
49
+ "all_versions",
50
+ "available_versions",
51
51
  ]
52
52
 
53
53
  model_config = ConfigDict(
@@ -87,6 +87,27 @@ class DataInfo(BaseModel):
87
87
  exclude=excluded_fields,
88
88
  exclude_none=True,
89
89
  )
90
+ # override the default output from pydantic by calling `to_dict()` of each item in targets (list)
91
+ _items = []
92
+ if self.targets:
93
+ for _item_targets in self.targets:
94
+ if _item_targets:
95
+ _items.append(_item_targets.to_dict())
96
+ _dict["targets"] = _items
97
+ # override the default output from pydantic by calling `to_dict()` of each item in all_versions (list)
98
+ _items = []
99
+ if self.all_versions:
100
+ for _item_all_versions in self.all_versions:
101
+ if _item_all_versions:
102
+ _items.append(_item_all_versions.to_dict())
103
+ _dict["all_versions"] = _items
104
+ # override the default output from pydantic by calling `to_dict()` of each item in available_versions (list)
105
+ _items = []
106
+ if self.available_versions:
107
+ for _item_available_versions in self.available_versions:
108
+ if _item_available_versions:
109
+ _items.append(_item_available_versions.to_dict())
110
+ _dict["available_versions"] = _items
90
111
  return _dict
91
112
 
92
113
  @classmethod
@@ -104,12 +125,23 @@ class DataInfo(BaseModel):
104
125
  "coins": obj.get("coins"),
105
126
  "feature_sizes": obj.get("feature_sizes"),
106
127
  "targets": (
107
- dict((_k, _v) for _k, _v in obj.get("targets").items())
128
+ [TargetInfo.from_dict(_item) for _item in obj["targets"]]
108
129
  if obj.get("targets") is not None
109
130
  else None
110
131
  ),
111
- "versions": obj.get("versions"),
112
- "latest_version": obj.get("latest_version"),
132
+ "all_versions": (
133
+ [DataVersionInfo.from_dict(_item) for _item in obj["all_versions"]]
134
+ if obj.get("all_versions") is not None
135
+ else None
136
+ ),
137
+ "available_versions": (
138
+ [
139
+ DataVersionInfo.from_dict(_item)
140
+ for _item in obj["available_versions"]
141
+ ]
142
+ if obj.get("available_versions") is not None
143
+ else None
144
+ ),
113
145
  }
114
146
  )
115
147
  return _obj
@@ -27,7 +27,6 @@ class DataVersion(str, Enum):
27
27
  allowed enum values
28
28
  """
29
29
  ENUM_1_DOT_0 = "1.0"
30
- ENUM_1_DOT_1 = "1.1"
31
30
 
32
31
  @classmethod
33
32
  def from_json(cls, json_str: str) -> Self:
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Payment API
4
+ Hive AI API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ API for Hive AI model training and evaluation
7
7
 
8
- The version of the OpenAPI document: 0.1.0
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.
@@ -17,19 +17,23 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
21
21
  from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.hive.client.models.data_version import DataVersion
22
23
  from typing import Optional, Set
23
24
  from typing_extensions import Self
24
25
 
25
26
 
26
- class NowAPIStatusRes(BaseModel):
27
+ class DataVersionInfo(BaseModel):
27
28
  """
28
- Response for the API status.
29
+ DataVersionInfo
29
30
  """ # noqa: E501
30
31
 
31
- message: StrictStr = Field(description="API status message")
32
- __properties: ClassVar[List[str]] = ["message"]
32
+ version: DataVersion = Field(description="Data version")
33
+ release_date: StrictInt = Field(
34
+ description="Release date of the data version in unix timestamp"
35
+ )
36
+ __properties: ClassVar[List[str]] = ["version", "release_date"]
33
37
 
34
38
  model_config = ConfigDict(
35
39
  populate_by_name=True,
@@ -48,7 +52,7 @@ class NowAPIStatusRes(BaseModel):
48
52
 
49
53
  @classmethod
50
54
  def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of NowAPIStatusRes from a JSON string"""
55
+ """Create an instance of DataVersionInfo from a JSON string"""
52
56
  return cls.from_dict(json.loads(json_str))
53
57
 
54
58
  def to_dict(self) -> Dict[str, Any]:
@@ -72,12 +76,14 @@ class NowAPIStatusRes(BaseModel):
72
76
 
73
77
  @classmethod
74
78
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
- """Create an instance of NowAPIStatusRes from a dict"""
79
+ """Create an instance of DataVersionInfo from a dict"""
76
80
  if obj is None:
77
81
  return None
78
82
 
79
83
  if not isinstance(obj, dict):
80
84
  return cls.model_validate(obj)
81
85
 
82
- _obj = cls.model_validate({"message": obj.get("message")})
86
+ _obj = cls.model_validate(
87
+ {"version": obj.get("version"), "release_date": obj.get("release_date")}
88
+ )
83
89
  return _obj
@@ -0,0 +1,114 @@
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, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class ExceptionDetail(BaseModel):
27
+ """
28
+ This is the detail of the exception. It is used to enrich the exception with additional information by unwrapping the ApiError into its components.
29
+ """ # noqa: E501
30
+
31
+ 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
+ status_code: StrictInt = Field(description="The HTTP status code")
36
+ details: Optional[Any] = None
37
+ __properties: ClassVar[List[str]] = [
38
+ "message",
39
+ "code",
40
+ "type",
41
+ "level",
42
+ "status_code",
43
+ "details",
44
+ ]
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of ExceptionDetail from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
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 details (nullable) is None
89
+ # and model_fields_set contains the field
90
+ if self.details is None and "details" in self.model_fields_set:
91
+ _dict["details"] = 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 ExceptionDetail 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
+ "message": obj.get("message"),
107
+ "code": obj.get("code"),
108
+ "type": obj.get("type"),
109
+ "level": obj.get("level"),
110
+ "status_code": obj.get("status_code"),
111
+ "details": obj.get("details"),
112
+ }
113
+ )
114
+ return _obj
@@ -17,7 +17,6 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from datetime import datetime
21
20
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
21
  from typing import Any, ClassVar, Dict, List
23
22
  from crypticorn.hive.client.models.coins import Coins
@@ -42,8 +41,8 @@ class Model(BaseModel):
42
41
  target_type: TargetType = Field(description="Target type")
43
42
  evaluations: List[Evaluation] = Field(description="Model evaluations")
44
43
  user_id: StrictStr = Field(description="Developer user ID")
45
- created_at: datetime = Field(description="Model creation timestamp")
46
- updated_at: datetime = Field(description="Model update timestamp")
44
+ created_at: StrictInt = Field(description="Model creation unix timestamp")
45
+ updated_at: StrictInt = Field(description="Model update unix timestamp")
47
46
  __properties: ClassVar[List[str]] = [
48
47
  "model_id",
49
48
  "name",
@@ -17,24 +17,24 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field
21
21
  from typing import Any, ClassVar, Dict, List
22
- from crypticorn.hive.client.models.validation_error_loc_inner import (
23
- ValidationErrorLocInner,
24
- )
22
+ from crypticorn.hive.client.models.data_version import DataVersion
23
+ from crypticorn.hive.client.models.target import Target
24
+ from crypticorn.hive.client.models.target_type import TargetType
25
25
  from typing import Optional, Set
26
26
  from typing_extensions import Self
27
27
 
28
28
 
29
- class ValidationError(BaseModel):
29
+ class TargetInfo(BaseModel):
30
30
  """
31
- ValidationError
31
+ TargetInfo
32
32
  """ # noqa: E501
33
33
 
34
- loc: List[ValidationErrorLocInner]
35
- msg: StrictStr
36
- type: StrictStr
37
- __properties: ClassVar[List[str]] = ["loc", "msg", "type"]
34
+ name: Target = Field(description="Target name")
35
+ type: TargetType = Field(description="Target type")
36
+ version: DataVersion = Field(description="Data version")
37
+ __properties: ClassVar[List[str]] = ["name", "type", "version"]
38
38
 
39
39
  model_config = ConfigDict(
40
40
  populate_by_name=True,
@@ -53,7 +53,7 @@ class ValidationError(BaseModel):
53
53
 
54
54
  @classmethod
55
55
  def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of ValidationError from a JSON string"""
56
+ """Create an instance of TargetInfo from a JSON string"""
57
57
  return cls.from_dict(json.loads(json_str))
58
58
 
59
59
  def to_dict(self) -> Dict[str, Any]:
@@ -73,18 +73,11 @@ class ValidationError(BaseModel):
73
73
  exclude=excluded_fields,
74
74
  exclude_none=True,
75
75
  )
76
- # override the default output from pydantic by calling `to_dict()` of each item in loc (list)
77
- _items = []
78
- if self.loc:
79
- for _item_loc in self.loc:
80
- if _item_loc:
81
- _items.append(_item_loc.to_dict())
82
- _dict["loc"] = _items
83
76
  return _dict
84
77
 
85
78
  @classmethod
86
79
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of ValidationError from a dict"""
80
+ """Create an instance of TargetInfo from a dict"""
88
81
  if obj is None:
89
82
  return None
90
83
 
@@ -93,13 +86,9 @@ class ValidationError(BaseModel):
93
86
 
94
87
  _obj = cls.model_validate(
95
88
  {
96
- "loc": (
97
- [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]]
98
- if obj.get("loc") is not None
99
- else None
100
- ),
101
- "msg": obj.get("msg"),
89
+ "name": obj.get("name"),
102
90
  "type": obj.get("type"),
91
+ "version": obj.get("version"),
103
92
  }
104
93
  )
105
94
  return _obj
@@ -57,7 +57,10 @@ class RESTClientObject:
57
57
  # maxsize is number of requests to host that are allowed in parallel
58
58
  self.maxsize = configuration.connection_pool_maxsize
59
59
 
60
- self.ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert)
60
+ self.ssl_context = ssl.create_default_context(
61
+ cafile=configuration.ssl_ca_cert,
62
+ cadata=configuration.ca_cert_data,
63
+ )
61
64
  if configuration.cert_file:
62
65
  self.ssl_context.load_cert_chain(
63
66
  configuration.cert_file, keyfile=configuration.key_file