crypticorn 1.0.0__tar.gz → 1.0.1__tar.gz

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 (45) hide show
  1. {crypticorn-1.0.0 → crypticorn-1.0.1}/PKG-INFO +9 -3
  2. {crypticorn-1.0.0 → crypticorn-1.0.1}/README.md +1 -1
  3. crypticorn-1.0.1/crypticorn/models/__init__.py +31 -0
  4. crypticorn-1.0.1/crypticorn/models/action_model.py +205 -0
  5. crypticorn-1.0.1/crypticorn/models/api_error_identifier.py +81 -0
  6. crypticorn-1.0.1/crypticorn/models/api_key_model.py +138 -0
  7. crypticorn-1.0.1/crypticorn/models/bot_model.py +118 -0
  8. crypticorn-1.0.1/crypticorn/models/create_api_key_response.py +99 -0
  9. crypticorn-1.0.1/crypticorn/models/deleted.py +87 -0
  10. crypticorn-1.0.1/crypticorn/models/exchange.py +37 -0
  11. crypticorn-1.0.1/crypticorn/models/execution_ids.py +91 -0
  12. crypticorn-1.0.1/crypticorn/models/futures_balance.py +109 -0
  13. crypticorn-1.0.1/crypticorn/models/futures_balance_error.py +89 -0
  14. crypticorn-1.0.1/crypticorn/models/futures_trading_action.py +198 -0
  15. crypticorn-1.0.1/crypticorn/models/get_futures_balance200_response_inner.py +134 -0
  16. crypticorn-1.0.1/crypticorn/models/http_validation_error.py +95 -0
  17. crypticorn-1.0.1/crypticorn/models/id.py +87 -0
  18. crypticorn-1.0.1/crypticorn/models/margin_mode.py +37 -0
  19. crypticorn-1.0.1/crypticorn/models/market_type.py +37 -0
  20. crypticorn-1.0.1/crypticorn/models/modified.py +87 -0
  21. crypticorn-1.0.1/crypticorn/models/notification_model.py +111 -0
  22. crypticorn-1.0.1/crypticorn/models/notification_type.py +39 -0
  23. crypticorn-1.0.1/crypticorn/models/order_model.py +266 -0
  24. crypticorn-1.0.1/crypticorn/models/order_status.py +40 -0
  25. crypticorn-1.0.1/crypticorn/models/post_futures_action.py +93 -0
  26. crypticorn-1.0.1/crypticorn/models/strategy_exchange_info.py +90 -0
  27. crypticorn-1.0.1/crypticorn/models/strategy_model.py +115 -0
  28. crypticorn-1.0.1/crypticorn/models/tpsl.py +116 -0
  29. crypticorn-1.0.1/crypticorn/models/trading_action_type.py +39 -0
  30. crypticorn-1.0.1/crypticorn/models/update_notification.py +91 -0
  31. crypticorn-1.0.1/crypticorn/models/validation_error.py +99 -0
  32. crypticorn-1.0.1/crypticorn/models/validation_error_loc_inner.py +138 -0
  33. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn.egg-info/PKG-INFO +9 -3
  34. crypticorn-1.0.1/crypticorn.egg-info/SOURCES.txt +41 -0
  35. crypticorn-1.0.1/crypticorn.egg-info/requires.txt +9 -0
  36. {crypticorn-1.0.0 → crypticorn-1.0.1}/pyproject.toml +8 -2
  37. crypticorn-1.0.0/crypticorn.egg-info/SOURCES.txt +0 -11
  38. crypticorn-1.0.0/crypticorn.egg-info/requires.txt +0 -2
  39. {crypticorn-1.0.0 → crypticorn-1.0.1}/LICENSE.md +0 -0
  40. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn/__init__.py +0 -0
  41. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn/api.py +0 -0
  42. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn/utils.py +0 -0
  43. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn.egg-info/dependency_links.txt +0 -0
  44. {crypticorn-1.0.0 → crypticorn-1.0.1}/crypticorn.egg-info/top_level.txt +0 -0
  45. {crypticorn-1.0.0 → crypticorn-1.0.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: crypticorn
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Maximise Your Crypto Trading Profits with AI Predictions
5
5
  Author-email: Crypticorn <timon@crypticorn.com>
6
6
  License: MIT License
@@ -19,13 +19,19 @@ Description-Content-Type: text/markdown
19
19
  License-File: LICENSE.md
20
20
  Requires-Dist: pandas<3.0.0,>=2.2.0
21
21
  Requires-Dist: requests<3.0.0,>=2.32.0
22
+ Requires-Dist: tqdm<5.0.0,>=4.67.0
23
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: black; extra == "dev"
26
+ Requires-Dist: twine; extra == "dev"
27
+ Requires-Dist: build; extra == "dev"
22
28
 
23
29
  # What is Crypticorn?
24
30
 
25
31
  Crypticorn is at the forefront of cutting-edge artificial intelligence cryptocurrency trading.
26
32
  Crypticorn offers AI-based solutions for both active and passive investors, including:
27
33
  - Prediction Dashboard with trading terminal,
28
- - AI Trading Bots with different strategies,
34
+ - AI Agents with different strategies,
29
35
  - DEX AI Signals for newly launched tokens,
30
36
  - DEX AI Bots
31
37
 
@@ -3,7 +3,7 @@
3
3
  Crypticorn is at the forefront of cutting-edge artificial intelligence cryptocurrency trading.
4
4
  Crypticorn offers AI-based solutions for both active and passive investors, including:
5
5
  - Prediction Dashboard with trading terminal,
6
- - AI Trading Bots with different strategies,
6
+ - AI Agents with different strategies,
7
7
  - DEX AI Signals for newly launched tokens,
8
8
  - DEX AI Bots
9
9
 
@@ -0,0 +1,31 @@
1
+ from . import *
2
+ from .__init__ import *
3
+ from .action_model import *
4
+ from .api_error_identifier import *
5
+ from .api_key_model import *
6
+ from .bot_model import *
7
+ from .create_api_key_response import *
8
+ from .deleted import *
9
+ from .exchange import *
10
+ from .execution_ids import *
11
+ from .futures_balance import *
12
+ from .futures_balance_error import *
13
+ from .futures_trading_action import *
14
+ from .get_futures_balance200_response_inner import *
15
+ from .http_validation_error import *
16
+ from .id import *
17
+ from .margin_mode import *
18
+ from .market_type import *
19
+ from .modified import *
20
+ from .notification_model import *
21
+ from .notification_type import *
22
+ from .order_model import *
23
+ from .order_status import *
24
+ from .post_futures_action import *
25
+ from .strategy_exchange_info import *
26
+ from .strategy_model import *
27
+ from .tpsl import *
28
+ from .trading_action_type import *
29
+ from .update_notification import *
30
+ from .validation_error import *
31
+ from .validation_error_loc_inner import *
@@ -0,0 +1,205 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
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, StrictBool, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from typing_extensions import Annotated
23
+ from crypticorn.models.margin_mode import MarginMode
24
+ from crypticorn.models.market_type import MarketType
25
+ from crypticorn.models.tpsl import TPSL
26
+ from crypticorn.models.trading_action_type import TradingActionType
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class ActionModel(BaseModel):
31
+ """
32
+ ActionModel
33
+ """ # noqa: E501
34
+ id: Optional[StrictStr] = None
35
+ execution_id: Optional[StrictStr] = None
36
+ open_order_execution_id: Optional[StrictStr] = None
37
+ position_id: Optional[StrictStr] = None
38
+ client_order_id: Optional[StrictStr] = None
39
+ action_type: TradingActionType = Field(description="The type of action.")
40
+ market_type: MarketType = Field(description="The type of market the action is for.")
41
+ strategy_id: StrictStr = Field(description="UID for the strategy.")
42
+ symbol: StrictStr = Field(description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)")
43
+ is_limit: Optional[StrictBool] = None
44
+ limit_price: Optional[Union[StrictFloat, StrictInt]] = None
45
+ allocation: Optional[Union[Annotated[float, Field(le=1.0, strict=True)], Annotated[int, Field(le=1, strict=True)]]] = Field(default=None, description="How much of bot's balance to use for the order (for open actions). How much of the position to close (for close actions). 0=0%, 1=100%.")
46
+ take_profit: Optional[List[TPSL]] = None
47
+ stop_loss: Optional[List[TPSL]] = None
48
+ expiry_timestamp: Optional[StrictInt] = None
49
+ leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
50
+ margin_mode: Optional[MarginMode] = None
51
+ timestamp: Optional[StrictInt] = None
52
+ __properties: ClassVar[List[str]] = ["id", "execution_id", "open_order_execution_id", "position_id", "client_order_id", "action_type", "market_type", "strategy_id", "symbol", "is_limit", "limit_price", "allocation", "take_profit", "stop_loss", "expiry_timestamp", "leverage", "margin_mode", "timestamp"]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of ActionModel from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([
86
+ ])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # override the default output from pydantic by calling `to_dict()` of each item in take_profit (list)
94
+ _items = []
95
+ if self.take_profit:
96
+ for _item_take_profit in self.take_profit:
97
+ if _item_take_profit:
98
+ _items.append(_item_take_profit.to_dict())
99
+ _dict['take_profit'] = _items
100
+ # override the default output from pydantic by calling `to_dict()` of each item in stop_loss (list)
101
+ _items = []
102
+ if self.stop_loss:
103
+ for _item_stop_loss in self.stop_loss:
104
+ if _item_stop_loss:
105
+ _items.append(_item_stop_loss.to_dict())
106
+ _dict['stop_loss'] = _items
107
+ # set to None if id (nullable) is None
108
+ # and model_fields_set contains the field
109
+ if self.id is None and "id" in self.model_fields_set:
110
+ _dict['id'] = None
111
+
112
+ # set to None if execution_id (nullable) is None
113
+ # and model_fields_set contains the field
114
+ if self.execution_id is None and "execution_id" in self.model_fields_set:
115
+ _dict['execution_id'] = None
116
+
117
+ # set to None if open_order_execution_id (nullable) is None
118
+ # and model_fields_set contains the field
119
+ if self.open_order_execution_id is None and "open_order_execution_id" in self.model_fields_set:
120
+ _dict['open_order_execution_id'] = None
121
+
122
+ # set to None if position_id (nullable) is None
123
+ # and model_fields_set contains the field
124
+ if self.position_id is None and "position_id" in self.model_fields_set:
125
+ _dict['position_id'] = None
126
+
127
+ # set to None if client_order_id (nullable) is None
128
+ # and model_fields_set contains the field
129
+ if self.client_order_id is None and "client_order_id" in self.model_fields_set:
130
+ _dict['client_order_id'] = None
131
+
132
+ # set to None if is_limit (nullable) is None
133
+ # and model_fields_set contains the field
134
+ if self.is_limit is None and "is_limit" in self.model_fields_set:
135
+ _dict['is_limit'] = None
136
+
137
+ # set to None if limit_price (nullable) is None
138
+ # and model_fields_set contains the field
139
+ if self.limit_price is None and "limit_price" in self.model_fields_set:
140
+ _dict['limit_price'] = None
141
+
142
+ # set to None if take_profit (nullable) is None
143
+ # and model_fields_set contains the field
144
+ if self.take_profit is None and "take_profit" in self.model_fields_set:
145
+ _dict['take_profit'] = None
146
+
147
+ # set to None if stop_loss (nullable) is None
148
+ # and model_fields_set contains the field
149
+ if self.stop_loss is None and "stop_loss" in self.model_fields_set:
150
+ _dict['stop_loss'] = None
151
+
152
+ # set to None if expiry_timestamp (nullable) is None
153
+ # and model_fields_set contains the field
154
+ if self.expiry_timestamp is None and "expiry_timestamp" in self.model_fields_set:
155
+ _dict['expiry_timestamp'] = None
156
+
157
+ # set to None if leverage (nullable) is None
158
+ # and model_fields_set contains the field
159
+ if self.leverage is None and "leverage" in self.model_fields_set:
160
+ _dict['leverage'] = None
161
+
162
+ # set to None if margin_mode (nullable) is None
163
+ # and model_fields_set contains the field
164
+ if self.margin_mode is None and "margin_mode" in self.model_fields_set:
165
+ _dict['margin_mode'] = None
166
+
167
+ # set to None if timestamp (nullable) is None
168
+ # and model_fields_set contains the field
169
+ if self.timestamp is None and "timestamp" in self.model_fields_set:
170
+ _dict['timestamp'] = None
171
+
172
+ return _dict
173
+
174
+ @classmethod
175
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
176
+ """Create an instance of ActionModel from a dict"""
177
+ if obj is None:
178
+ return None
179
+
180
+ if not isinstance(obj, dict):
181
+ return cls.model_validate(obj)
182
+
183
+ _obj = cls.model_validate({
184
+ "id": obj.get("id"),
185
+ "execution_id": obj.get("execution_id"),
186
+ "open_order_execution_id": obj.get("open_order_execution_id"),
187
+ "position_id": obj.get("position_id"),
188
+ "client_order_id": obj.get("client_order_id"),
189
+ "action_type": obj.get("action_type"),
190
+ "market_type": obj.get("market_type"),
191
+ "strategy_id": obj.get("strategy_id"),
192
+ "symbol": obj.get("symbol"),
193
+ "is_limit": obj.get("is_limit"),
194
+ "limit_price": obj.get("limit_price"),
195
+ "allocation": obj.get("allocation"),
196
+ "take_profit": [TPSL.from_dict(_item) for _item in obj["take_profit"]] if obj.get("take_profit") is not None else None,
197
+ "stop_loss": [TPSL.from_dict(_item) for _item in obj["stop_loss"]] if obj.get("stop_loss") is not None else None,
198
+ "expiry_timestamp": obj.get("expiry_timestamp"),
199
+ "leverage": obj.get("leverage") if obj.get("leverage") is not None else 1,
200
+ "margin_mode": obj.get("margin_mode"),
201
+ "timestamp": obj.get("timestamp")
202
+ })
203
+ return _obj
204
+
205
+
@@ -0,0 +1,81 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
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 json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class ApiErrorIdentifier(str, Enum):
22
+ """
23
+ API error identifiers
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ SUCCESS = 'success'
30
+ INVALID_API_KEY = 'invalid_api_key'
31
+ INVALID_SIGNATURE = 'invalid_signature'
32
+ INVALID_TIMESTAMP = 'invalid_timestamp'
33
+ IP_ADDRESS_IS_NOT_AUTHORIZED = 'ip_address_is_not_authorized'
34
+ INSUFFICIENT_PERMISSIONS_SPOT_AND_FUTURES_REQUIRED = 'insufficient_permissions_spot_and_futures_required'
35
+ USER_ACCOUNT_IS_FROZEN = 'user_account_is_frozen'
36
+ RATE_LIMIT_EXCEEDED = 'rate_limit_exceeded'
37
+ INVALID_PARAMETER_PROVIDED = 'invalid_parameter_provided'
38
+ REQUEST_SCOPE_LIMIT_EXCEEDED = 'request_scope_limit_exceeded'
39
+ INVALID_CONTENT_TYPE = 'invalid_content_type'
40
+ REQUESTED_RESOURCE_NOT_FOUND = 'requested_resource_not_found'
41
+ ORDER_DOES_NOT_EXIST = 'order_does_not_exist'
42
+ ORDER_IS_ALREADY_FILLED = 'order_is_already_filled'
43
+ ORDER_IS_BEING_PROCESSED = 'order_is_being_processed'
44
+ ORDER_QUANTITY_LIMIT_EXCEEDED = 'order_quantity_limit_exceeded'
45
+ ORDER_PRICE_IS_INVALID = 'order_price_is_invalid'
46
+ POST_ONLY_ORDER_WOULD_IMMEDIATELY_MATCH = 'post_only_order_would_immediately_match'
47
+ SYMBOL_DOES_NOT_EXIST = 'symbol_does_not_exist'
48
+ POSITION_DOES_NOT_EXIST = 'position_does_not_exist'
49
+ POSITION_LIMIT_EXCEEDED = 'position_limit_exceeded'
50
+ POSITION_OPENING_TEMPORARILY_SUSPENDED = 'position_opening_temporarily_suspended'
51
+ INSUFFICIENT_BALANCE = 'insufficient_balance'
52
+ INSUFFICIENT_MARGIN = 'insufficient_margin'
53
+ LEVERAGE_LIMIT_EXCEEDED = 'leverage_limit_exceeded'
54
+ RISK_LIMIT_EXCEEDED = 'risk_limit_exceeded'
55
+ ORDER_VIOLATES_LIQUIDATION_PRICE_CONSTRAINTS = 'order_violates_liquidation_price_constraints'
56
+ INVALID_MARGIN_MODE = 'invalid_margin_mode'
57
+ INTERNAL_SYSTEM_ERROR = 'internal_system_error'
58
+ SYSTEM_CONFIGURATION_ERROR = 'system_configuration_error'
59
+ SERVICE_TEMPORARILY_UNAVAILABLE = 'service_temporarily_unavailable'
60
+ SYSTEM_IS_BUSY_PLEASE_TRY_AGAIN_LATER = 'system_is_busy_please_try_again_later'
61
+ SYSTEM_UNDER_MAINTENANCE = 'system_under_maintenance'
62
+ RPC_TIMEOUT = 'rpc_timeout'
63
+ SYSTEM_SETTLEMENT_IN_PROCESS = 'system_settlement_in_process'
64
+ TRADING_IS_SUSPENDED = 'trading_is_suspended'
65
+ TRADING_HAS_BEEN_LOCKED = 'trading_has_been_locked'
66
+ UNKNOWN_ERROR_OCCURRED = 'unknown_error_occurred'
67
+ HTTP_REQUEST_ERROR = 'http_request_error'
68
+ BLACK_SWAN = 'black_swan'
69
+ TRADING_ACTION_EXPIRED = 'trading_action_expired'
70
+ BOT_DISABLED = 'bot_disabled'
71
+ NEW_TRADING_ACTION = 'new_trading_action'
72
+ ORDER_SIZE_TOO_SMALL = 'order_size_too_small'
73
+ ORDER_SIZE_TOO_LARGE = 'order_size_too_large'
74
+ HEDGE_MODE_NOT_ACTIVE = 'hedge_mode_not_active'
75
+
76
+ @classmethod
77
+ def from_json(cls, json_str: str) -> Self:
78
+ """Create an instance of ApiErrorIdentifier from a JSON string"""
79
+ return cls(json.loads(json_str))
80
+
81
+
@@ -0,0 +1,138 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
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, StrictBool, 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
+ class APIKeyModel(BaseModel):
26
+ """
27
+ APIKeyModel
28
+ """ # noqa: E501
29
+ id: Optional[StrictStr] = None
30
+ exchange: StrictStr = Field(description="Exchange name")
31
+ api_key: Optional[StrictStr] = None
32
+ secret: Optional[StrictStr] = None
33
+ passphrase: Optional[StrictStr] = None
34
+ label: StrictStr = Field(description="Label for the API key")
35
+ enabled: Optional[StrictBool] = None
36
+ created_at: Optional[StrictInt] = None
37
+ user_id: Optional[StrictStr] = None
38
+ __properties: ClassVar[List[str]] = ["id", "exchange", "api_key", "secret", "passphrase", "label", "enabled", "created_at", "user_id"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
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 APIKeyModel 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
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # set to None if id (nullable) is None
80
+ # and model_fields_set contains the field
81
+ if self.id is None and "id" in self.model_fields_set:
82
+ _dict['id'] = None
83
+
84
+ # set to None if api_key (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.api_key is None and "api_key" in self.model_fields_set:
87
+ _dict['api_key'] = None
88
+
89
+ # set to None if secret (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.secret is None and "secret" in self.model_fields_set:
92
+ _dict['secret'] = None
93
+
94
+ # set to None if passphrase (nullable) is None
95
+ # and model_fields_set contains the field
96
+ if self.passphrase is None and "passphrase" in self.model_fields_set:
97
+ _dict['passphrase'] = None
98
+
99
+ # set to None if enabled (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.enabled is None and "enabled" in self.model_fields_set:
102
+ _dict['enabled'] = None
103
+
104
+ # set to None if created_at (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.created_at is None and "created_at" in self.model_fields_set:
107
+ _dict['created_at'] = None
108
+
109
+ # set to None if user_id (nullable) is None
110
+ # and model_fields_set contains the field
111
+ if self.user_id is None and "user_id" in self.model_fields_set:
112
+ _dict['user_id'] = None
113
+
114
+ return _dict
115
+
116
+ @classmethod
117
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
+ """Create an instance of APIKeyModel from a dict"""
119
+ if obj is None:
120
+ return None
121
+
122
+ if not isinstance(obj, dict):
123
+ return cls.model_validate(obj)
124
+
125
+ _obj = cls.model_validate({
126
+ "id": obj.get("id"),
127
+ "exchange": obj.get("exchange"),
128
+ "api_key": obj.get("api_key"),
129
+ "secret": obj.get("secret"),
130
+ "passphrase": obj.get("passphrase"),
131
+ "label": obj.get("label"),
132
+ "enabled": obj.get("enabled"),
133
+ "created_at": obj.get("created_at"),
134
+ "user_id": obj.get("user_id")
135
+ })
136
+ return _obj
137
+
138
+
@@ -0,0 +1,118 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
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, StrictBool, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class BotModel(BaseModel):
26
+ """
27
+ BotModel
28
+ """ # noqa: E501
29
+ id: Optional[StrictStr] = None
30
+ name: StrictStr = Field(description="Name of the bot")
31
+ strategy_id: StrictStr = Field(description="UID for the trading strategy used by the bot")
32
+ api_key_id: StrictStr = Field(description="UID for the API key")
33
+ initial_allocation: Union[StrictFloat, StrictInt] = Field(description="Initial allocation for the bot")
34
+ current_allocation: Optional[Union[StrictFloat, StrictInt]] = None
35
+ enabled: StrictBool = Field(description="Status of the bot")
36
+ deleted: Optional[StrictBool] = Field(default=False, description="Whether the bot has been deleted")
37
+ user_id: Optional[StrictStr] = None
38
+ __properties: ClassVar[List[str]] = ["id", "name", "strategy_id", "api_key_id", "initial_allocation", "current_allocation", "enabled", "deleted", "user_id"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
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 BotModel 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
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # set to None if id (nullable) is None
80
+ # and model_fields_set contains the field
81
+ if self.id is None and "id" in self.model_fields_set:
82
+ _dict['id'] = None
83
+
84
+ # set to None if current_allocation (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.current_allocation is None and "current_allocation" in self.model_fields_set:
87
+ _dict['current_allocation'] = None
88
+
89
+ # set to None if user_id (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.user_id is None and "user_id" in self.model_fields_set:
92
+ _dict['user_id'] = None
93
+
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of BotModel from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "id": obj.get("id"),
107
+ "name": obj.get("name"),
108
+ "strategy_id": obj.get("strategy_id"),
109
+ "api_key_id": obj.get("api_key_id"),
110
+ "initial_allocation": obj.get("initial_allocation"),
111
+ "current_allocation": obj.get("current_allocation"),
112
+ "enabled": obj.get("enabled"),
113
+ "deleted": obj.get("deleted") if obj.get("deleted") is not None else False,
114
+ "user_id": obj.get("user_id")
115
+ })
116
+ return _obj
117
+
118
+