crypticorn 1.0.0__py3-none-any.whl → 1.0.2rc1__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 (160) hide show
  1. crypticorn/__init__.py +3 -3
  2. crypticorn/client.py +722 -0
  3. crypticorn/{api.py → hive/main.py} +6 -6
  4. crypticorn/hive/requirements.txt +4 -0
  5. crypticorn/{utils.py → hive/utils.py} +2 -2
  6. crypticorn/klines/client/__init__.py +62 -0
  7. crypticorn/klines/client/api/__init__.py +9 -0
  8. crypticorn/klines/client/api/funding_rates_api.py +362 -0
  9. crypticorn/klines/client/api/health_check_api.py +281 -0
  10. crypticorn/klines/client/api/ohlcv_data_api.py +409 -0
  11. crypticorn/klines/client/api/symbols_api.py +308 -0
  12. crypticorn/klines/client/api/udf_api.py +1929 -0
  13. crypticorn/klines/client/api_client.py +797 -0
  14. crypticorn/klines/client/api_response.py +21 -0
  15. crypticorn/klines/client/configuration.py +565 -0
  16. crypticorn/klines/client/exceptions.py +216 -0
  17. crypticorn/klines/client/models/__init__.py +41 -0
  18. crypticorn/klines/client/models/base_response_health_check_response.py +108 -0
  19. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +112 -0
  20. crypticorn/klines/client/models/base_response_list_str.py +104 -0
  21. crypticorn/klines/client/models/base_response_ohlcv_response.py +108 -0
  22. crypticorn/klines/client/models/error_response.py +101 -0
  23. crypticorn/klines/client/models/exchange.py +91 -0
  24. crypticorn/klines/client/models/funding_rate_response.py +92 -0
  25. crypticorn/klines/client/models/health_check_response.py +89 -0
  26. crypticorn/klines/client/models/history_error_response.py +89 -0
  27. crypticorn/klines/client/models/history_no_data_response.py +99 -0
  28. crypticorn/klines/client/models/history_success_response.py +99 -0
  29. crypticorn/klines/client/models/http_validation_error.py +95 -0
  30. crypticorn/klines/client/models/market.py +37 -0
  31. crypticorn/klines/client/models/ohlcv_response.py +98 -0
  32. crypticorn/klines/client/models/resolution.py +40 -0
  33. crypticorn/klines/client/models/response_get_history_udf_history_get.py +149 -0
  34. crypticorn/klines/client/models/search_symbol_response.py +97 -0
  35. crypticorn/klines/client/models/sort_direction.py +37 -0
  36. crypticorn/klines/client/models/symbol_group_response.py +87 -0
  37. crypticorn/klines/client/models/symbol_info_response.py +115 -0
  38. crypticorn/klines/client/models/symbol_type.py +89 -0
  39. crypticorn/klines/client/models/timeframe.py +40 -0
  40. crypticorn/klines/client/models/udf_config_response.py +121 -0
  41. crypticorn/klines/client/models/validation_error.py +99 -0
  42. crypticorn/klines/client/models/validation_error_loc_inner.py +138 -0
  43. crypticorn/klines/client/py.typed +0 -0
  44. crypticorn/klines/client/rest.py +257 -0
  45. crypticorn/klines/main.py +42 -0
  46. crypticorn/klines/requirements.txt +4 -0
  47. crypticorn/klines/test/__init__.py +0 -0
  48. crypticorn/klines/test/test_base_response_health_check_response.py +56 -0
  49. crypticorn/klines/test/test_base_response_list_funding_rate_response.py +59 -0
  50. crypticorn/klines/test/test_base_response_list_str.py +56 -0
  51. crypticorn/klines/test/test_base_response_ohlcv_response.py +72 -0
  52. crypticorn/klines/test/test_error_response.py +57 -0
  53. crypticorn/klines/test/test_exchange.py +56 -0
  54. crypticorn/klines/test/test_funding_rate_response.py +56 -0
  55. crypticorn/klines/test/test_funding_rates_api.py +38 -0
  56. crypticorn/klines/test/test_health_check_api.py +38 -0
  57. crypticorn/klines/test/test_health_check_response.py +52 -0
  58. crypticorn/klines/test/test_history_error_response.py +53 -0
  59. crypticorn/klines/test/test_history_no_data_response.py +69 -0
  60. crypticorn/klines/test/test_history_success_response.py +87 -0
  61. crypticorn/klines/test/test_http_validation_error.py +58 -0
  62. crypticorn/klines/test/test_market.py +33 -0
  63. crypticorn/klines/test/test_ohlcv_data_api.py +38 -0
  64. crypticorn/klines/test/test_ohlcv_response.py +86 -0
  65. crypticorn/klines/test/test_resolution.py +33 -0
  66. crypticorn/klines/test/test_response_get_history_udf_history_get.py +89 -0
  67. crypticorn/klines/test/test_search_symbol_response.py +62 -0
  68. crypticorn/klines/test/test_sort_direction.py +33 -0
  69. crypticorn/klines/test/test_symbol_group_response.py +53 -0
  70. crypticorn/klines/test/test_symbol_info_response.py +84 -0
  71. crypticorn/klines/test/test_symbol_type.py +54 -0
  72. crypticorn/klines/test/test_symbols_api.py +38 -0
  73. crypticorn/klines/test/test_timeframe.py +33 -0
  74. crypticorn/klines/test/test_udf_api.py +80 -0
  75. crypticorn/klines/test/test_udf_config_response.py +95 -0
  76. crypticorn/klines/test/test_validation_error.py +60 -0
  77. crypticorn/klines/test/test_validation_error_loc_inner.py +50 -0
  78. crypticorn/trade/client/__init__.py +63 -0
  79. crypticorn/trade/client/api/__init__.py +13 -0
  80. crypticorn/trade/client/api/api_keys_api.py +1468 -0
  81. crypticorn/trade/client/api/bots_api.py +1211 -0
  82. crypticorn/trade/client/api/exchanges_api.py +297 -0
  83. crypticorn/trade/client/api/futures_trading_panel_api.py +1463 -0
  84. crypticorn/trade/client/api/notifications_api.py +1767 -0
  85. crypticorn/trade/client/api/orders_api.py +331 -0
  86. crypticorn/trade/client/api/status_api.py +278 -0
  87. crypticorn/trade/client/api/strategies_api.py +331 -0
  88. crypticorn/trade/client/api/trading_actions_api.py +898 -0
  89. crypticorn/trade/client/api_client.py +797 -0
  90. crypticorn/trade/client/api_response.py +21 -0
  91. crypticorn/trade/client/configuration.py +574 -0
  92. crypticorn/trade/client/exceptions.py +216 -0
  93. crypticorn/trade/client/models/__init__.py +38 -0
  94. crypticorn/trade/client/models/action_model.py +202 -0
  95. crypticorn/trade/client/models/api_error_identifier.py +83 -0
  96. crypticorn/trade/client/models/api_key_model.py +135 -0
  97. crypticorn/trade/client/models/bot_model.py +122 -0
  98. crypticorn/trade/client/models/exchange.py +37 -0
  99. crypticorn/trade/client/models/execution_ids.py +91 -0
  100. crypticorn/trade/client/models/futures_balance.py +109 -0
  101. crypticorn/trade/client/models/futures_trading_action.py +198 -0
  102. crypticorn/trade/client/models/http_validation_error.py +95 -0
  103. crypticorn/trade/client/models/margin_mode.py +37 -0
  104. crypticorn/trade/client/models/market_type.py +37 -0
  105. crypticorn/trade/client/models/notification_model.py +113 -0
  106. crypticorn/trade/client/models/notification_type.py +39 -0
  107. crypticorn/trade/client/models/order_model.py +263 -0
  108. crypticorn/trade/client/models/order_status.py +40 -0
  109. crypticorn/trade/client/models/post_futures_action.py +93 -0
  110. crypticorn/trade/client/models/strategy_exchange_info.py +90 -0
  111. crypticorn/trade/client/models/strategy_model.py +119 -0
  112. crypticorn/trade/client/models/tpsl.py +116 -0
  113. crypticorn/trade/client/models/trading_action_type.py +39 -0
  114. crypticorn/trade/client/models/update_notification.py +91 -0
  115. crypticorn/trade/client/models/validation_error.py +99 -0
  116. crypticorn/trade/client/models/validation_error_loc_inner.py +138 -0
  117. crypticorn/trade/client/py.typed +0 -0
  118. crypticorn/trade/client/rest.py +257 -0
  119. crypticorn/trade/main.py +38 -0
  120. crypticorn/trade/requirements.txt +4 -0
  121. crypticorn/trade/test/__init__.py +0 -0
  122. crypticorn/trade/test/test_action_model.py +87 -0
  123. crypticorn/trade/test/test_api_error_identifier.py +33 -0
  124. crypticorn/trade/test/test_api_key_model.py +61 -0
  125. crypticorn/trade/test/test_api_keys_api.py +66 -0
  126. crypticorn/trade/test/test_bot_model.py +64 -0
  127. crypticorn/trade/test/test_bots_api.py +59 -0
  128. crypticorn/trade/test/test_exchange.py +33 -0
  129. crypticorn/trade/test/test_exchanges_api.py +38 -0
  130. crypticorn/trade/test/test_execution_ids.py +68 -0
  131. crypticorn/trade/test/test_futures_balance.py +62 -0
  132. crypticorn/trade/test/test_futures_trading_action.py +86 -0
  133. crypticorn/trade/test/test_futures_trading_panel_api.py +66 -0
  134. crypticorn/trade/test/test_http_validation_error.py +58 -0
  135. crypticorn/trade/test/test_margin_mode.py +33 -0
  136. crypticorn/trade/test/test_market_type.py +33 -0
  137. crypticorn/trade/test/test_notification_model.py +59 -0
  138. crypticorn/trade/test/test_notification_type.py +33 -0
  139. crypticorn/trade/test/test_notifications_api.py +73 -0
  140. crypticorn/trade/test/test_order_model.py +75 -0
  141. crypticorn/trade/test/test_order_status.py +33 -0
  142. crypticorn/trade/test/test_orders_api.py +38 -0
  143. crypticorn/trade/test/test_post_futures_action.py +72 -0
  144. crypticorn/trade/test/test_status_api.py +38 -0
  145. crypticorn/trade/test/test_strategies_api.py +38 -0
  146. crypticorn/trade/test/test_strategy_exchange_info.py +54 -0
  147. crypticorn/trade/test/test_strategy_model.py +73 -0
  148. crypticorn/trade/test/test_tpsl.py +56 -0
  149. crypticorn/trade/test/test_trading_action_type.py +33 -0
  150. crypticorn/trade/test/test_trading_actions_api.py +52 -0
  151. crypticorn/trade/test/test_update_notification.py +54 -0
  152. crypticorn/trade/test/test_validation_error.py +60 -0
  153. crypticorn/trade/test/test_validation_error_loc_inner.py +50 -0
  154. crypticorn-1.0.2rc1.dist-info/METADATA +47 -0
  155. crypticorn-1.0.2rc1.dist-info/RECORD +158 -0
  156. {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/WHEEL +1 -1
  157. crypticorn-1.0.0.dist-info/METADATA +0 -34
  158. crypticorn-1.0.0.dist-info/RECORD +0 -8
  159. {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/LICENSE.md +0 -0
  160. {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,37 @@
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 MarketType(str, Enum):
22
+ """
23
+ Type of market
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ SPOT = 'spot'
30
+ FUTURES = 'futures'
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> Self:
34
+ """Create an instance of MarketType from a JSON string"""
35
+ return cls(json.loads(json_str))
36
+
37
+
@@ -0,0 +1,113 @@
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 crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
23
+ from crypticorn.trade.client.models.notification_type import NotificationType
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class NotificationModel(BaseModel):
28
+ """
29
+ NotificationModel
30
+ """ # noqa: E501
31
+ created_at: Optional[StrictInt] = Field(default=1742340838, description="Timestamp of creation")
32
+ updated_at: Optional[StrictInt] = Field(default=1742340838, description="Timestamp of last update")
33
+ id: Optional[StrictStr] = None
34
+ identifier: ApiErrorIdentifier = Field(description="Identifier string. Must match the mapping key in the frontend.")
35
+ user_id: Optional[StrictStr] = None
36
+ viewed: Optional[StrictBool] = Field(default=False, description="Whether the notification has been marked as seen")
37
+ sent: Optional[StrictBool] = Field(default=False, description="Whether the notification has been sent as an email")
38
+ type: NotificationType = Field(description="The type of the notification.")
39
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "identifier", "user_id", "viewed", "sent", "type"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of NotificationModel from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # set to None if id (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.id is None and "id" in self.model_fields_set:
83
+ _dict['id'] = None
84
+
85
+ # set to None if user_id (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.user_id is None and "user_id" in self.model_fields_set:
88
+ _dict['user_id'] = None
89
+
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of NotificationModel from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ _obj = cls.model_validate({
102
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742340838,
103
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742340838,
104
+ "id": obj.get("id"),
105
+ "identifier": obj.get("identifier"),
106
+ "user_id": obj.get("user_id"),
107
+ "viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
108
+ "sent": obj.get("sent") if obj.get("sent") is not None else False,
109
+ "type": obj.get("type")
110
+ })
111
+ return _obj
112
+
113
+
@@ -0,0 +1,39 @@
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 NotificationType(str, Enum):
22
+ """
23
+ NotificationType
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ ERROR = 'error'
30
+ SUCCESS = 'success'
31
+ INFO = 'info'
32
+ WARNING = 'warning'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of NotificationType from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,263 @@
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, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
23
+ from crypticorn.trade.client.models.exchange import Exchange
24
+ from crypticorn.trade.client.models.margin_mode import MarginMode
25
+ from crypticorn.trade.client.models.market_type import MarketType
26
+ from crypticorn.trade.client.models.order_status import OrderStatus
27
+ from crypticorn.trade.client.models.trading_action_type import TradingActionType
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+ class OrderModel(BaseModel):
32
+ """
33
+ Response model for orders. All optional as the model is built step by step.
34
+ """ # noqa: E501
35
+ created_at: Optional[StrictInt] = Field(default=1742340838, description="Timestamp of creation")
36
+ updated_at: Optional[StrictInt] = Field(default=1742340838, description="Timestamp of last update")
37
+ id: Optional[StrictStr] = None
38
+ trading_action_id: Optional[StrictStr] = None
39
+ execution_id: Optional[StrictStr] = None
40
+ exchange_order_id: Optional[StrictStr] = None
41
+ position_id: Optional[StrictStr] = None
42
+ api_key_id: Optional[StrictStr] = None
43
+ user_id: Optional[StrictStr] = None
44
+ bot_id: Optional[StrictStr] = None
45
+ client_order_id: Optional[StrictStr] = None
46
+ exchange: Optional[Exchange] = None
47
+ symbol: Optional[StrictStr] = None
48
+ common_symbol: Optional[StrictStr] = None
49
+ price: Optional[Union[StrictFloat, StrictInt]] = None
50
+ action_type: Optional[TradingActionType] = None
51
+ market_type: Optional[MarketType] = None
52
+ margin_mode: Optional[MarginMode] = None
53
+ status_code: Optional[ApiErrorIdentifier] = None
54
+ status: Optional[OrderStatus] = None
55
+ filled_perc: Optional[Union[StrictFloat, StrictInt]] = None
56
+ filled_qty: Optional[Union[StrictFloat, StrictInt]] = None
57
+ fee: Optional[Union[StrictFloat, StrictInt]] = None
58
+ leverage: Optional[Union[StrictFloat, StrictInt]] = None
59
+ order_details: Optional[Dict[str, Any]] = None
60
+ pnl: Optional[Union[StrictFloat, StrictInt]] = None
61
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "trading_action_id", "execution_id", "exchange_order_id", "position_id", "api_key_id", "user_id", "bot_id", "client_order_id", "exchange", "symbol", "common_symbol", "price", "action_type", "market_type", "margin_mode", "status_code", "status", "filled_perc", "filled_qty", "fee", "leverage", "order_details", "pnl"]
62
+
63
+ model_config = ConfigDict(
64
+ populate_by_name=True,
65
+ validate_assignment=True,
66
+ protected_namespaces=(),
67
+ )
68
+
69
+
70
+ def to_str(self) -> str:
71
+ """Returns the string representation of the model using alias"""
72
+ return pprint.pformat(self.model_dump(by_alias=True))
73
+
74
+ def to_json(self) -> str:
75
+ """Returns the JSON representation of the model using alias"""
76
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
77
+ return json.dumps(self.to_dict())
78
+
79
+ @classmethod
80
+ def from_json(cls, json_str: str) -> Optional[Self]:
81
+ """Create an instance of OrderModel from a JSON string"""
82
+ return cls.from_dict(json.loads(json_str))
83
+
84
+ def to_dict(self) -> Dict[str, Any]:
85
+ """Return the dictionary representation of the model using alias.
86
+
87
+ This has the following differences from calling pydantic's
88
+ `self.model_dump(by_alias=True)`:
89
+
90
+ * `None` is only added to the output dict for nullable fields that
91
+ were set at model initialization. Other fields with value `None`
92
+ are ignored.
93
+ """
94
+ excluded_fields: Set[str] = set([
95
+ ])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
102
+ # set to None if id (nullable) is None
103
+ # and model_fields_set contains the field
104
+ if self.id is None and "id" in self.model_fields_set:
105
+ _dict['id'] = None
106
+
107
+ # set to None if trading_action_id (nullable) is None
108
+ # and model_fields_set contains the field
109
+ if self.trading_action_id is None and "trading_action_id" in self.model_fields_set:
110
+ _dict['trading_action_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 exchange_order_id (nullable) is None
118
+ # and model_fields_set contains the field
119
+ if self.exchange_order_id is None and "exchange_order_id" in self.model_fields_set:
120
+ _dict['exchange_order_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 api_key_id (nullable) is None
128
+ # and model_fields_set contains the field
129
+ if self.api_key_id is None and "api_key_id" in self.model_fields_set:
130
+ _dict['api_key_id'] = None
131
+
132
+ # set to None if user_id (nullable) is None
133
+ # and model_fields_set contains the field
134
+ if self.user_id is None and "user_id" in self.model_fields_set:
135
+ _dict['user_id'] = None
136
+
137
+ # set to None if bot_id (nullable) is None
138
+ # and model_fields_set contains the field
139
+ if self.bot_id is None and "bot_id" in self.model_fields_set:
140
+ _dict['bot_id'] = None
141
+
142
+ # set to None if client_order_id (nullable) is None
143
+ # and model_fields_set contains the field
144
+ if self.client_order_id is None and "client_order_id" in self.model_fields_set:
145
+ _dict['client_order_id'] = None
146
+
147
+ # set to None if exchange (nullable) is None
148
+ # and model_fields_set contains the field
149
+ if self.exchange is None and "exchange" in self.model_fields_set:
150
+ _dict['exchange'] = None
151
+
152
+ # set to None if symbol (nullable) is None
153
+ # and model_fields_set contains the field
154
+ if self.symbol is None and "symbol" in self.model_fields_set:
155
+ _dict['symbol'] = None
156
+
157
+ # set to None if common_symbol (nullable) is None
158
+ # and model_fields_set contains the field
159
+ if self.common_symbol is None and "common_symbol" in self.model_fields_set:
160
+ _dict['common_symbol'] = None
161
+
162
+ # set to None if price (nullable) is None
163
+ # and model_fields_set contains the field
164
+ if self.price is None and "price" in self.model_fields_set:
165
+ _dict['price'] = None
166
+
167
+ # set to None if action_type (nullable) is None
168
+ # and model_fields_set contains the field
169
+ if self.action_type is None and "action_type" in self.model_fields_set:
170
+ _dict['action_type'] = None
171
+
172
+ # set to None if market_type (nullable) is None
173
+ # and model_fields_set contains the field
174
+ if self.market_type is None and "market_type" in self.model_fields_set:
175
+ _dict['market_type'] = None
176
+
177
+ # set to None if margin_mode (nullable) is None
178
+ # and model_fields_set contains the field
179
+ if self.margin_mode is None and "margin_mode" in self.model_fields_set:
180
+ _dict['margin_mode'] = None
181
+
182
+ # set to None if status_code (nullable) is None
183
+ # and model_fields_set contains the field
184
+ if self.status_code is None and "status_code" in self.model_fields_set:
185
+ _dict['status_code'] = None
186
+
187
+ # set to None if status (nullable) is None
188
+ # and model_fields_set contains the field
189
+ if self.status is None and "status" in self.model_fields_set:
190
+ _dict['status'] = None
191
+
192
+ # set to None if filled_perc (nullable) is None
193
+ # and model_fields_set contains the field
194
+ if self.filled_perc is None and "filled_perc" in self.model_fields_set:
195
+ _dict['filled_perc'] = None
196
+
197
+ # set to None if filled_qty (nullable) is None
198
+ # and model_fields_set contains the field
199
+ if self.filled_qty is None and "filled_qty" in self.model_fields_set:
200
+ _dict['filled_qty'] = None
201
+
202
+ # set to None if fee (nullable) is None
203
+ # and model_fields_set contains the field
204
+ if self.fee is None and "fee" in self.model_fields_set:
205
+ _dict['fee'] = None
206
+
207
+ # set to None if leverage (nullable) is None
208
+ # and model_fields_set contains the field
209
+ if self.leverage is None and "leverage" in self.model_fields_set:
210
+ _dict['leverage'] = None
211
+
212
+ # set to None if order_details (nullable) is None
213
+ # and model_fields_set contains the field
214
+ if self.order_details is None and "order_details" in self.model_fields_set:
215
+ _dict['order_details'] = None
216
+
217
+ # set to None if pnl (nullable) is None
218
+ # and model_fields_set contains the field
219
+ if self.pnl is None and "pnl" in self.model_fields_set:
220
+ _dict['pnl'] = None
221
+
222
+ return _dict
223
+
224
+ @classmethod
225
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
226
+ """Create an instance of OrderModel from a dict"""
227
+ if obj is None:
228
+ return None
229
+
230
+ if not isinstance(obj, dict):
231
+ return cls.model_validate(obj)
232
+
233
+ _obj = cls.model_validate({
234
+ "created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742340838,
235
+ "updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742340838,
236
+ "id": obj.get("id"),
237
+ "trading_action_id": obj.get("trading_action_id"),
238
+ "execution_id": obj.get("execution_id"),
239
+ "exchange_order_id": obj.get("exchange_order_id"),
240
+ "position_id": obj.get("position_id"),
241
+ "api_key_id": obj.get("api_key_id"),
242
+ "user_id": obj.get("user_id"),
243
+ "bot_id": obj.get("bot_id"),
244
+ "client_order_id": obj.get("client_order_id"),
245
+ "exchange": obj.get("exchange"),
246
+ "symbol": obj.get("symbol"),
247
+ "common_symbol": obj.get("common_symbol"),
248
+ "price": obj.get("price"),
249
+ "action_type": obj.get("action_type"),
250
+ "market_type": obj.get("market_type"),
251
+ "margin_mode": obj.get("margin_mode"),
252
+ "status_code": obj.get("status_code"),
253
+ "status": obj.get("status"),
254
+ "filled_perc": obj.get("filled_perc"),
255
+ "filled_qty": obj.get("filled_qty"),
256
+ "fee": obj.get("fee"),
257
+ "leverage": obj.get("leverage"),
258
+ "order_details": obj.get("order_details"),
259
+ "pnl": obj.get("pnl")
260
+ })
261
+ return _obj
262
+
263
+
@@ -0,0 +1,40 @@
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 OrderStatus(str, Enum):
22
+ """
23
+ Status of the order
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NEW = 'new'
30
+ FILLED = 'filled'
31
+ PARTIALLY_FILLED = 'partially_filled'
32
+ CANCELLED = 'cancelled'
33
+ FAILED = 'failed'
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of OrderStatus from a JSON string"""
38
+ return cls(json.loads(json_str))
39
+
40
+
@@ -0,0 +1,93 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.trade.client.models.execution_ids import ExecutionIds
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PostFuturesAction(BaseModel):
27
+ """
28
+ PostFuturesAction
29
+ """ # noqa: E501
30
+ id: StrictStr = Field(description="Action ID.")
31
+ execution_ids: ExecutionIds = Field(description="Execution IDs for the action.")
32
+ __properties: ClassVar[List[str]] = ["id", "execution_ids"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of PostFuturesAction from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of execution_ids
74
+ if self.execution_ids:
75
+ _dict['execution_ids'] = self.execution_ids.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of PostFuturesAction from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "id": obj.get("id"),
89
+ "execution_ids": ExecutionIds.from_dict(obj["execution_ids"]) if obj.get("execution_ids") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,90 @@
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, StrictFloat, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from crypticorn.trade.client.models.exchange import Exchange
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class StrategyExchangeInfo(BaseModel):
27
+ """
28
+ StrategyExchangeInfo
29
+ """ # noqa: E501
30
+ exchange: Exchange = Field(description="Exchange name. Of type Exchange")
31
+ min_amount: Union[StrictFloat, StrictInt] = Field(description="Minimum amount for the strategy on the exchange")
32
+ __properties: ClassVar[List[str]] = ["exchange", "min_amount"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of StrategyExchangeInfo from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of StrategyExchangeInfo from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "exchange": obj.get("exchange"),
86
+ "min_amount": obj.get("min_amount")
87
+ })
88
+ return _obj
89
+
90
+