crypticorn 1.0.1__py3-none-any.whl → 1.0.2rc2__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 (132) hide show
  1. crypticorn/__init__.py +3 -3
  2. crypticorn/client.py +722 -0
  3. crypticorn/hive/__init__.py +1 -0
  4. crypticorn/{api.py → hive/main.py} +6 -6
  5. crypticorn/hive/requirements.txt +4 -0
  6. crypticorn/{utils.py → hive/utils.py} +2 -2
  7. crypticorn/klines/__init__.py +2 -0
  8. crypticorn/klines/client/__init__.py +62 -0
  9. crypticorn/klines/client/api/__init__.py +9 -0
  10. crypticorn/klines/client/api/funding_rates_api.py +362 -0
  11. crypticorn/klines/client/api/health_check_api.py +281 -0
  12. crypticorn/klines/client/api/ohlcv_data_api.py +409 -0
  13. crypticorn/klines/client/api/symbols_api.py +308 -0
  14. crypticorn/klines/client/api/udf_api.py +1929 -0
  15. crypticorn/klines/client/api_client.py +797 -0
  16. crypticorn/klines/client/api_response.py +21 -0
  17. crypticorn/klines/client/configuration.py +565 -0
  18. crypticorn/klines/client/exceptions.py +216 -0
  19. crypticorn/klines/client/models/__init__.py +41 -0
  20. crypticorn/klines/client/models/base_response_health_check_response.py +108 -0
  21. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +112 -0
  22. crypticorn/klines/client/models/base_response_list_str.py +104 -0
  23. crypticorn/klines/client/models/base_response_ohlcv_response.py +108 -0
  24. crypticorn/klines/client/models/error_response.py +101 -0
  25. crypticorn/{models/deleted.py → klines/client/models/exchange.py} +15 -11
  26. crypticorn/klines/client/models/funding_rate_response.py +92 -0
  27. crypticorn/klines/client/models/health_check_response.py +89 -0
  28. crypticorn/{models/create_api_key_response.py → klines/client/models/history_error_response.py} +12 -22
  29. crypticorn/klines/client/models/history_no_data_response.py +99 -0
  30. crypticorn/klines/client/models/history_success_response.py +99 -0
  31. crypticorn/klines/client/models/http_validation_error.py +95 -0
  32. crypticorn/klines/client/models/market.py +37 -0
  33. crypticorn/klines/client/models/ohlcv_response.py +98 -0
  34. crypticorn/klines/client/models/resolution.py +40 -0
  35. crypticorn/klines/client/models/response_get_history_udf_history_get.py +149 -0
  36. crypticorn/klines/client/models/search_symbol_response.py +97 -0
  37. crypticorn/klines/client/models/sort_direction.py +37 -0
  38. crypticorn/{models/futures_balance_error.py → klines/client/models/symbol_group_response.py} +12 -14
  39. crypticorn/klines/client/models/symbol_info_response.py +115 -0
  40. crypticorn/{models/id.py → klines/client/models/symbol_type.py} +13 -11
  41. crypticorn/klines/client/models/timeframe.py +40 -0
  42. crypticorn/klines/client/models/udf_config_response.py +121 -0
  43. crypticorn/klines/client/models/validation_error.py +99 -0
  44. crypticorn/{models/get_futures_balance200_response_inner.py → klines/client/models/validation_error_loc_inner.py} +39 -35
  45. crypticorn/klines/client/py.typed +0 -0
  46. crypticorn/klines/client/rest.py +257 -0
  47. crypticorn/klines/main.py +42 -0
  48. crypticorn/klines/requirements.txt +4 -0
  49. crypticorn/klines/test/__init__.py +0 -0
  50. crypticorn/klines/test/test_base_response_health_check_response.py +56 -0
  51. crypticorn/klines/test/test_base_response_list_funding_rate_response.py +59 -0
  52. crypticorn/klines/test/test_base_response_list_str.py +56 -0
  53. crypticorn/klines/test/test_base_response_ohlcv_response.py +72 -0
  54. crypticorn/klines/test/test_error_response.py +57 -0
  55. crypticorn/klines/test/test_exchange.py +56 -0
  56. crypticorn/klines/test/test_funding_rate_response.py +56 -0
  57. crypticorn/klines/test/test_funding_rates_api.py +38 -0
  58. crypticorn/klines/test/test_health_check_api.py +38 -0
  59. crypticorn/klines/test/test_health_check_response.py +52 -0
  60. crypticorn/klines/test/test_history_error_response.py +53 -0
  61. crypticorn/klines/test/test_history_no_data_response.py +69 -0
  62. crypticorn/klines/test/test_history_success_response.py +87 -0
  63. crypticorn/klines/test/test_http_validation_error.py +58 -0
  64. crypticorn/klines/test/test_market.py +33 -0
  65. crypticorn/klines/test/test_ohlcv_data_api.py +38 -0
  66. crypticorn/klines/test/test_ohlcv_response.py +86 -0
  67. crypticorn/klines/test/test_resolution.py +33 -0
  68. crypticorn/klines/test/test_response_get_history_udf_history_get.py +89 -0
  69. crypticorn/klines/test/test_search_symbol_response.py +62 -0
  70. crypticorn/klines/test/test_sort_direction.py +33 -0
  71. crypticorn/klines/test/test_symbol_group_response.py +53 -0
  72. crypticorn/klines/test/test_symbol_info_response.py +84 -0
  73. crypticorn/klines/test/test_symbol_type.py +54 -0
  74. crypticorn/klines/test/test_symbols_api.py +38 -0
  75. crypticorn/klines/test/test_timeframe.py +33 -0
  76. crypticorn/klines/test/test_udf_api.py +80 -0
  77. crypticorn/klines/test/test_udf_config_response.py +95 -0
  78. crypticorn/klines/test/test_validation_error.py +60 -0
  79. crypticorn/klines/test/test_validation_error_loc_inner.py +50 -0
  80. crypticorn/trade/__init__.py +2 -0
  81. crypticorn/trade/client/__init__.py +63 -0
  82. crypticorn/trade/client/api/__init__.py +13 -0
  83. crypticorn/trade/client/api/api_keys_api.py +1468 -0
  84. crypticorn/trade/client/api/bots_api.py +1211 -0
  85. crypticorn/trade/client/api/exchanges_api.py +297 -0
  86. crypticorn/trade/client/api/futures_trading_panel_api.py +1463 -0
  87. crypticorn/trade/client/api/notifications_api.py +1767 -0
  88. crypticorn/trade/client/api/orders_api.py +331 -0
  89. crypticorn/trade/client/api/status_api.py +278 -0
  90. crypticorn/trade/client/api/strategies_api.py +331 -0
  91. crypticorn/trade/client/api/trading_actions_api.py +898 -0
  92. crypticorn/trade/client/api_client.py +797 -0
  93. crypticorn/trade/client/api_response.py +21 -0
  94. crypticorn/trade/client/configuration.py +574 -0
  95. crypticorn/trade/client/exceptions.py +216 -0
  96. crypticorn/trade/client/models/__init__.py +38 -0
  97. crypticorn/{models → trade/client/models}/action_model.py +17 -20
  98. crypticorn/{models → trade/client/models}/api_error_identifier.py +3 -1
  99. crypticorn/{models → trade/client/models}/api_key_model.py +5 -8
  100. crypticorn/{models → trade/client/models}/bot_model.py +15 -11
  101. crypticorn/{models → trade/client/models}/futures_trading_action.py +12 -12
  102. crypticorn/{models → trade/client/models}/http_validation_error.py +1 -1
  103. crypticorn/{models → trade/client/models}/notification_model.py +8 -6
  104. crypticorn/{models → trade/client/models}/order_model.py +12 -15
  105. crypticorn/{models → trade/client/models}/post_futures_action.py +1 -1
  106. crypticorn/{models → trade/client/models}/strategy_exchange_info.py +1 -1
  107. crypticorn/{models → trade/client/models}/strategy_model.py +6 -2
  108. crypticorn/{models → trade/client/models}/validation_error.py +1 -1
  109. crypticorn/trade/client/py.typed +0 -0
  110. crypticorn/trade/client/rest.py +257 -0
  111. crypticorn/trade/main.py +39 -0
  112. crypticorn/trade/requirements.txt +4 -0
  113. crypticorn-1.0.2rc2.dist-info/METADATA +47 -0
  114. crypticorn-1.0.2rc2.dist-info/RECORD +128 -0
  115. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/WHEEL +1 -1
  116. crypticorn/models/__init__.py +0 -31
  117. crypticorn/models/modified.py +0 -87
  118. crypticorn-1.0.1.dist-info/METADATA +0 -40
  119. crypticorn-1.0.1.dist-info/RECORD +0 -38
  120. /crypticorn/{models → trade/client/models}/exchange.py +0 -0
  121. /crypticorn/{models → trade/client/models}/execution_ids.py +0 -0
  122. /crypticorn/{models → trade/client/models}/futures_balance.py +0 -0
  123. /crypticorn/{models → trade/client/models}/margin_mode.py +0 -0
  124. /crypticorn/{models → trade/client/models}/market_type.py +0 -0
  125. /crypticorn/{models → trade/client/models}/notification_type.py +0 -0
  126. /crypticorn/{models → trade/client/models}/order_status.py +0 -0
  127. /crypticorn/{models → trade/client/models}/tpsl.py +0 -0
  128. /crypticorn/{models → trade/client/models}/trading_action_type.py +0 -0
  129. /crypticorn/{models → trade/client/models}/update_notification.py +0 -0
  130. /crypticorn/{models → trade/client/models}/validation_error_loc_inner.py +0 -0
  131. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/LICENSE.md +0 -0
  132. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,216 @@
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
+ from typing import Any, Optional
15
+ from typing_extensions import Self
16
+
17
+ class OpenApiException(Exception):
18
+ """The base exception class for all OpenAPIExceptions"""
19
+
20
+
21
+ class ApiTypeError(OpenApiException, TypeError):
22
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
23
+ key_type=None) -> None:
24
+ """ Raises an exception for TypeErrors
25
+
26
+ Args:
27
+ msg (str): the exception message
28
+
29
+ Keyword Args:
30
+ path_to_item (list): a list of keys an indices to get to the
31
+ current_item
32
+ None if unset
33
+ valid_classes (tuple): the primitive classes that current item
34
+ should be an instance of
35
+ None if unset
36
+ key_type (bool): False if our value is a value in a dict
37
+ True if it is a key in a dict
38
+ False if our item is an item in a list
39
+ None if unset
40
+ """
41
+ self.path_to_item = path_to_item
42
+ self.valid_classes = valid_classes
43
+ self.key_type = key_type
44
+ full_msg = msg
45
+ if path_to_item:
46
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
47
+ super(ApiTypeError, self).__init__(full_msg)
48
+
49
+
50
+ class ApiValueError(OpenApiException, ValueError):
51
+ def __init__(self, msg, path_to_item=None) -> None:
52
+ """
53
+ Args:
54
+ msg (str): the exception message
55
+
56
+ Keyword Args:
57
+ path_to_item (list) the path to the exception in the
58
+ received_data dict. None if unset
59
+ """
60
+
61
+ self.path_to_item = path_to_item
62
+ full_msg = msg
63
+ if path_to_item:
64
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
65
+ super(ApiValueError, self).__init__(full_msg)
66
+
67
+
68
+ class ApiAttributeError(OpenApiException, AttributeError):
69
+ def __init__(self, msg, path_to_item=None) -> None:
70
+ """
71
+ Raised when an attribute reference or assignment fails.
72
+
73
+ Args:
74
+ msg (str): the exception message
75
+
76
+ Keyword Args:
77
+ path_to_item (None/list) the path to the exception in the
78
+ received_data dict
79
+ """
80
+ self.path_to_item = path_to_item
81
+ full_msg = msg
82
+ if path_to_item:
83
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
84
+ super(ApiAttributeError, self).__init__(full_msg)
85
+
86
+
87
+ class ApiKeyError(OpenApiException, KeyError):
88
+ def __init__(self, msg, path_to_item=None) -> None:
89
+ """
90
+ Args:
91
+ msg (str): the exception message
92
+
93
+ Keyword Args:
94
+ path_to_item (None/list) the path to the exception in the
95
+ received_data dict
96
+ """
97
+ self.path_to_item = path_to_item
98
+ full_msg = msg
99
+ if path_to_item:
100
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
101
+ super(ApiKeyError, self).__init__(full_msg)
102
+
103
+
104
+ class ApiException(OpenApiException):
105
+
106
+ def __init__(
107
+ self,
108
+ status=None,
109
+ reason=None,
110
+ http_resp=None,
111
+ *,
112
+ body: Optional[str] = None,
113
+ data: Optional[Any] = None,
114
+ ) -> None:
115
+ self.status = status
116
+ self.reason = reason
117
+ self.body = body
118
+ self.data = data
119
+ self.headers = None
120
+
121
+ if http_resp:
122
+ if self.status is None:
123
+ self.status = http_resp.status
124
+ if self.reason is None:
125
+ self.reason = http_resp.reason
126
+ if self.body is None:
127
+ try:
128
+ self.body = http_resp.data.decode('utf-8')
129
+ except Exception:
130
+ pass
131
+ self.headers = http_resp.getheaders()
132
+
133
+ @classmethod
134
+ def from_response(
135
+ cls,
136
+ *,
137
+ http_resp,
138
+ body: Optional[str],
139
+ data: Optional[Any],
140
+ ) -> Self:
141
+ if http_resp.status == 400:
142
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
143
+
144
+ if http_resp.status == 401:
145
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
146
+
147
+ if http_resp.status == 403:
148
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
149
+
150
+ if http_resp.status == 404:
151
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
+
153
+ # Added new conditions for 409 and 422
154
+ if http_resp.status == 409:
155
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
156
+
157
+ if http_resp.status == 422:
158
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
+
160
+ if 500 <= http_resp.status <= 599:
161
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
162
+ raise ApiException(http_resp=http_resp, body=body, data=data)
163
+
164
+ def __str__(self):
165
+ """Custom error messages for exception"""
166
+ error_message = "({0})\n"\
167
+ "Reason: {1}\n".format(self.status, self.reason)
168
+ if self.headers:
169
+ error_message += "HTTP response headers: {0}\n".format(
170
+ self.headers)
171
+
172
+ if self.data or self.body:
173
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
174
+
175
+ return error_message
176
+
177
+
178
+ class BadRequestException(ApiException):
179
+ pass
180
+
181
+
182
+ class NotFoundException(ApiException):
183
+ pass
184
+
185
+
186
+ class UnauthorizedException(ApiException):
187
+ pass
188
+
189
+
190
+ class ForbiddenException(ApiException):
191
+ pass
192
+
193
+
194
+ class ServiceException(ApiException):
195
+ pass
196
+
197
+
198
+ class ConflictException(ApiException):
199
+ """Exception for HTTP 409 Conflict."""
200
+ pass
201
+
202
+
203
+ class UnprocessableEntityException(ApiException):
204
+ """Exception for HTTP 422 Unprocessable Entity."""
205
+ pass
206
+
207
+
208
+ def render_path(path_to_item):
209
+ """Returns a string representation of a path"""
210
+ result = ""
211
+ for pth in path_to_item:
212
+ if isinstance(pth, int):
213
+ result += "[{0}]".format(pth)
214
+ else:
215
+ result += "['{0}']".format(pth)
216
+ return result
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ FastAPI
6
+
7
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+
9
+ The version of the OpenAPI document: 0.1.0
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from crypticorn.trade.client.models.api_key_model import APIKeyModel
18
+ from crypticorn.trade.client.models.action_model import ActionModel
19
+ from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
20
+ from crypticorn.trade.client.models.bot_model import BotModel
21
+ from crypticorn.trade.client.models.exchange import Exchange
22
+ from crypticorn.trade.client.models.execution_ids import ExecutionIds
23
+ from crypticorn.trade.client.models.futures_balance import FuturesBalance
24
+ from crypticorn.trade.client.models.futures_trading_action import FuturesTradingAction
25
+ from crypticorn.trade.client.models.http_validation_error import HTTPValidationError
26
+ from crypticorn.trade.client.models.margin_mode import MarginMode
27
+ from crypticorn.trade.client.models.market_type import MarketType
28
+ from crypticorn.trade.client.models.notification_model import NotificationModel
29
+ from crypticorn.trade.client.models.notification_type import NotificationType
30
+ from crypticorn.trade.client.models.order_model import OrderModel
31
+ from crypticorn.trade.client.models.order_status import OrderStatus
32
+ from crypticorn.trade.client.models.post_futures_action import PostFuturesAction
33
+ from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
34
+ from crypticorn.trade.client.models.strategy_model import StrategyModel
35
+ from crypticorn.trade.client.models.tpsl import TPSL
36
+ from crypticorn.trade.client.models.trading_action_type import TradingActionType
37
+ from crypticorn.trade.client.models.validation_error import ValidationError
38
+ from crypticorn.trade.client.models.validation_error_loc_inner import ValidationErrorLocInner
@@ -20,10 +20,10 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
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
23
+ from crypticorn.trade.client.models.margin_mode import MarginMode
24
+ from crypticorn.trade.client.models.market_type import MarketType
25
+ from crypticorn.trade.client.models.tpsl import TPSL
26
+ from crypticorn.trade.client.models.trading_action_type import TradingActionType
27
27
  from typing import Optional, Set
28
28
  from typing_extensions import Self
29
29
 
@@ -31,10 +31,11 @@ class ActionModel(BaseModel):
31
31
  """
32
32
  ActionModel
33
33
  """ # noqa: E501
34
+ created_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of creation")
35
+ updated_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of last update")
34
36
  id: Optional[StrictStr] = None
35
37
  execution_id: Optional[StrictStr] = None
36
38
  open_order_execution_id: Optional[StrictStr] = None
37
- position_id: Optional[StrictStr] = None
38
39
  client_order_id: Optional[StrictStr] = None
39
40
  action_type: TradingActionType = Field(description="The type of action.")
40
41
  market_type: MarketType = Field(description="The type of market the action is for.")
@@ -46,10 +47,10 @@ class ActionModel(BaseModel):
46
47
  take_profit: Optional[List[TPSL]] = None
47
48
  stop_loss: Optional[List[TPSL]] = None
48
49
  expiry_timestamp: Optional[StrictInt] = None
50
+ position_id: Optional[StrictStr] = None
49
51
  leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
50
52
  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
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "execution_id", "open_order_execution_id", "client_order_id", "action_type", "market_type", "strategy_id", "symbol", "is_limit", "limit_price", "allocation", "take_profit", "stop_loss", "expiry_timestamp", "position_id", "leverage", "margin_mode"]
53
54
 
54
55
  model_config = ConfigDict(
55
56
  populate_by_name=True,
@@ -119,11 +120,6 @@ class ActionModel(BaseModel):
119
120
  if self.open_order_execution_id is None and "open_order_execution_id" in self.model_fields_set:
120
121
  _dict['open_order_execution_id'] = None
121
122
 
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
123
  # set to None if client_order_id (nullable) is None
128
124
  # and model_fields_set contains the field
129
125
  if self.client_order_id is None and "client_order_id" in self.model_fields_set:
@@ -154,6 +150,11 @@ class ActionModel(BaseModel):
154
150
  if self.expiry_timestamp is None and "expiry_timestamp" in self.model_fields_set:
155
151
  _dict['expiry_timestamp'] = None
156
152
 
153
+ # set to None if position_id (nullable) is None
154
+ # and model_fields_set contains the field
155
+ if self.position_id is None and "position_id" in self.model_fields_set:
156
+ _dict['position_id'] = None
157
+
157
158
  # set to None if leverage (nullable) is None
158
159
  # and model_fields_set contains the field
159
160
  if self.leverage is None and "leverage" in self.model_fields_set:
@@ -164,11 +165,6 @@ class ActionModel(BaseModel):
164
165
  if self.margin_mode is None and "margin_mode" in self.model_fields_set:
165
166
  _dict['margin_mode'] = None
166
167
 
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
168
  return _dict
173
169
 
174
170
  @classmethod
@@ -181,10 +177,11 @@ class ActionModel(BaseModel):
181
177
  return cls.model_validate(obj)
182
178
 
183
179
  _obj = cls.model_validate({
180
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742386800,
181
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742386800,
184
182
  "id": obj.get("id"),
185
183
  "execution_id": obj.get("execution_id"),
186
184
  "open_order_execution_id": obj.get("open_order_execution_id"),
187
- "position_id": obj.get("position_id"),
188
185
  "client_order_id": obj.get("client_order_id"),
189
186
  "action_type": obj.get("action_type"),
190
187
  "market_type": obj.get("market_type"),
@@ -196,9 +193,9 @@ class ActionModel(BaseModel):
196
193
  "take_profit": [TPSL.from_dict(_item) for _item in obj["take_profit"]] if obj.get("take_profit") is not None else None,
197
194
  "stop_loss": [TPSL.from_dict(_item) for _item in obj["stop_loss"]] if obj.get("stop_loss") is not None else None,
198
195
  "expiry_timestamp": obj.get("expiry_timestamp"),
196
+ "position_id": obj.get("position_id"),
199
197
  "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")
198
+ "margin_mode": obj.get("margin_mode")
202
199
  })
203
200
  return _obj
204
201
 
@@ -68,10 +68,12 @@ class ApiErrorIdentifier(str, Enum):
68
68
  BLACK_SWAN = 'black_swan'
69
69
  TRADING_ACTION_EXPIRED = 'trading_action_expired'
70
70
  BOT_DISABLED = 'bot_disabled'
71
- NEW_TRADING_ACTION = 'new_trading_action'
72
71
  ORDER_SIZE_TOO_SMALL = 'order_size_too_small'
73
72
  ORDER_SIZE_TOO_LARGE = 'order_size_too_large'
74
73
  HEDGE_MODE_NOT_ACTIVE = 'hedge_mode_not_active'
74
+ API_KEY_ALREADY_EXISTS = 'api_key_already_exists'
75
+ DELETE_BOT_ERROR = 'delete_bot_error'
76
+ JWT_EXPIRED = 'jwt_expired'
75
77
 
76
78
  @classmethod
77
79
  def from_json(cls, json_str: str) -> Self:
@@ -26,6 +26,8 @@ class APIKeyModel(BaseModel):
26
26
  """
27
27
  APIKeyModel
28
28
  """ # noqa: E501
29
+ created_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of creation")
30
+ updated_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of last update")
29
31
  id: Optional[StrictStr] = None
30
32
  exchange: StrictStr = Field(description="Exchange name")
31
33
  api_key: Optional[StrictStr] = None
@@ -33,9 +35,8 @@ class APIKeyModel(BaseModel):
33
35
  passphrase: Optional[StrictStr] = None
34
36
  label: StrictStr = Field(description="Label for the API key")
35
37
  enabled: Optional[StrictBool] = None
36
- created_at: Optional[StrictInt] = None
37
38
  user_id: Optional[StrictStr] = None
38
- __properties: ClassVar[List[str]] = ["id", "exchange", "api_key", "secret", "passphrase", "label", "enabled", "created_at", "user_id"]
39
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "exchange", "api_key", "secret", "passphrase", "label", "enabled", "user_id"]
39
40
 
40
41
  model_config = ConfigDict(
41
42
  populate_by_name=True,
@@ -101,11 +102,6 @@ class APIKeyModel(BaseModel):
101
102
  if self.enabled is None and "enabled" in self.model_fields_set:
102
103
  _dict['enabled'] = None
103
104
 
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
105
  # set to None if user_id (nullable) is None
110
106
  # and model_fields_set contains the field
111
107
  if self.user_id is None and "user_id" in self.model_fields_set:
@@ -123,6 +119,8 @@ class APIKeyModel(BaseModel):
123
119
  return cls.model_validate(obj)
124
120
 
125
121
  _obj = cls.model_validate({
122
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742386800,
123
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742386800,
126
124
  "id": obj.get("id"),
127
125
  "exchange": obj.get("exchange"),
128
126
  "api_key": obj.get("api_key"),
@@ -130,7 +128,6 @@ class APIKeyModel(BaseModel):
130
128
  "passphrase": obj.get("passphrase"),
131
129
  "label": obj.get("label"),
132
130
  "enabled": obj.get("enabled"),
133
- "created_at": obj.get("created_at"),
134
131
  "user_id": obj.get("user_id")
135
132
  })
136
133
  return _obj
@@ -26,16 +26,18 @@ class BotModel(BaseModel):
26
26
  """
27
27
  BotModel
28
28
  """ # noqa: E501
29
+ created_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of creation")
30
+ updated_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of last update")
29
31
  id: Optional[StrictStr] = None
30
32
  name: StrictStr = Field(description="Name of the bot")
31
33
  strategy_id: StrictStr = Field(description="UID for the trading strategy used by the bot")
32
34
  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
+ allocation: StrictInt = Field(description="Initial allocation for the bot")
35
36
  enabled: StrictBool = Field(description="Status of the bot")
36
37
  deleted: Optional[StrictBool] = Field(default=False, description="Whether the bot has been deleted")
37
38
  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
+ current_allocation: Optional[Union[StrictFloat, StrictInt]] = None
40
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "name", "strategy_id", "api_key_id", "allocation", "enabled", "deleted", "user_id", "current_allocation"]
39
41
 
40
42
  model_config = ConfigDict(
41
43
  populate_by_name=True,
@@ -81,16 +83,16 @@ class BotModel(BaseModel):
81
83
  if self.id is None and "id" in self.model_fields_set:
82
84
  _dict['id'] = None
83
85
 
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
86
  # set to None if user_id (nullable) is None
90
87
  # and model_fields_set contains the field
91
88
  if self.user_id is None and "user_id" in self.model_fields_set:
92
89
  _dict['user_id'] = None
93
90
 
91
+ # set to None if current_allocation (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.current_allocation is None and "current_allocation" in self.model_fields_set:
94
+ _dict['current_allocation'] = None
95
+
94
96
  return _dict
95
97
 
96
98
  @classmethod
@@ -103,15 +105,17 @@ class BotModel(BaseModel):
103
105
  return cls.model_validate(obj)
104
106
 
105
107
  _obj = cls.model_validate({
108
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742386800,
109
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742386800,
106
110
  "id": obj.get("id"),
107
111
  "name": obj.get("name"),
108
112
  "strategy_id": obj.get("strategy_id"),
109
113
  "api_key_id": obj.get("api_key_id"),
110
- "initial_allocation": obj.get("initial_allocation"),
111
- "current_allocation": obj.get("current_allocation"),
114
+ "allocation": obj.get("allocation"),
112
115
  "enabled": obj.get("enabled"),
113
116
  "deleted": obj.get("deleted") if obj.get("deleted") is not None else False,
114
- "user_id": obj.get("user_id")
117
+ "user_id": obj.get("user_id"),
118
+ "current_allocation": obj.get("current_allocation")
115
119
  })
116
120
  return _obj
117
121
 
@@ -20,10 +20,10 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
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
23
+ from crypticorn.trade.client.models.margin_mode import MarginMode
24
+ from crypticorn.trade.client.models.market_type import MarketType
25
+ from crypticorn.trade.client.models.tpsl import TPSL
26
+ from crypticorn.trade.client.models.trading_action_type import TradingActionType
27
27
  from typing import Optional, Set
28
28
  from typing_extensions import Self
29
29
 
@@ -34,7 +34,6 @@ class FuturesTradingAction(BaseModel):
34
34
  id: Optional[StrictStr] = None
35
35
  execution_id: Optional[StrictStr] = None
36
36
  open_order_execution_id: Optional[StrictStr] = None
37
- position_id: Optional[StrictStr] = None
38
37
  client_order_id: Optional[StrictStr] = None
39
38
  action_type: TradingActionType = Field(description="The type of action.")
40
39
  market_type: MarketType = Field(description="The type of market the action is for.")
@@ -46,9 +45,10 @@ class FuturesTradingAction(BaseModel):
46
45
  take_profit: Optional[List[TPSL]] = None
47
46
  stop_loss: Optional[List[TPSL]] = None
48
47
  expiry_timestamp: Optional[StrictInt] = None
48
+ position_id: Optional[StrictStr] = None
49
49
  leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
50
50
  margin_mode: Optional[MarginMode] = None
51
- __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"]
51
+ __properties: ClassVar[List[str]] = ["id", "execution_id", "open_order_execution_id", "client_order_id", "action_type", "market_type", "strategy_id", "symbol", "is_limit", "limit_price", "allocation", "take_profit", "stop_loss", "expiry_timestamp", "position_id", "leverage", "margin_mode"]
52
52
 
53
53
  model_config = ConfigDict(
54
54
  populate_by_name=True,
@@ -118,11 +118,6 @@ class FuturesTradingAction(BaseModel):
118
118
  if self.open_order_execution_id is None and "open_order_execution_id" in self.model_fields_set:
119
119
  _dict['open_order_execution_id'] = None
120
120
 
121
- # set to None if position_id (nullable) is None
122
- # and model_fields_set contains the field
123
- if self.position_id is None and "position_id" in self.model_fields_set:
124
- _dict['position_id'] = None
125
-
126
121
  # set to None if client_order_id (nullable) is None
127
122
  # and model_fields_set contains the field
128
123
  if self.client_order_id is None and "client_order_id" in self.model_fields_set:
@@ -153,6 +148,11 @@ class FuturesTradingAction(BaseModel):
153
148
  if self.expiry_timestamp is None and "expiry_timestamp" in self.model_fields_set:
154
149
  _dict['expiry_timestamp'] = None
155
150
 
151
+ # set to None if position_id (nullable) is None
152
+ # and model_fields_set contains the field
153
+ if self.position_id is None and "position_id" in self.model_fields_set:
154
+ _dict['position_id'] = None
155
+
156
156
  # set to None if leverage (nullable) is None
157
157
  # and model_fields_set contains the field
158
158
  if self.leverage is None and "leverage" in self.model_fields_set:
@@ -178,7 +178,6 @@ class FuturesTradingAction(BaseModel):
178
178
  "id": obj.get("id"),
179
179
  "execution_id": obj.get("execution_id"),
180
180
  "open_order_execution_id": obj.get("open_order_execution_id"),
181
- "position_id": obj.get("position_id"),
182
181
  "client_order_id": obj.get("client_order_id"),
183
182
  "action_type": obj.get("action_type"),
184
183
  "market_type": obj.get("market_type"),
@@ -190,6 +189,7 @@ class FuturesTradingAction(BaseModel):
190
189
  "take_profit": [TPSL.from_dict(_item) for _item in obj["take_profit"]] if obj.get("take_profit") is not None else None,
191
190
  "stop_loss": [TPSL.from_dict(_item) for _item in obj["stop_loss"]] if obj.get("stop_loss") is not None else None,
192
191
  "expiry_timestamp": obj.get("expiry_timestamp"),
192
+ "position_id": obj.get("position_id"),
193
193
  "leverage": obj.get("leverage") if obj.get("leverage") is not None else 1,
194
194
  "margin_mode": obj.get("margin_mode")
195
195
  })
@@ -19,7 +19,7 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from crypticorn.models.validation_error import ValidationError
22
+ from crypticorn.trade.client.models.validation_error import ValidationError
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
@@ -19,8 +19,8 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from crypticorn.models.api_error_identifier import ApiErrorIdentifier
23
- from crypticorn.models.notification_type import NotificationType
22
+ from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
23
+ from crypticorn.trade.client.models.notification_type import NotificationType
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
 
@@ -28,14 +28,15 @@ class NotificationModel(BaseModel):
28
28
  """
29
29
  NotificationModel
30
30
  """ # noqa: E501
31
+ created_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of creation")
32
+ updated_at: Optional[StrictInt] = Field(default=1742386800, description="Timestamp of last update")
31
33
  id: Optional[StrictStr] = None
32
34
  identifier: ApiErrorIdentifier = Field(description="Identifier string. Must match the mapping key in the frontend.")
33
35
  user_id: Optional[StrictStr] = None
34
36
  viewed: Optional[StrictBool] = Field(default=False, description="Whether the notification has been marked as seen")
35
37
  sent: Optional[StrictBool] = Field(default=False, description="Whether the notification has been sent as an email")
36
38
  type: NotificationType = Field(description="The type of the notification.")
37
- timestamp: Optional[StrictInt] = Field(default=1741716883, description="Timestamp of creation")
38
- __properties: ClassVar[List[str]] = ["id", "identifier", "user_id", "viewed", "sent", "type", "timestamp"]
39
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "identifier", "user_id", "viewed", "sent", "type"]
39
40
 
40
41
  model_config = ConfigDict(
41
42
  populate_by_name=True,
@@ -98,13 +99,14 @@ class NotificationModel(BaseModel):
98
99
  return cls.model_validate(obj)
99
100
 
100
101
  _obj = cls.model_validate({
102
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742386800,
103
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742386800,
101
104
  "id": obj.get("id"),
102
105
  "identifier": obj.get("identifier"),
103
106
  "user_id": obj.get("user_id"),
104
107
  "viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
105
108
  "sent": obj.get("sent") if obj.get("sent") is not None else False,
106
- "type": obj.get("type"),
107
- "timestamp": obj.get("timestamp") if obj.get("timestamp") is not None else 1741716883
109
+ "type": obj.get("type")
108
110
  })
109
111
  return _obj
110
112