crypticorn 2.4.5__py3-none-any.whl → 2.4.7__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 (65) hide show
  1. crypticorn/client.py +1 -1
  2. crypticorn/common/auth.py +7 -9
  3. crypticorn/common/errors.py +6 -1
  4. crypticorn/common/scopes.py +2 -1
  5. crypticorn/common/utils.py +15 -5
  6. crypticorn/klines/main.py +10 -5
  7. crypticorn/metrics/client/models/exchange_mapping.py +4 -2
  8. crypticorn/metrics/client/models/trading_status.py +1 -0
  9. crypticorn/metrics/main.py +5 -4
  10. crypticorn/pay/client/__init__.py +5 -4
  11. crypticorn/pay/client/api/payments_api.py +17 -17
  12. crypticorn/pay/client/api/products_api.py +49 -48
  13. crypticorn/pay/client/models/__init__.py +5 -4
  14. crypticorn/pay/client/models/payment.py +28 -147
  15. crypticorn/pay/client/models/product_create.py +120 -0
  16. crypticorn/pay/client/models/product_read.py +123 -0
  17. crypticorn/pay/client/models/product_sub_read.py +103 -0
  18. crypticorn/pay/client/models/product_update.py +142 -0
  19. crypticorn/trade/client/__init__.py +6 -8
  20. crypticorn/trade/client/api/__init__.py +1 -0
  21. crypticorn/trade/client/api/api_keys_api.py +273 -167
  22. crypticorn/trade/client/api/bots_api.py +226 -140
  23. crypticorn/trade/client/api/exchanges_api.py +51 -31
  24. crypticorn/trade/client/api/futures_trading_panel_api.py +272 -169
  25. crypticorn/trade/client/api/notifications_api.py +323 -200
  26. crypticorn/trade/client/api/orders_api.py +60 -40
  27. crypticorn/trade/client/api/status_api.py +49 -31
  28. crypticorn/trade/client/api/strategies_api.py +223 -137
  29. crypticorn/trade/client/api/trading_actions_api.py +170 -106
  30. crypticorn/trade/client/api_client.py +153 -111
  31. crypticorn/trade/client/api_response.py +3 -2
  32. crypticorn/trade/client/configuration.py +115 -128
  33. crypticorn/trade/client/exceptions.py +21 -25
  34. crypticorn/trade/client/models/__init__.py +6 -8
  35. crypticorn/trade/client/models/action_model.py +54 -108
  36. crypticorn/trade/client/models/api_error_identifier.py +72 -76
  37. crypticorn/trade/client/models/api_error_level.py +11 -9
  38. crypticorn/trade/client/models/api_error_type.py +11 -9
  39. crypticorn/trade/client/models/bot_model.py +36 -57
  40. crypticorn/trade/client/models/bot_status.py +11 -9
  41. crypticorn/trade/client/models/exchange.py +9 -7
  42. crypticorn/trade/client/models/exchange_key_model.py +34 -44
  43. crypticorn/trade/client/models/execution_ids.py +18 -18
  44. crypticorn/trade/client/models/futures_balance.py +27 -43
  45. crypticorn/trade/client/models/futures_trading_action.py +50 -102
  46. crypticorn/trade/client/models/http_validation_error.py +15 -19
  47. crypticorn/trade/client/models/margin_mode.py +9 -7
  48. crypticorn/trade/client/models/market_type.py +9 -7
  49. crypticorn/trade/client/models/notification_model.py +32 -52
  50. crypticorn/trade/client/models/order_model.py +72 -112
  51. crypticorn/trade/client/models/order_status.py +12 -10
  52. crypticorn/trade/client/models/post_futures_action.py +16 -20
  53. crypticorn/trade/client/models/strategy_exchange_info.py +16 -15
  54. crypticorn/trade/client/models/strategy_model_input.py +33 -61
  55. crypticorn/trade/client/models/strategy_model_output.py +33 -61
  56. crypticorn/trade/client/models/tpsl.py +25 -39
  57. crypticorn/trade/client/models/trading_action_type.py +11 -9
  58. crypticorn/trade/client/models/validation_error.py +18 -24
  59. crypticorn/trade/client/models/validation_error_loc_inner.py +16 -37
  60. crypticorn/trade/client/rest.py +38 -23
  61. {crypticorn-2.4.5.dist-info → crypticorn-2.4.7.dist-info}/METADATA +13 -2
  62. {crypticorn-2.4.5.dist-info → crypticorn-2.4.7.dist-info}/RECORD +65 -61
  63. {crypticorn-2.4.5.dist-info → crypticorn-2.4.7.dist-info}/WHEEL +0 -0
  64. {crypticorn-2.4.5.dist-info → crypticorn-2.4.7.dist-info}/entry_points.txt +0 -0
  65. {crypticorn-2.4.5.dist-info → crypticorn-2.4.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,120 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Payment API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.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 (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictBool,
25
+ StrictFloat,
26
+ StrictInt,
27
+ StrictStr,
28
+ )
29
+ from typing import Any, ClassVar, Dict, List, Optional, Union
30
+ from crypticorn.pay.client.models.scope import Scope
31
+ from typing import Optional, Set
32
+ from typing_extensions import Self
33
+
34
+
35
+ class ProductCreate(BaseModel):
36
+ """
37
+ Model for creating a product
38
+ """ # noqa: E501
39
+
40
+ name: StrictStr = Field(description="Product name")
41
+ price: Union[StrictFloat, StrictInt] = Field(description="Product price")
42
+ scopes: Optional[List[Scope]] = None
43
+ duration: StrictInt = Field(
44
+ description="Product duration in days. 0 means unlimited."
45
+ )
46
+ description: StrictStr = Field(description="Product description")
47
+ is_active: StrictBool = Field(description="Product is active")
48
+ __properties: ClassVar[List[str]] = [
49
+ "name",
50
+ "price",
51
+ "scopes",
52
+ "duration",
53
+ "description",
54
+ "is_active",
55
+ ]
56
+
57
+ model_config = ConfigDict(
58
+ populate_by_name=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of ProductCreate from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ # set to None if scopes (nullable) is None
95
+ # and model_fields_set contains the field
96
+ if self.scopes is None and "scopes" in self.model_fields_set:
97
+ _dict["scopes"] = None
98
+
99
+ return _dict
100
+
101
+ @classmethod
102
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
103
+ """Create an instance of ProductCreate from a dict"""
104
+ if obj is None:
105
+ return None
106
+
107
+ if not isinstance(obj, dict):
108
+ return cls.model_validate(obj)
109
+
110
+ _obj = cls.model_validate(
111
+ {
112
+ "name": obj.get("name"),
113
+ "price": obj.get("price"),
114
+ "scopes": obj.get("scopes"),
115
+ "duration": obj.get("duration"),
116
+ "description": obj.get("description"),
117
+ "is_active": obj.get("is_active"),
118
+ }
119
+ )
120
+ return _obj
@@ -0,0 +1,123 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Payment API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.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 (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictBool,
25
+ StrictFloat,
26
+ StrictInt,
27
+ StrictStr,
28
+ )
29
+ from typing import Any, ClassVar, Dict, List, Optional, Union
30
+ from crypticorn.pay.client.models.scope import Scope
31
+ from typing import Optional, Set
32
+ from typing_extensions import Self
33
+
34
+
35
+ class ProductRead(BaseModel):
36
+ """
37
+ Model for reading a product
38
+ """ # noqa: E501
39
+
40
+ name: StrictStr = Field(description="Product name")
41
+ price: Union[StrictFloat, StrictInt] = Field(description="Product price")
42
+ scopes: Optional[List[Scope]] = None
43
+ duration: StrictInt = Field(
44
+ description="Product duration in days. 0 means unlimited."
45
+ )
46
+ description: StrictStr = Field(description="Product description")
47
+ is_active: StrictBool = Field(description="Product is active")
48
+ id: StrictStr = Field(description="UID of the product")
49
+ __properties: ClassVar[List[str]] = [
50
+ "name",
51
+ "price",
52
+ "scopes",
53
+ "duration",
54
+ "description",
55
+ "is_active",
56
+ "id",
57
+ ]
58
+
59
+ model_config = ConfigDict(
60
+ populate_by_name=True,
61
+ validate_assignment=True,
62
+ protected_namespaces=(),
63
+ )
64
+
65
+ def to_str(self) -> str:
66
+ """Returns the string representation of the model using alias"""
67
+ return pprint.pformat(self.model_dump(by_alias=True))
68
+
69
+ def to_json(self) -> str:
70
+ """Returns the JSON representation of the model using alias"""
71
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
72
+ return json.dumps(self.to_dict())
73
+
74
+ @classmethod
75
+ def from_json(cls, json_str: str) -> Optional[Self]:
76
+ """Create an instance of ProductRead from a JSON string"""
77
+ return cls.from_dict(json.loads(json_str))
78
+
79
+ def to_dict(self) -> Dict[str, Any]:
80
+ """Return the dictionary representation of the model using alias.
81
+
82
+ This has the following differences from calling pydantic's
83
+ `self.model_dump(by_alias=True)`:
84
+
85
+ * `None` is only added to the output dict for nullable fields that
86
+ were set at model initialization. Other fields with value `None`
87
+ are ignored.
88
+ """
89
+ excluded_fields: Set[str] = set([])
90
+
91
+ _dict = self.model_dump(
92
+ by_alias=True,
93
+ exclude=excluded_fields,
94
+ exclude_none=True,
95
+ )
96
+ # set to None if scopes (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.scopes is None and "scopes" in self.model_fields_set:
99
+ _dict["scopes"] = None
100
+
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of ProductRead from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate(
113
+ {
114
+ "name": obj.get("name"),
115
+ "price": obj.get("price"),
116
+ "scopes": obj.get("scopes"),
117
+ "duration": obj.get("duration"),
118
+ "description": obj.get("description"),
119
+ "is_active": obj.get("is_active"),
120
+ "id": obj.get("id"),
121
+ }
122
+ )
123
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Payment API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.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
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class ProductSubRead(BaseModel):
27
+ """
28
+ Model for reading a product subscription
29
+ """ # noqa: E501
30
+
31
+ user_id: StrictStr = Field(description="User ID")
32
+ product_id: StrictStr = Field(description="Product ID")
33
+ access_from: StrictInt = Field(description="Access from timestamp in milliseconds")
34
+ access_until: StrictInt = Field(
35
+ description="Access until timestamp in milliseconds. 0 means unlimited."
36
+ )
37
+ id: StrictStr = Field(description="UID of the product subscription")
38
+ __properties: ClassVar[List[str]] = [
39
+ "user_id",
40
+ "product_id",
41
+ "access_from",
42
+ "access_until",
43
+ "id",
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 ProductSubRead 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
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ProductSubRead from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate(
95
+ {
96
+ "user_id": obj.get("user_id"),
97
+ "product_id": obj.get("product_id"),
98
+ "access_from": obj.get("access_from"),
99
+ "access_until": obj.get("access_until"),
100
+ "id": obj.get("id"),
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,142 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Payment API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.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 (
21
+ BaseModel,
22
+ ConfigDict,
23
+ StrictBool,
24
+ StrictFloat,
25
+ StrictInt,
26
+ StrictStr,
27
+ )
28
+ from typing import Any, ClassVar, Dict, List, Optional, Union
29
+ from crypticorn.pay.client.models.scope import Scope
30
+ from typing import Optional, Set
31
+ from typing_extensions import Self
32
+
33
+
34
+ class ProductUpdate(BaseModel):
35
+ """
36
+ Model for updating a product
37
+ """ # noqa: E501
38
+
39
+ name: Optional[StrictStr] = None
40
+ price: Optional[Union[StrictFloat, StrictInt]] = None
41
+ scopes: Optional[List[Scope]] = None
42
+ duration: Optional[StrictInt] = None
43
+ description: Optional[StrictStr] = None
44
+ is_active: Optional[StrictBool] = None
45
+ __properties: ClassVar[List[str]] = [
46
+ "name",
47
+ "price",
48
+ "scopes",
49
+ "duration",
50
+ "description",
51
+ "is_active",
52
+ ]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of ProductUpdate from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # set to None if name (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.name is None and "name" in self.model_fields_set:
94
+ _dict["name"] = None
95
+
96
+ # set to None if price (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.price is None and "price" in self.model_fields_set:
99
+ _dict["price"] = None
100
+
101
+ # set to None if scopes (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.scopes is None and "scopes" in self.model_fields_set:
104
+ _dict["scopes"] = None
105
+
106
+ # set to None if duration (nullable) is None
107
+ # and model_fields_set contains the field
108
+ if self.duration is None and "duration" in self.model_fields_set:
109
+ _dict["duration"] = None
110
+
111
+ # set to None if description (nullable) is None
112
+ # and model_fields_set contains the field
113
+ if self.description is None and "description" in self.model_fields_set:
114
+ _dict["description"] = None
115
+
116
+ # set to None if is_active (nullable) is None
117
+ # and model_fields_set contains the field
118
+ if self.is_active is None and "is_active" in self.model_fields_set:
119
+ _dict["is_active"] = None
120
+
121
+ return _dict
122
+
123
+ @classmethod
124
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
125
+ """Create an instance of ProductUpdate from a dict"""
126
+ if obj is None:
127
+ return None
128
+
129
+ if not isinstance(obj, dict):
130
+ return cls.model_validate(obj)
131
+
132
+ _obj = cls.model_validate(
133
+ {
134
+ "name": obj.get("name"),
135
+ "price": obj.get("price"),
136
+ "scopes": obj.get("scopes"),
137
+ "duration": obj.get("duration"),
138
+ "description": obj.get("description"),
139
+ "is_active": obj.get("is_active"),
140
+ }
141
+ )
142
+ return _obj
@@ -3,14 +3,14 @@
3
3
  # flake8: noqa
4
4
 
5
5
  """
6
- Trading API
6
+ Trading API
7
7
 
8
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
9
9
 
10
- The version of the OpenAPI document: 0.1.0
11
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+ The version of the OpenAPI document: 0.1.0
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
12
 
13
- Do not edit the class manually.
13
+ Do not edit the class manually.
14
14
  """ # noqa: E501
15
15
 
16
16
 
@@ -63,6 +63,4 @@ from crypticorn.trade.client.models.strategy_model_output import StrategyModelOu
63
63
  from crypticorn.trade.client.models.tpsl import TPSL
64
64
  from crypticorn.trade.client.models.trading_action_type import TradingActionType
65
65
  from crypticorn.trade.client.models.validation_error import ValidationError
66
- from crypticorn.trade.client.models.validation_error_loc_inner import (
67
- ValidationErrorLocInner,
68
- )
66
+ from crypticorn.trade.client.models.validation_error_loc_inner import ValidationErrorLocInner
@@ -10,3 +10,4 @@ from crypticorn.trade.client.api.orders_api import OrdersApi
10
10
  from crypticorn.trade.client.api.status_api import StatusApi
11
11
  from crypticorn.trade.client.api.strategies_api import StrategiesApi
12
12
  from crypticorn.trade.client.api.trading_actions_api import TradingActionsApi
13
+