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.
- crypticorn/__init__.py +3 -3
- crypticorn/client.py +722 -0
- crypticorn/{api.py → hive/main.py} +6 -6
- crypticorn/hive/requirements.txt +4 -0
- crypticorn/{utils.py → hive/utils.py} +2 -2
- crypticorn/klines/client/__init__.py +62 -0
- crypticorn/klines/client/api/__init__.py +9 -0
- crypticorn/klines/client/api/funding_rates_api.py +362 -0
- crypticorn/klines/client/api/health_check_api.py +281 -0
- crypticorn/klines/client/api/ohlcv_data_api.py +409 -0
- crypticorn/klines/client/api/symbols_api.py +308 -0
- crypticorn/klines/client/api/udf_api.py +1929 -0
- crypticorn/klines/client/api_client.py +797 -0
- crypticorn/klines/client/api_response.py +21 -0
- crypticorn/klines/client/configuration.py +565 -0
- crypticorn/klines/client/exceptions.py +216 -0
- crypticorn/klines/client/models/__init__.py +41 -0
- crypticorn/klines/client/models/base_response_health_check_response.py +108 -0
- crypticorn/klines/client/models/base_response_list_funding_rate_response.py +112 -0
- crypticorn/klines/client/models/base_response_list_str.py +104 -0
- crypticorn/klines/client/models/base_response_ohlcv_response.py +108 -0
- crypticorn/klines/client/models/error_response.py +101 -0
- crypticorn/klines/client/models/exchange.py +91 -0
- crypticorn/klines/client/models/funding_rate_response.py +92 -0
- crypticorn/klines/client/models/health_check_response.py +89 -0
- crypticorn/klines/client/models/history_error_response.py +89 -0
- crypticorn/klines/client/models/history_no_data_response.py +99 -0
- crypticorn/klines/client/models/history_success_response.py +99 -0
- crypticorn/klines/client/models/http_validation_error.py +95 -0
- crypticorn/klines/client/models/market.py +37 -0
- crypticorn/klines/client/models/ohlcv_response.py +98 -0
- crypticorn/klines/client/models/resolution.py +40 -0
- crypticorn/klines/client/models/response_get_history_udf_history_get.py +149 -0
- crypticorn/klines/client/models/search_symbol_response.py +97 -0
- crypticorn/klines/client/models/sort_direction.py +37 -0
- crypticorn/klines/client/models/symbol_group_response.py +87 -0
- crypticorn/klines/client/models/symbol_info_response.py +115 -0
- crypticorn/klines/client/models/symbol_type.py +89 -0
- crypticorn/klines/client/models/timeframe.py +40 -0
- crypticorn/klines/client/models/udf_config_response.py +121 -0
- crypticorn/klines/client/models/validation_error.py +99 -0
- crypticorn/klines/client/models/validation_error_loc_inner.py +138 -0
- crypticorn/klines/client/py.typed +0 -0
- crypticorn/klines/client/rest.py +257 -0
- crypticorn/klines/main.py +42 -0
- crypticorn/klines/requirements.txt +4 -0
- crypticorn/klines/test/__init__.py +0 -0
- crypticorn/klines/test/test_base_response_health_check_response.py +56 -0
- crypticorn/klines/test/test_base_response_list_funding_rate_response.py +59 -0
- crypticorn/klines/test/test_base_response_list_str.py +56 -0
- crypticorn/klines/test/test_base_response_ohlcv_response.py +72 -0
- crypticorn/klines/test/test_error_response.py +57 -0
- crypticorn/klines/test/test_exchange.py +56 -0
- crypticorn/klines/test/test_funding_rate_response.py +56 -0
- crypticorn/klines/test/test_funding_rates_api.py +38 -0
- crypticorn/klines/test/test_health_check_api.py +38 -0
- crypticorn/klines/test/test_health_check_response.py +52 -0
- crypticorn/klines/test/test_history_error_response.py +53 -0
- crypticorn/klines/test/test_history_no_data_response.py +69 -0
- crypticorn/klines/test/test_history_success_response.py +87 -0
- crypticorn/klines/test/test_http_validation_error.py +58 -0
- crypticorn/klines/test/test_market.py +33 -0
- crypticorn/klines/test/test_ohlcv_data_api.py +38 -0
- crypticorn/klines/test/test_ohlcv_response.py +86 -0
- crypticorn/klines/test/test_resolution.py +33 -0
- crypticorn/klines/test/test_response_get_history_udf_history_get.py +89 -0
- crypticorn/klines/test/test_search_symbol_response.py +62 -0
- crypticorn/klines/test/test_sort_direction.py +33 -0
- crypticorn/klines/test/test_symbol_group_response.py +53 -0
- crypticorn/klines/test/test_symbol_info_response.py +84 -0
- crypticorn/klines/test/test_symbol_type.py +54 -0
- crypticorn/klines/test/test_symbols_api.py +38 -0
- crypticorn/klines/test/test_timeframe.py +33 -0
- crypticorn/klines/test/test_udf_api.py +80 -0
- crypticorn/klines/test/test_udf_config_response.py +95 -0
- crypticorn/klines/test/test_validation_error.py +60 -0
- crypticorn/klines/test/test_validation_error_loc_inner.py +50 -0
- crypticorn/trade/client/__init__.py +63 -0
- crypticorn/trade/client/api/__init__.py +13 -0
- crypticorn/trade/client/api/api_keys_api.py +1468 -0
- crypticorn/trade/client/api/bots_api.py +1211 -0
- crypticorn/trade/client/api/exchanges_api.py +297 -0
- crypticorn/trade/client/api/futures_trading_panel_api.py +1463 -0
- crypticorn/trade/client/api/notifications_api.py +1767 -0
- crypticorn/trade/client/api/orders_api.py +331 -0
- crypticorn/trade/client/api/status_api.py +278 -0
- crypticorn/trade/client/api/strategies_api.py +331 -0
- crypticorn/trade/client/api/trading_actions_api.py +898 -0
- crypticorn/trade/client/api_client.py +797 -0
- crypticorn/trade/client/api_response.py +21 -0
- crypticorn/trade/client/configuration.py +574 -0
- crypticorn/trade/client/exceptions.py +216 -0
- crypticorn/trade/client/models/__init__.py +38 -0
- crypticorn/trade/client/models/action_model.py +202 -0
- crypticorn/trade/client/models/api_error_identifier.py +83 -0
- crypticorn/trade/client/models/api_key_model.py +135 -0
- crypticorn/trade/client/models/bot_model.py +122 -0
- crypticorn/trade/client/models/exchange.py +37 -0
- crypticorn/trade/client/models/execution_ids.py +91 -0
- crypticorn/trade/client/models/futures_balance.py +109 -0
- crypticorn/trade/client/models/futures_trading_action.py +198 -0
- crypticorn/trade/client/models/http_validation_error.py +95 -0
- crypticorn/trade/client/models/margin_mode.py +37 -0
- crypticorn/trade/client/models/market_type.py +37 -0
- crypticorn/trade/client/models/notification_model.py +113 -0
- crypticorn/trade/client/models/notification_type.py +39 -0
- crypticorn/trade/client/models/order_model.py +263 -0
- crypticorn/trade/client/models/order_status.py +40 -0
- crypticorn/trade/client/models/post_futures_action.py +93 -0
- crypticorn/trade/client/models/strategy_exchange_info.py +90 -0
- crypticorn/trade/client/models/strategy_model.py +119 -0
- crypticorn/trade/client/models/tpsl.py +116 -0
- crypticorn/trade/client/models/trading_action_type.py +39 -0
- crypticorn/trade/client/models/update_notification.py +91 -0
- crypticorn/trade/client/models/validation_error.py +99 -0
- crypticorn/trade/client/models/validation_error_loc_inner.py +138 -0
- crypticorn/trade/client/py.typed +0 -0
- crypticorn/trade/client/rest.py +257 -0
- crypticorn/trade/main.py +38 -0
- crypticorn/trade/requirements.txt +4 -0
- crypticorn/trade/test/__init__.py +0 -0
- crypticorn/trade/test/test_action_model.py +87 -0
- crypticorn/trade/test/test_api_error_identifier.py +33 -0
- crypticorn/trade/test/test_api_key_model.py +61 -0
- crypticorn/trade/test/test_api_keys_api.py +66 -0
- crypticorn/trade/test/test_bot_model.py +64 -0
- crypticorn/trade/test/test_bots_api.py +59 -0
- crypticorn/trade/test/test_exchange.py +33 -0
- crypticorn/trade/test/test_exchanges_api.py +38 -0
- crypticorn/trade/test/test_execution_ids.py +68 -0
- crypticorn/trade/test/test_futures_balance.py +62 -0
- crypticorn/trade/test/test_futures_trading_action.py +86 -0
- crypticorn/trade/test/test_futures_trading_panel_api.py +66 -0
- crypticorn/trade/test/test_http_validation_error.py +58 -0
- crypticorn/trade/test/test_margin_mode.py +33 -0
- crypticorn/trade/test/test_market_type.py +33 -0
- crypticorn/trade/test/test_notification_model.py +59 -0
- crypticorn/trade/test/test_notification_type.py +33 -0
- crypticorn/trade/test/test_notifications_api.py +73 -0
- crypticorn/trade/test/test_order_model.py +75 -0
- crypticorn/trade/test/test_order_status.py +33 -0
- crypticorn/trade/test/test_orders_api.py +38 -0
- crypticorn/trade/test/test_post_futures_action.py +72 -0
- crypticorn/trade/test/test_status_api.py +38 -0
- crypticorn/trade/test/test_strategies_api.py +38 -0
- crypticorn/trade/test/test_strategy_exchange_info.py +54 -0
- crypticorn/trade/test/test_strategy_model.py +73 -0
- crypticorn/trade/test/test_tpsl.py +56 -0
- crypticorn/trade/test/test_trading_action_type.py +33 -0
- crypticorn/trade/test/test_trading_actions_api.py +52 -0
- crypticorn/trade/test/test_update_notification.py +54 -0
- crypticorn/trade/test/test_validation_error.py +60 -0
- crypticorn/trade/test/test_validation_error_loc_inner.py +50 -0
- crypticorn-1.0.2rc1.dist-info/METADATA +47 -0
- crypticorn-1.0.2rc1.dist-info/RECORD +158 -0
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/WHEEL +1 -1
- crypticorn-1.0.0.dist-info/METADATA +0 -34
- crypticorn-1.0.0.dist-info/RECORD +0 -8
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/LICENSE.md +0 -0
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.2rc1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,119 @@
|
|
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, Union
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class StrategyModel(BaseModel):
|
28
|
+
"""
|
29
|
+
StrategyModel
|
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: StrictStr = Field(description="Unique human readable identifier for the strategy e.g. 'daily_trend_momentum'")
|
35
|
+
name: StrictStr = Field(description="Name of the strategy")
|
36
|
+
description: StrictStr = Field(description="Description of the strategy")
|
37
|
+
exchanges: List[StrategyExchangeInfo] = Field(description="Exchanges supported by the strategy.")
|
38
|
+
enabled: StrictBool = Field(description="Whether the strategy is enabled")
|
39
|
+
leverage: StrictInt = Field(description="Leverage for the strategy")
|
40
|
+
performance_fee: Union[Annotated[float, Field(le=1.0, strict=True)], Annotated[int, Field(le=1, strict=True)]] = Field(description="Performance fee for the strategy")
|
41
|
+
__properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "identifier", "name", "description", "exchanges", "enabled", "leverage", "performance_fee"]
|
42
|
+
|
43
|
+
model_config = ConfigDict(
|
44
|
+
populate_by_name=True,
|
45
|
+
validate_assignment=True,
|
46
|
+
protected_namespaces=(),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def to_str(self) -> str:
|
51
|
+
"""Returns the string representation of the model using alias"""
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
53
|
+
|
54
|
+
def to_json(self) -> str:
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
|
+
return json.dumps(self.to_dict())
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
|
+
"""Create an instance of StrategyModel from a JSON string"""
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
63
|
+
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
66
|
+
|
67
|
+
This has the following differences from calling pydantic's
|
68
|
+
`self.model_dump(by_alias=True)`:
|
69
|
+
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
71
|
+
were set at model initialization. Other fields with value `None`
|
72
|
+
are ignored.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
])
|
76
|
+
|
77
|
+
_dict = self.model_dump(
|
78
|
+
by_alias=True,
|
79
|
+
exclude=excluded_fields,
|
80
|
+
exclude_none=True,
|
81
|
+
)
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of each item in exchanges (list)
|
83
|
+
_items = []
|
84
|
+
if self.exchanges:
|
85
|
+
for _item_exchanges in self.exchanges:
|
86
|
+
if _item_exchanges:
|
87
|
+
_items.append(_item_exchanges.to_dict())
|
88
|
+
_dict['exchanges'] = _items
|
89
|
+
# set to None if id (nullable) is None
|
90
|
+
# and model_fields_set contains the field
|
91
|
+
if self.id is None and "id" in self.model_fields_set:
|
92
|
+
_dict['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 StrategyModel 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
|
+
"created_at": obj.get("created_at") if obj.get("created_at") is not None else 1742340838,
|
107
|
+
"updated_at": obj.get("updated_at") if obj.get("updated_at") is not None else 1742340838,
|
108
|
+
"id": obj.get("id"),
|
109
|
+
"identifier": obj.get("identifier"),
|
110
|
+
"name": obj.get("name"),
|
111
|
+
"description": obj.get("description"),
|
112
|
+
"exchanges": [StrategyExchangeInfo.from_dict(_item) for _item in obj["exchanges"]] if obj.get("exchanges") is not None else None,
|
113
|
+
"enabled": obj.get("enabled"),
|
114
|
+
"leverage": obj.get("leverage"),
|
115
|
+
"performance_fee": obj.get("performance_fee")
|
116
|
+
})
|
117
|
+
return _obj
|
118
|
+
|
119
|
+
|
@@ -0,0 +1,116 @@
|
|
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 typing_extensions import Annotated
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class TPSL(BaseModel):
|
27
|
+
"""
|
28
|
+
Model for take profit and stop loss targets
|
29
|
+
""" # noqa: E501
|
30
|
+
price_delta: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = None
|
31
|
+
price: Optional[Union[StrictFloat, StrictInt]] = None
|
32
|
+
allocation: Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] = Field(description="Percentage of the order to sell")
|
33
|
+
execution_id: Optional[StrictStr] = None
|
34
|
+
client_order_id: Optional[StrictStr] = None
|
35
|
+
__properties: ClassVar[List[str]] = ["price_delta", "price", "allocation", "execution_id", "client_order_id"]
|
36
|
+
|
37
|
+
model_config = ConfigDict(
|
38
|
+
populate_by_name=True,
|
39
|
+
validate_assignment=True,
|
40
|
+
protected_namespaces=(),
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
def to_str(self) -> str:
|
45
|
+
"""Returns the string representation of the model using alias"""
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
47
|
+
|
48
|
+
def to_json(self) -> str:
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
51
|
+
return json.dumps(self.to_dict())
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
55
|
+
"""Create an instance of TPSL from a JSON string"""
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
57
|
+
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
60
|
+
|
61
|
+
This has the following differences from calling pydantic's
|
62
|
+
`self.model_dump(by_alias=True)`:
|
63
|
+
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
65
|
+
were set at model initialization. Other fields with value `None`
|
66
|
+
are ignored.
|
67
|
+
"""
|
68
|
+
excluded_fields: Set[str] = set([
|
69
|
+
])
|
70
|
+
|
71
|
+
_dict = self.model_dump(
|
72
|
+
by_alias=True,
|
73
|
+
exclude=excluded_fields,
|
74
|
+
exclude_none=True,
|
75
|
+
)
|
76
|
+
# set to None if price_delta (nullable) is None
|
77
|
+
# and model_fields_set contains the field
|
78
|
+
if self.price_delta is None and "price_delta" in self.model_fields_set:
|
79
|
+
_dict['price_delta'] = None
|
80
|
+
|
81
|
+
# set to None if price (nullable) is None
|
82
|
+
# and model_fields_set contains the field
|
83
|
+
if self.price is None and "price" in self.model_fields_set:
|
84
|
+
_dict['price'] = None
|
85
|
+
|
86
|
+
# set to None if execution_id (nullable) is None
|
87
|
+
# and model_fields_set contains the field
|
88
|
+
if self.execution_id is None and "execution_id" in self.model_fields_set:
|
89
|
+
_dict['execution_id'] = None
|
90
|
+
|
91
|
+
# set to None if client_order_id (nullable) is None
|
92
|
+
# and model_fields_set contains the field
|
93
|
+
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
94
|
+
_dict['client_order_id'] = None
|
95
|
+
|
96
|
+
return _dict
|
97
|
+
|
98
|
+
@classmethod
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
100
|
+
"""Create an instance of TPSL from a dict"""
|
101
|
+
if obj is None:
|
102
|
+
return None
|
103
|
+
|
104
|
+
if not isinstance(obj, dict):
|
105
|
+
return cls.model_validate(obj)
|
106
|
+
|
107
|
+
_obj = cls.model_validate({
|
108
|
+
"price_delta": obj.get("price_delta"),
|
109
|
+
"price": obj.get("price"),
|
110
|
+
"allocation": obj.get("allocation"),
|
111
|
+
"execution_id": obj.get("execution_id"),
|
112
|
+
"client_order_id": obj.get("client_order_id")
|
113
|
+
})
|
114
|
+
return _obj
|
115
|
+
|
116
|
+
|
@@ -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 TradingActionType(str, Enum):
|
22
|
+
"""
|
23
|
+
Type of trading action
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
OPEN_LONG = 'open_long'
|
30
|
+
OPEN_SHORT = 'open_short'
|
31
|
+
CLOSE_LONG = 'close_long'
|
32
|
+
CLOSE_SHORT = 'close_short'
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of TradingActionType from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,91 @@
|
|
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, 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 UpdateNotification(BaseModel):
|
26
|
+
"""
|
27
|
+
UpdateNotification
|
28
|
+
""" # noqa: E501
|
29
|
+
id: StrictStr = Field(description="UID, required in the request body")
|
30
|
+
viewed: Optional[StrictBool] = Field(default=False, description="Whether the notification has been marked as seen")
|
31
|
+
sent: Optional[StrictBool] = Field(default=False, description="Whether the notification has been sent as an email")
|
32
|
+
__properties: ClassVar[List[str]] = ["id", "viewed", "sent"]
|
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 UpdateNotification 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 UpdateNotification 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
|
+
"id": obj.get("id"),
|
86
|
+
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
87
|
+
"sent": obj.get("sent") if obj.get("sent") is not None else False
|
88
|
+
})
|
89
|
+
return _obj
|
90
|
+
|
91
|
+
|
@@ -0,0 +1,99 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from crypticorn.trade.client.models.validation_error_loc_inner import ValidationErrorLocInner
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class ValidationError(BaseModel):
|
27
|
+
"""
|
28
|
+
ValidationError
|
29
|
+
""" # noqa: E501
|
30
|
+
loc: List[ValidationErrorLocInner]
|
31
|
+
msg: StrictStr
|
32
|
+
type: StrictStr
|
33
|
+
__properties: ClassVar[List[str]] = ["loc", "msg", "type"]
|
34
|
+
|
35
|
+
model_config = ConfigDict(
|
36
|
+
populate_by_name=True,
|
37
|
+
validate_assignment=True,
|
38
|
+
protected_namespaces=(),
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
def to_str(self) -> str:
|
43
|
+
"""Returns the string representation of the model using alias"""
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
45
|
+
|
46
|
+
def to_json(self) -> str:
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
49
|
+
return json.dumps(self.to_dict())
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
|
+
"""Create an instance of ValidationError from a JSON string"""
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
55
|
+
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
58
|
+
|
59
|
+
This has the following differences from calling pydantic's
|
60
|
+
`self.model_dump(by_alias=True)`:
|
61
|
+
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
63
|
+
were set at model initialization. Other fields with value `None`
|
64
|
+
are ignored.
|
65
|
+
"""
|
66
|
+
excluded_fields: Set[str] = set([
|
67
|
+
])
|
68
|
+
|
69
|
+
_dict = self.model_dump(
|
70
|
+
by_alias=True,
|
71
|
+
exclude=excluded_fields,
|
72
|
+
exclude_none=True,
|
73
|
+
)
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in loc (list)
|
75
|
+
_items = []
|
76
|
+
if self.loc:
|
77
|
+
for _item_loc in self.loc:
|
78
|
+
if _item_loc:
|
79
|
+
_items.append(_item_loc.to_dict())
|
80
|
+
_dict['loc'] = _items
|
81
|
+
return _dict
|
82
|
+
|
83
|
+
@classmethod
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
85
|
+
"""Create an instance of ValidationError from a dict"""
|
86
|
+
if obj is None:
|
87
|
+
return None
|
88
|
+
|
89
|
+
if not isinstance(obj, dict):
|
90
|
+
return cls.model_validate(obj)
|
91
|
+
|
92
|
+
_obj = cls.model_validate({
|
93
|
+
"loc": [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
|
94
|
+
"msg": obj.get("msg"),
|
95
|
+
"type": obj.get("type")
|
96
|
+
})
|
97
|
+
return _obj
|
98
|
+
|
99
|
+
|
@@ -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
|
+
from inspect import getfullargspec
|
17
|
+
import json
|
18
|
+
import pprint
|
19
|
+
import re # noqa: F401
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
|
21
|
+
from typing import Optional
|
22
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
23
|
+
from typing_extensions import Literal, Self
|
24
|
+
from pydantic import Field
|
25
|
+
|
26
|
+
VALIDATIONERRORLOCINNER_ANY_OF_SCHEMAS = ["int", "str"]
|
27
|
+
|
28
|
+
class ValidationErrorLocInner(BaseModel):
|
29
|
+
"""
|
30
|
+
ValidationErrorLocInner
|
31
|
+
"""
|
32
|
+
|
33
|
+
# data type: str
|
34
|
+
anyof_schema_1_validator: Optional[StrictStr] = None
|
35
|
+
# data type: int
|
36
|
+
anyof_schema_2_validator: Optional[StrictInt] = None
|
37
|
+
if TYPE_CHECKING:
|
38
|
+
actual_instance: Optional[Union[int, str]] = None
|
39
|
+
else:
|
40
|
+
actual_instance: Any = None
|
41
|
+
any_of_schemas: Set[str] = { "int", "str" }
|
42
|
+
|
43
|
+
model_config = {
|
44
|
+
"validate_assignment": True,
|
45
|
+
"protected_namespaces": (),
|
46
|
+
}
|
47
|
+
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
49
|
+
if args:
|
50
|
+
if len(args) > 1:
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
52
|
+
if kwargs:
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
54
|
+
super().__init__(actual_instance=args[0])
|
55
|
+
else:
|
56
|
+
super().__init__(**kwargs)
|
57
|
+
|
58
|
+
@field_validator('actual_instance')
|
59
|
+
def actual_instance_must_validate_anyof(cls, v):
|
60
|
+
instance = ValidationErrorLocInner.model_construct()
|
61
|
+
error_messages = []
|
62
|
+
# validate data type: str
|
63
|
+
try:
|
64
|
+
instance.anyof_schema_1_validator = v
|
65
|
+
return v
|
66
|
+
except (ValidationError, ValueError) as e:
|
67
|
+
error_messages.append(str(e))
|
68
|
+
# validate data type: int
|
69
|
+
try:
|
70
|
+
instance.anyof_schema_2_validator = v
|
71
|
+
return v
|
72
|
+
except (ValidationError, ValueError) as e:
|
73
|
+
error_messages.append(str(e))
|
74
|
+
if error_messages:
|
75
|
+
# no match
|
76
|
+
raise ValueError("No match found when setting the actual_instance in ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
|
77
|
+
else:
|
78
|
+
return v
|
79
|
+
|
80
|
+
@classmethod
|
81
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
82
|
+
return cls.from_json(json.dumps(obj))
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_json(cls, json_str: str) -> Self:
|
86
|
+
"""Returns the object represented by the json string"""
|
87
|
+
instance = cls.model_construct()
|
88
|
+
error_messages = []
|
89
|
+
# deserialize data into str
|
90
|
+
try:
|
91
|
+
# validation
|
92
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
93
|
+
# assign value to actual_instance
|
94
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
95
|
+
return instance
|
96
|
+
except (ValidationError, ValueError) as e:
|
97
|
+
error_messages.append(str(e))
|
98
|
+
# deserialize data into int
|
99
|
+
try:
|
100
|
+
# validation
|
101
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
102
|
+
# assign value to actual_instance
|
103
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
104
|
+
return instance
|
105
|
+
except (ValidationError, ValueError) as e:
|
106
|
+
error_messages.append(str(e))
|
107
|
+
|
108
|
+
if error_messages:
|
109
|
+
# no match
|
110
|
+
raise ValueError("No match found when deserializing the JSON string into ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
|
111
|
+
else:
|
112
|
+
return instance
|
113
|
+
|
114
|
+
def to_json(self) -> str:
|
115
|
+
"""Returns the JSON representation of the actual instance"""
|
116
|
+
if self.actual_instance is None:
|
117
|
+
return "null"
|
118
|
+
|
119
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
120
|
+
return self.actual_instance.to_json()
|
121
|
+
else:
|
122
|
+
return json.dumps(self.actual_instance)
|
123
|
+
|
124
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
|
125
|
+
"""Returns the dict representation of the actual instance"""
|
126
|
+
if self.actual_instance is None:
|
127
|
+
return None
|
128
|
+
|
129
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
130
|
+
return self.actual_instance.to_dict()
|
131
|
+
else:
|
132
|
+
return self.actual_instance
|
133
|
+
|
134
|
+
def to_str(self) -> str:
|
135
|
+
"""Returns the string representation of the actual instance"""
|
136
|
+
return pprint.pformat(self.model_dump())
|
137
|
+
|
138
|
+
|
File without changes
|