crypticorn 2.11.6__py3-none-any.whl → 2.11.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 (56) hide show
  1. crypticorn/common/errors.py +3 -3
  2. crypticorn/trade/client/__init__.py +27 -9
  3. crypticorn/trade/client/api/__init__.py +1 -0
  4. crypticorn/trade/client/api/admin_api.py +1455 -0
  5. crypticorn/trade/client/api/api_keys_api.py +60 -58
  6. crypticorn/trade/client/api/bots_api.py +289 -48
  7. crypticorn/trade/client/api/exchanges_api.py +474 -17
  8. crypticorn/trade/client/api/futures_trading_panel_api.py +1 -1
  9. crypticorn/trade/client/api/notifications_api.py +80 -96
  10. crypticorn/trade/client/api/orders_api.py +7 -7
  11. crypticorn/trade/client/api/status_api.py +5 -232
  12. crypticorn/trade/client/api/strategies_api.py +49 -48
  13. crypticorn/trade/client/api/trading_actions_api.py +42 -38
  14. crypticorn/trade/client/api_client.py +1 -1
  15. crypticorn/trade/client/configuration.py +1 -1
  16. crypticorn/trade/client/exceptions.py +1 -1
  17. crypticorn/trade/client/models/__init__.py +26 -9
  18. crypticorn/trade/client/models/api_error_identifier.py +116 -0
  19. crypticorn/trade/client/models/api_error_level.py +37 -0
  20. crypticorn/trade/client/models/api_error_type.py +37 -0
  21. crypticorn/trade/client/models/{bot_model.py → bot.py} +59 -60
  22. crypticorn/trade/client/models/bot_create.py +104 -0
  23. crypticorn/trade/client/models/bot_status.py +1 -1
  24. crypticorn/trade/client/models/bot_update.py +107 -0
  25. crypticorn/trade/client/models/exception_detail.py +8 -5
  26. crypticorn/trade/client/models/exchange.py +36 -0
  27. crypticorn/trade/client/models/exchange_key.py +111 -0
  28. crypticorn/trade/client/models/exchange_key_create.py +107 -0
  29. crypticorn/trade/client/models/{exchange_key_model.py → exchange_key_update.py} +12 -47
  30. crypticorn/trade/client/models/execution_ids.py +1 -1
  31. crypticorn/trade/client/models/futures_balance.py +1 -1
  32. crypticorn/trade/client/models/futures_trading_action.py +24 -16
  33. crypticorn/trade/client/models/{spot_trading_action.py → futures_trading_action_create.py} +24 -28
  34. crypticorn/trade/client/models/log_level.py +38 -0
  35. crypticorn/trade/client/models/margin_mode.py +1 -1
  36. crypticorn/trade/client/models/market_type.py +35 -0
  37. crypticorn/trade/client/models/{notification_model.py → notification.py} +35 -40
  38. crypticorn/trade/client/models/notification_create.py +114 -0
  39. crypticorn/trade/client/models/notification_update.py +96 -0
  40. crypticorn/trade/client/models/{order_model.py → order.py} +36 -31
  41. crypticorn/trade/client/models/order_status.py +1 -1
  42. crypticorn/trade/client/models/post_futures_action.py +1 -1
  43. crypticorn/trade/client/models/{action_model.py → spot_trading_action_create.py} +7 -65
  44. crypticorn/trade/client/models/{strategy_model_input.py → strategy.py} +25 -33
  45. crypticorn/trade/client/models/{strategy_model_output.py → strategy_create.py} +16 -39
  46. crypticorn/trade/client/models/strategy_exchange_info.py +4 -3
  47. crypticorn/trade/client/models/strategy_update.py +147 -0
  48. crypticorn/trade/client/models/tpsl.py +1 -1
  49. crypticorn/trade/client/models/trading_action_type.py +1 -1
  50. crypticorn/trade/client/rest.py +1 -1
  51. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/METADATA +1 -1
  52. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/RECORD +56 -42
  53. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/WHEEL +0 -0
  54. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/entry_points.txt +0 -0
  55. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/licenses/LICENSE +0 -0
  56. {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -28,26 +28,22 @@ from pydantic import (
28
28
  )
29
29
  from typing import Any, ClassVar, Dict, List, Optional, Union
30
30
  from typing_extensions import Annotated
31
- from crypticorn.trade.client.models.margin_mode import MarginMode
31
+ from crypticorn.trade.client.models.market_type import MarketType
32
32
  from crypticorn.trade.client.models.tpsl import TPSL
33
33
  from crypticorn.trade.client.models.trading_action_type import TradingActionType
34
34
  from typing import Optional, Set
35
35
  from typing_extensions import Self
36
36
 
37
37
 
38
- class ActionModel(BaseModel):
38
+ class SpotTradingActionCreate(BaseModel):
39
39
  """
40
- ActionModel
40
+ Model for sending spot trading actions
41
41
  """ # noqa: E501
42
42
 
43
- created_at: Optional[StrictInt] = None
44
- updated_at: Optional[StrictInt] = None
45
- id: Optional[StrictStr] = None
46
43
  execution_id: Optional[StrictStr] = None
47
44
  open_order_execution_id: Optional[StrictStr] = None
48
- client_order_id: Optional[StrictStr] = None
49
45
  action_type: TradingActionType = Field(description="The type of action.")
50
- market_type: StrictStr = Field(description="Market types")
46
+ market_type: MarketType = Field(description="The type of market the action is for.")
51
47
  strategy_id: StrictStr = Field(description="UID for the strategy.")
52
48
  symbol: StrictStr = Field(
53
49
  description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)"
@@ -66,16 +62,9 @@ class ActionModel(BaseModel):
66
62
  take_profit: Optional[List[TPSL]] = None
67
63
  stop_loss: Optional[List[TPSL]] = None
68
64
  expiry_timestamp: Optional[StrictInt] = None
69
- position_id: Optional[StrictStr] = None
70
- leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
71
- margin_mode: Optional[MarginMode] = None
72
65
  __properties: ClassVar[List[str]] = [
73
- "created_at",
74
- "updated_at",
75
- "id",
76
66
  "execution_id",
77
67
  "open_order_execution_id",
78
- "client_order_id",
79
68
  "action_type",
80
69
  "market_type",
81
70
  "strategy_id",
@@ -86,9 +75,6 @@ class ActionModel(BaseModel):
86
75
  "take_profit",
87
76
  "stop_loss",
88
77
  "expiry_timestamp",
89
- "position_id",
90
- "leverage",
91
- "margin_mode",
92
78
  ]
93
79
 
94
80
  model_config = ConfigDict(
@@ -108,7 +94,7 @@ class ActionModel(BaseModel):
108
94
 
109
95
  @classmethod
110
96
  def from_json(cls, json_str: str) -> Optional[Self]:
111
- """Create an instance of ActionModel from a JSON string"""
97
+ """Create an instance of SpotTradingActionCreate from a JSON string"""
112
98
  return cls.from_dict(json.loads(json_str))
113
99
 
114
100
  def to_dict(self) -> Dict[str, Any]:
@@ -142,21 +128,6 @@ class ActionModel(BaseModel):
142
128
  if _item_stop_loss:
143
129
  _items.append(_item_stop_loss.to_dict())
144
130
  _dict["stop_loss"] = _items
145
- # set to None if created_at (nullable) is None
146
- # and model_fields_set contains the field
147
- if self.created_at is None and "created_at" in self.model_fields_set:
148
- _dict["created_at"] = None
149
-
150
- # set to None if updated_at (nullable) is None
151
- # and model_fields_set contains the field
152
- if self.updated_at is None and "updated_at" in self.model_fields_set:
153
- _dict["updated_at"] = None
154
-
155
- # set to None if id (nullable) is None
156
- # and model_fields_set contains the field
157
- if self.id is None and "id" in self.model_fields_set:
158
- _dict["id"] = None
159
-
160
131
  # set to None if execution_id (nullable) is None
161
132
  # and model_fields_set contains the field
162
133
  if self.execution_id is None and "execution_id" in self.model_fields_set:
@@ -170,11 +141,6 @@ class ActionModel(BaseModel):
170
141
  ):
171
142
  _dict["open_order_execution_id"] = None
172
143
 
173
- # set to None if client_order_id (nullable) is None
174
- # and model_fields_set contains the field
175
- if self.client_order_id is None and "client_order_id" in self.model_fields_set:
176
- _dict["client_order_id"] = None
177
-
178
144
  # set to None if is_limit (nullable) is None
179
145
  # and model_fields_set contains the field
180
146
  if self.is_limit is None and "is_limit" in self.model_fields_set:
@@ -203,26 +169,11 @@ class ActionModel(BaseModel):
203
169
  ):
204
170
  _dict["expiry_timestamp"] = None
205
171
 
206
- # set to None if position_id (nullable) is None
207
- # and model_fields_set contains the field
208
- if self.position_id is None and "position_id" in self.model_fields_set:
209
- _dict["position_id"] = None
210
-
211
- # set to None if leverage (nullable) is None
212
- # and model_fields_set contains the field
213
- if self.leverage is None and "leverage" in self.model_fields_set:
214
- _dict["leverage"] = None
215
-
216
- # set to None if margin_mode (nullable) is None
217
- # and model_fields_set contains the field
218
- if self.margin_mode is None and "margin_mode" in self.model_fields_set:
219
- _dict["margin_mode"] = None
220
-
221
172
  return _dict
222
173
 
223
174
  @classmethod
224
175
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
225
- """Create an instance of ActionModel from a dict"""
176
+ """Create an instance of SpotTradingActionCreate from a dict"""
226
177
  if obj is None:
227
178
  return None
228
179
 
@@ -231,12 +182,8 @@ class ActionModel(BaseModel):
231
182
 
232
183
  _obj = cls.model_validate(
233
184
  {
234
- "created_at": obj.get("created_at"),
235
- "updated_at": obj.get("updated_at"),
236
- "id": obj.get("id"),
237
185
  "execution_id": obj.get("execution_id"),
238
186
  "open_order_execution_id": obj.get("open_order_execution_id"),
239
- "client_order_id": obj.get("client_order_id"),
240
187
  "action_type": obj.get("action_type"),
241
188
  "market_type": obj.get("market_type"),
242
189
  "strategy_id": obj.get("strategy_id"),
@@ -255,11 +202,6 @@ class ActionModel(BaseModel):
255
202
  else None
256
203
  ),
257
204
  "expiry_timestamp": obj.get("expiry_timestamp"),
258
- "position_id": obj.get("position_id"),
259
- "leverage": (
260
- obj.get("leverage") if obj.get("leverage") is not None else 1
261
- ),
262
- "margin_mode": obj.get("margin_mode"),
263
205
  }
264
206
  )
265
207
  return _obj
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -20,21 +20,25 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from typing_extensions import Annotated
23
+ from crypticorn.trade.client.models.market_type import MarketType
23
24
  from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
26
27
 
27
28
 
28
- class StrategyModelInput(BaseModel):
29
+ class Strategy(BaseModel):
29
30
  """
30
- StrategyModelInput
31
+ Strategy model for read operations.
31
32
  """ # noqa: E501
32
33
 
33
- created_at: Optional[StrictInt] = None
34
- updated_at: Optional[StrictInt] = None
35
- id: Optional[StrictStr] = None
36
- identifier: StrictStr = Field(
37
- description="Unique human readable identifier for the strategy e.g. 'daily_trend_momentum'"
34
+ id: Optional[StrictStr] = Field(
35
+ default=None, description="Unique identifier for the resource"
36
+ )
37
+ created_at: Optional[StrictInt] = Field(
38
+ default=None, description="Timestamp of creation"
39
+ )
40
+ updated_at: Optional[StrictInt] = Field(
41
+ default=None, description="Timestamp of last update"
38
42
  )
39
43
  name: StrictStr = Field(description="Name of the strategy")
40
44
  description: StrictStr = Field(description="Description of the strategy")
@@ -44,23 +48,26 @@ class StrategyModelInput(BaseModel):
44
48
  enabled: StrictBool = Field(
45
49
  description="Whether the strategy is enabled. If false, no bots will be created or updated for this strategy, open trades will be rejected. Existing bots will be marked as stopping."
46
50
  )
47
- leverage: StrictInt = Field(description="Leverage for the strategy")
48
51
  performance_fee: Union[
49
52
  Annotated[float, Field(le=1.0, strict=True)],
50
53
  Annotated[int, Field(le=1, strict=True)],
51
54
  ] = Field(description="Performance fee for the strategy")
52
- market_type: StrictStr = Field(description="Market types")
55
+ identifier: StrictStr = Field(
56
+ description="Unique human readable identifier for the strategy e.g. 'daily_trend_momentum'"
57
+ )
58
+ leverage: StrictInt = Field(description="Leverage for the strategy")
59
+ market_type: MarketType = Field(description="Market of operation of the strategy")
53
60
  __properties: ClassVar[List[str]] = [
61
+ "id",
54
62
  "created_at",
55
63
  "updated_at",
56
- "id",
57
- "identifier",
58
64
  "name",
59
65
  "description",
60
66
  "exchanges",
61
67
  "enabled",
62
- "leverage",
63
68
  "performance_fee",
69
+ "identifier",
70
+ "leverage",
64
71
  "market_type",
65
72
  ]
66
73
 
@@ -81,7 +88,7 @@ class StrategyModelInput(BaseModel):
81
88
 
82
89
  @classmethod
83
90
  def from_json(cls, json_str: str) -> Optional[Self]:
84
- """Create an instance of StrategyModelInput from a JSON string"""
91
+ """Create an instance of Strategy from a JSON string"""
85
92
  return cls.from_dict(json.loads(json_str))
86
93
 
87
94
  def to_dict(self) -> Dict[str, Any]:
@@ -108,26 +115,11 @@ class StrategyModelInput(BaseModel):
108
115
  if _item_exchanges:
109
116
  _items.append(_item_exchanges.to_dict())
110
117
  _dict["exchanges"] = _items
111
- # set to None if created_at (nullable) is None
112
- # and model_fields_set contains the field
113
- if self.created_at is None and "created_at" in self.model_fields_set:
114
- _dict["created_at"] = None
115
-
116
- # set to None if updated_at (nullable) is None
117
- # and model_fields_set contains the field
118
- if self.updated_at is None and "updated_at" in self.model_fields_set:
119
- _dict["updated_at"] = None
120
-
121
- # set to None if id (nullable) is None
122
- # and model_fields_set contains the field
123
- if self.id is None and "id" in self.model_fields_set:
124
- _dict["id"] = None
125
-
126
118
  return _dict
127
119
 
128
120
  @classmethod
129
121
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
130
- """Create an instance of StrategyModelInput from a dict"""
122
+ """Create an instance of Strategy from a dict"""
131
123
  if obj is None:
132
124
  return None
133
125
 
@@ -136,10 +128,9 @@ class StrategyModelInput(BaseModel):
136
128
 
137
129
  _obj = cls.model_validate(
138
130
  {
131
+ "id": obj.get("id"),
139
132
  "created_at": obj.get("created_at"),
140
133
  "updated_at": obj.get("updated_at"),
141
- "id": obj.get("id"),
142
- "identifier": obj.get("identifier"),
143
134
  "name": obj.get("name"),
144
135
  "description": obj.get("description"),
145
136
  "exchanges": (
@@ -151,8 +142,9 @@ class StrategyModelInput(BaseModel):
151
142
  else None
152
143
  ),
153
144
  "enabled": obj.get("enabled"),
154
- "leverage": obj.get("leverage"),
155
145
  "performance_fee": obj.get("performance_fee"),
146
+ "identifier": obj.get("identifier"),
147
+ "leverage": obj.get("leverage"),
156
148
  "market_type": obj.get("market_type"),
157
149
  }
158
150
  )
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -18,24 +18,19 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional, Union
21
+ from typing import Any, ClassVar, Dict, List, Union
22
22
  from typing_extensions import Annotated
23
+ from crypticorn.trade.client.models.market_type import MarketType
23
24
  from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
26
27
 
27
28
 
28
- class StrategyModelOutput(BaseModel):
29
+ class StrategyCreate(BaseModel):
29
30
  """
30
- StrategyModelOutput
31
+ Strategy model for API create operations.
31
32
  """ # noqa: E501
32
33
 
33
- created_at: Optional[StrictInt] = None
34
- updated_at: Optional[StrictInt] = None
35
- id: Optional[StrictStr] = None
36
- identifier: StrictStr = Field(
37
- description="Unique human readable identifier for the strategy e.g. 'daily_trend_momentum'"
38
- )
39
34
  name: StrictStr = Field(description="Name of the strategy")
40
35
  description: StrictStr = Field(description="Description of the strategy")
41
36
  exchanges: List[StrategyExchangeInfo] = Field(
@@ -44,23 +39,23 @@ class StrategyModelOutput(BaseModel):
44
39
  enabled: StrictBool = Field(
45
40
  description="Whether the strategy is enabled. If false, no bots will be created or updated for this strategy, open trades will be rejected. Existing bots will be marked as stopping."
46
41
  )
47
- leverage: StrictInt = Field(description="Leverage for the strategy")
48
42
  performance_fee: Union[
49
43
  Annotated[float, Field(le=1.0, strict=True)],
50
44
  Annotated[int, Field(le=1, strict=True)],
51
45
  ] = Field(description="Performance fee for the strategy")
52
- market_type: StrictStr = Field(description="Market types")
46
+ identifier: StrictStr = Field(
47
+ description="Unique human readable identifier for the strategy e.g. 'daily_trend_momentum'"
48
+ )
49
+ leverage: StrictInt = Field(description="Leverage for the strategy")
50
+ market_type: MarketType = Field(description="Market of operation of the strategy")
53
51
  __properties: ClassVar[List[str]] = [
54
- "created_at",
55
- "updated_at",
56
- "id",
57
- "identifier",
58
52
  "name",
59
53
  "description",
60
54
  "exchanges",
61
55
  "enabled",
62
- "leverage",
63
56
  "performance_fee",
57
+ "identifier",
58
+ "leverage",
64
59
  "market_type",
65
60
  ]
66
61
 
@@ -81,7 +76,7 @@ class StrategyModelOutput(BaseModel):
81
76
 
82
77
  @classmethod
83
78
  def from_json(cls, json_str: str) -> Optional[Self]:
84
- """Create an instance of StrategyModelOutput from a JSON string"""
79
+ """Create an instance of StrategyCreate from a JSON string"""
85
80
  return cls.from_dict(json.loads(json_str))
86
81
 
87
82
  def to_dict(self) -> Dict[str, Any]:
@@ -108,26 +103,11 @@ class StrategyModelOutput(BaseModel):
108
103
  if _item_exchanges:
109
104
  _items.append(_item_exchanges.to_dict())
110
105
  _dict["exchanges"] = _items
111
- # set to None if created_at (nullable) is None
112
- # and model_fields_set contains the field
113
- if self.created_at is None and "created_at" in self.model_fields_set:
114
- _dict["created_at"] = None
115
-
116
- # set to None if updated_at (nullable) is None
117
- # and model_fields_set contains the field
118
- if self.updated_at is None and "updated_at" in self.model_fields_set:
119
- _dict["updated_at"] = None
120
-
121
- # set to None if id (nullable) is None
122
- # and model_fields_set contains the field
123
- if self.id is None and "id" in self.model_fields_set:
124
- _dict["id"] = None
125
-
126
106
  return _dict
127
107
 
128
108
  @classmethod
129
109
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
130
- """Create an instance of StrategyModelOutput from a dict"""
110
+ """Create an instance of StrategyCreate from a dict"""
131
111
  if obj is None:
132
112
  return None
133
113
 
@@ -136,10 +116,6 @@ class StrategyModelOutput(BaseModel):
136
116
 
137
117
  _obj = cls.model_validate(
138
118
  {
139
- "created_at": obj.get("created_at"),
140
- "updated_at": obj.get("updated_at"),
141
- "id": obj.get("id"),
142
- "identifier": obj.get("identifier"),
143
119
  "name": obj.get("name"),
144
120
  "description": obj.get("description"),
145
121
  "exchanges": (
@@ -151,8 +127,9 @@ class StrategyModelOutput(BaseModel):
151
127
  else None
152
128
  ),
153
129
  "enabled": obj.get("enabled"),
154
- "leverage": obj.get("leverage"),
155
130
  "performance_fee": obj.get("performance_fee"),
131
+ "identifier": obj.get("identifier"),
132
+ "leverage": obj.get("leverage"),
156
133
  "market_type": obj.get("market_type"),
157
134
  }
158
135
  )
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -17,8 +17,9 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
21
21
  from typing import Any, ClassVar, Dict, List, Union
22
+ from crypticorn.trade.client.models.exchange import Exchange
22
23
  from typing import Optional, Set
23
24
  from typing_extensions import Self
24
25
 
@@ -28,7 +29,7 @@ class StrategyExchangeInfo(BaseModel):
28
29
  StrategyExchangeInfo
29
30
  """ # noqa: E501
30
31
 
31
- exchange: StrictStr = Field(description="Supported exchanges for trading")
32
+ exchange: Exchange = Field(description="Exchange name. Of type Exchange")
32
33
  min_amount: Union[StrictFloat, StrictInt] = Field(
33
34
  description="Minimum amount for the strategy on the exchange"
34
35
  )
@@ -0,0 +1,147 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Trading API
5
+
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
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, StrictBool, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from typing_extensions import Annotated
23
+ from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class StrategyUpdate(BaseModel):
29
+ """
30
+ Strategy model for API update operations.
31
+ """ # noqa: E501
32
+
33
+ name: Optional[StrictStr] = None
34
+ description: Optional[StrictStr] = None
35
+ exchanges: Optional[List[StrategyExchangeInfo]] = None
36
+ enabled: Optional[StrictBool] = None
37
+ performance_fee: Optional[
38
+ Union[
39
+ Annotated[float, Field(le=1.0, strict=True)],
40
+ Annotated[int, Field(le=1, strict=True)],
41
+ ]
42
+ ] = None
43
+ __properties: ClassVar[List[str]] = [
44
+ "name",
45
+ "description",
46
+ "exchanges",
47
+ "enabled",
48
+ "performance_fee",
49
+ ]
50
+
51
+ model_config = ConfigDict(
52
+ populate_by_name=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+ def to_str(self) -> str:
58
+ """Returns the string representation of the model using alias"""
59
+ return pprint.pformat(self.model_dump(by_alias=True))
60
+
61
+ def to_json(self) -> str:
62
+ """Returns the JSON representation of the model using alias"""
63
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
+ return json.dumps(self.to_dict())
65
+
66
+ @classmethod
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
+ """Create an instance of StrategyUpdate from a JSON string"""
69
+ return cls.from_dict(json.loads(json_str))
70
+
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ """
81
+ excluded_fields: Set[str] = set([])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ # override the default output from pydantic by calling `to_dict()` of each item in exchanges (list)
89
+ _items = []
90
+ if self.exchanges:
91
+ for _item_exchanges in self.exchanges:
92
+ if _item_exchanges:
93
+ _items.append(_item_exchanges.to_dict())
94
+ _dict["exchanges"] = _items
95
+ # set to None if name (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.name is None and "name" in self.model_fields_set:
98
+ _dict["name"] = None
99
+
100
+ # set to None if description (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.description is None and "description" in self.model_fields_set:
103
+ _dict["description"] = None
104
+
105
+ # set to None if exchanges (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.exchanges is None and "exchanges" in self.model_fields_set:
108
+ _dict["exchanges"] = None
109
+
110
+ # set to None if enabled (nullable) is None
111
+ # and model_fields_set contains the field
112
+ if self.enabled is None and "enabled" in self.model_fields_set:
113
+ _dict["enabled"] = None
114
+
115
+ # set to None if performance_fee (nullable) is None
116
+ # and model_fields_set contains the field
117
+ if self.performance_fee is None and "performance_fee" in self.model_fields_set:
118
+ _dict["performance_fee"] = None
119
+
120
+ return _dict
121
+
122
+ @classmethod
123
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124
+ """Create an instance of StrategyUpdate from a dict"""
125
+ if obj is None:
126
+ return None
127
+
128
+ if not isinstance(obj, dict):
129
+ return cls.model_validate(obj)
130
+
131
+ _obj = cls.model_validate(
132
+ {
133
+ "name": obj.get("name"),
134
+ "description": obj.get("description"),
135
+ "exchanges": (
136
+ [
137
+ StrategyExchangeInfo.from_dict(_item)
138
+ for _item in obj["exchanges"]
139
+ ]
140
+ if obj.get("exchanges") is not None
141
+ else None
142
+ ),
143
+ "enabled": obj.get("enabled"),
144
+ "performance_fee": obj.get("performance_fee"),
145
+ }
146
+ )
147
+ return _obj
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
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
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
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
  Trading API
5
5
 
6
- API for automated trading and exchange interface
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypticorn
3
- Version: 2.11.6
3
+ Version: 2.11.7
4
4
  Summary: Maximise Your Crypto Trading Profits with Machine Learning
5
5
  Author-email: Crypticorn <timon@crypticorn.com>
6
6
  License-Expression: MIT