crypticorn 2.17.0rc4__py3-none-any.whl → 2.17.0rc6__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/auth/client/api/admin_api.py +6 -26
- crypticorn/auth/client/api/auth_api.py +36 -148
- crypticorn/auth/client/api/service_api.py +3 -16
- crypticorn/auth/client/api/user_api.py +33 -136
- crypticorn/auth/client/api/wallet_api.py +18 -76
- crypticorn/auth/client/api_client.py +0 -5
- crypticorn/auth/client/models/add_wallet_request.py +1 -1
- crypticorn/auth/client/models/authorize_user_request.py +1 -1
- crypticorn/auth/client/models/create_api_key_request.py +1 -1
- crypticorn/auth/client/models/create_user_request.py +1 -1
- crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
- crypticorn/auth/client/models/logout_default_response.py +1 -1
- crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
- crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
- crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
- crypticorn/auth/client/models/token_info200_response.py +1 -1
- crypticorn/auth/client/models/update_user_request.py +1 -1
- crypticorn/auth/client/models/user_by_username200_response.py +1 -1
- crypticorn/auth/client/models/verify200_response.py +1 -1
- crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
- crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
- crypticorn/auth/client/models/whoami200_response.py +1 -1
- crypticorn/cli/init.py +1 -1
- crypticorn/cli/templates/.env.docker.temp +3 -0
- crypticorn/cli/templates/.env.example.temp +4 -0
- crypticorn/cli/templates/Dockerfile +5 -2
- crypticorn/client.py +0 -1
- crypticorn/common/auth.py +31 -4
- crypticorn/common/decorators.py +1 -2
- crypticorn/common/enums.py +0 -2
- crypticorn/common/errors.py +10 -0
- crypticorn/common/metrics.py +1 -1
- crypticorn/common/middleware.py +0 -1
- crypticorn/common/pagination.py +116 -24
- crypticorn/common/router/admin_router.py +1 -11
- crypticorn/common/router/status_router.py +33 -2
- crypticorn/common/scopes.py +2 -2
- crypticorn/common/utils.py +1 -2
- crypticorn/dex/__init__.py +6 -0
- crypticorn/dex/client/__init__.py +49 -0
- crypticorn/dex/client/api/__init__.py +6 -0
- crypticorn/dex/client/api/admin_api.py +2983 -0
- crypticorn/dex/client/api/signals_api.py +1794 -0
- crypticorn/dex/client/api/status_api.py +889 -0
- crypticorn/dex/client/api_client.py +753 -0
- crypticorn/dex/client/api_response.py +20 -0
- crypticorn/dex/client/configuration.py +620 -0
- crypticorn/dex/client/exceptions.py +220 -0
- crypticorn/dex/client/models/__init__.py +30 -0
- crypticorn/dex/client/models/api_error_identifier.py +121 -0
- crypticorn/dex/client/models/api_error_level.py +37 -0
- crypticorn/dex/client/models/api_error_type.py +37 -0
- crypticorn/dex/client/models/exception_detail.py +117 -0
- crypticorn/dex/client/models/log_level.py +38 -0
- crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
- crypticorn/dex/client/models/risk.py +86 -0
- crypticorn/dex/client/models/signal_overview_stats.py +156 -0
- crypticorn/dex/client/models/signal_volume.py +84 -0
- crypticorn/dex/client/models/signal_with_token.py +163 -0
- crypticorn/dex/client/models/token_data.py +127 -0
- crypticorn/dex/client/models/token_detail.py +116 -0
- crypticorn/dex/client/py.typed +0 -0
- crypticorn/dex/client/rest.py +217 -0
- crypticorn/dex/main.py +1 -0
- crypticorn/hive/client/api/admin_api.py +18 -75
- crypticorn/hive/client/api/data_api.py +6 -28
- crypticorn/hive/client/api/models_api.py +22 -88
- crypticorn/hive/client/api/status_api.py +6 -27
- crypticorn/hive/client/api_client.py +0 -5
- crypticorn/hive/client/models/coin_info.py +1 -1
- crypticorn/hive/client/models/exception_detail.py +1 -1
- crypticorn/hive/client/models/target_info.py +1 -1
- crypticorn/hive/utils.py +2 -2
- crypticorn/klines/client/api/admin_api.py +18 -75
- crypticorn/klines/client/api/change_in_timeframe_api.py +3 -16
- crypticorn/klines/client/api/funding_rates_api.py +3 -16
- crypticorn/klines/client/api/ohlcv_data_api.py +3 -16
- crypticorn/klines/client/api/status_api.py +6 -27
- crypticorn/klines/client/api/symbols_api.py +3 -16
- crypticorn/klines/client/api/udf_api.py +18 -74
- crypticorn/klines/client/api_client.py +0 -5
- crypticorn/klines/client/models/exception_detail.py +1 -1
- crypticorn/klines/client/models/ohlcv.py +1 -1
- crypticorn/klines/client/models/symbol_group.py +1 -1
- crypticorn/klines/client/models/udf_config.py +1 -1
- crypticorn/metrics/client/api/admin_api.py +18 -75
- crypticorn/metrics/client/api/exchanges_api.py +12 -52
- crypticorn/metrics/client/api/indicators_api.py +6 -28
- crypticorn/metrics/client/api/logs_api.py +3 -16
- crypticorn/metrics/client/api/marketcap_api.py +12 -52
- crypticorn/metrics/client/api/markets_api.py +3 -16
- crypticorn/metrics/client/api/quote_currencies_api.py +3 -16
- crypticorn/metrics/client/api/status_api.py +6 -27
- crypticorn/metrics/client/api/tokens_api.py +6 -26
- crypticorn/metrics/client/api_client.py +0 -5
- crypticorn/metrics/client/models/exception_detail.py +1 -1
- crypticorn/metrics/client/models/exchange_mapping.py +1 -1
- crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
- crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
- crypticorn/metrics/client/models/ohlcv.py +1 -1
- crypticorn/pay/client/api/admin_api.py +21 -87
- crypticorn/pay/client/api/now_payments_api.py +15 -64
- crypticorn/pay/client/api/payments_api.py +6 -28
- crypticorn/pay/client/api/products_api.py +12 -52
- crypticorn/pay/client/api/status_api.py +6 -27
- crypticorn/pay/client/api_client.py +0 -5
- crypticorn/pay/client/models/exception_detail.py +1 -1
- crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
- crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
- crypticorn/pay/client/models/product.py +1 -1
- crypticorn/pay/client/models/product_create.py +1 -1
- crypticorn/pay/client/models/product_update.py +1 -1
- crypticorn/trade/client/__init__.py +15 -0
- crypticorn/trade/client/api/admin_api.py +43 -107
- crypticorn/trade/client/api/api_keys_api.py +207 -184
- crypticorn/trade/client/api/bots_api.py +6557 -240
- crypticorn/trade/client/api/exchanges_api.py +9 -36
- crypticorn/trade/client/api/notifications_api.py +18 -72
- crypticorn/trade/client/api/orders_api.py +220 -115
- crypticorn/trade/client/api/status_api.py +6 -24
- crypticorn/trade/client/api/strategies_api.py +15 -60
- crypticorn/trade/client/api/trading_actions_api.py +431 -112
- crypticorn/trade/client/models/__init__.py +15 -0
- crypticorn/trade/client/models/bot.py +7 -18
- crypticorn/trade/client/models/bot_create.py +17 -1
- crypticorn/trade/client/models/bot_update.py +17 -1
- crypticorn/trade/client/models/exchange_key_create.py +17 -1
- crypticorn/trade/client/models/exchange_key_update.py +17 -1
- crypticorn/trade/client/models/notification.py +17 -1
- crypticorn/trade/client/models/notification_create.py +17 -1
- crypticorn/trade/client/models/notification_update.py +17 -1
- crypticorn/trade/client/models/orders_count.py +88 -0
- crypticorn/trade/client/models/paginated_response_futures_trading_action.py +134 -0
- crypticorn/trade/client/models/paginated_response_order.py +134 -0
- crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action.py +141 -0
- crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action_data_inner.py +165 -0
- crypticorn/trade/client/models/pn_l.py +95 -0
- crypticorn/trade/client/models/spot_trading_action.py +207 -0
- crypticorn/trade/client/models/strategy.py +17 -1
- crypticorn/trade/client/models/strategy_create.py +17 -1
- crypticorn/trade/client/models/strategy_update.py +17 -1
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/METADATA +3 -3
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/RECORD +151 -116
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/WHEEL +0 -0
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Trading API
|
5
|
+
|
6
|
+
API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.trade.client.models.order import Order
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class PaginatedResponseOrder(BaseModel):
|
28
|
+
"""
|
29
|
+
PaginatedResponseOrder
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
data: List[Order]
|
33
|
+
total: StrictInt = Field(description="The total number of items")
|
34
|
+
page: StrictInt = Field(description="The current page number")
|
35
|
+
page_size: StrictInt = Field(description="The number of items per page")
|
36
|
+
prev: Optional[StrictInt] = None
|
37
|
+
next: Optional[StrictInt] = None
|
38
|
+
last: Optional[StrictInt] = None
|
39
|
+
__properties: ClassVar[List[str]] = [
|
40
|
+
"data",
|
41
|
+
"total",
|
42
|
+
"page",
|
43
|
+
"page_size",
|
44
|
+
"prev",
|
45
|
+
"next",
|
46
|
+
"last",
|
47
|
+
]
|
48
|
+
|
49
|
+
model_config = ConfigDict(
|
50
|
+
populate_by_name=True,
|
51
|
+
validate_assignment=True,
|
52
|
+
protected_namespaces=(),
|
53
|
+
)
|
54
|
+
|
55
|
+
def to_str(self) -> str:
|
56
|
+
"""Returns the string representation of the model using alias"""
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
58
|
+
|
59
|
+
def to_json(self) -> str:
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
62
|
+
return json.dumps(self.to_dict())
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of PaginatedResponseOrder from a JSON string"""
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
68
|
+
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
"""
|
79
|
+
excluded_fields: Set[str] = set([])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
|
87
|
+
_items = []
|
88
|
+
if self.data:
|
89
|
+
for _item_data in self.data:
|
90
|
+
if _item_data:
|
91
|
+
_items.append(_item_data.to_dict())
|
92
|
+
_dict["data"] = _items
|
93
|
+
# set to None if prev (nullable) is None
|
94
|
+
# and model_fields_set contains the field
|
95
|
+
if self.prev is None and "prev" in self.model_fields_set:
|
96
|
+
_dict["prev"] = None
|
97
|
+
|
98
|
+
# set to None if next (nullable) is None
|
99
|
+
# and model_fields_set contains the field
|
100
|
+
if self.next is None and "next" in self.model_fields_set:
|
101
|
+
_dict["next"] = None
|
102
|
+
|
103
|
+
# set to None if last (nullable) is None
|
104
|
+
# and model_fields_set contains the field
|
105
|
+
if self.last is None and "last" in self.model_fields_set:
|
106
|
+
_dict["last"] = None
|
107
|
+
|
108
|
+
return _dict
|
109
|
+
|
110
|
+
@classmethod
|
111
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
112
|
+
"""Create an instance of PaginatedResponseOrder from a dict"""
|
113
|
+
if obj is None:
|
114
|
+
return None
|
115
|
+
|
116
|
+
if not isinstance(obj, dict):
|
117
|
+
return cls.model_validate(obj)
|
118
|
+
|
119
|
+
_obj = cls.model_validate(
|
120
|
+
{
|
121
|
+
"data": (
|
122
|
+
[Order.from_dict(_item) for _item in obj["data"]]
|
123
|
+
if obj.get("data") is not None
|
124
|
+
else None
|
125
|
+
),
|
126
|
+
"total": obj.get("total"),
|
127
|
+
"page": obj.get("page"),
|
128
|
+
"page_size": obj.get("page_size"),
|
129
|
+
"prev": obj.get("prev"),
|
130
|
+
"next": obj.get("next"),
|
131
|
+
"last": obj.get("last"),
|
132
|
+
}
|
133
|
+
)
|
134
|
+
return _obj
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Trading API
|
5
|
+
|
6
|
+
API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.trade.client.models.paginated_response_union_futures_trading_action_spot_trading_action_data_inner import (
|
23
|
+
PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner,
|
24
|
+
)
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
|
29
|
+
class PaginatedResponseUnionFuturesTradingActionSpotTradingAction(BaseModel):
|
30
|
+
"""
|
31
|
+
PaginatedResponseUnionFuturesTradingActionSpotTradingAction
|
32
|
+
""" # noqa: E501
|
33
|
+
|
34
|
+
data: List[PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner]
|
35
|
+
total: StrictInt = Field(description="The total number of items")
|
36
|
+
page: StrictInt = Field(description="The current page number")
|
37
|
+
page_size: StrictInt = Field(description="The number of items per page")
|
38
|
+
prev: Optional[StrictInt] = None
|
39
|
+
next: Optional[StrictInt] = None
|
40
|
+
last: Optional[StrictInt] = None
|
41
|
+
__properties: ClassVar[List[str]] = [
|
42
|
+
"data",
|
43
|
+
"total",
|
44
|
+
"page",
|
45
|
+
"page_size",
|
46
|
+
"prev",
|
47
|
+
"next",
|
48
|
+
"last",
|
49
|
+
]
|
50
|
+
|
51
|
+
model_config = ConfigDict(
|
52
|
+
populate_by_name=True,
|
53
|
+
validate_assignment=True,
|
54
|
+
protected_namespaces=(),
|
55
|
+
)
|
56
|
+
|
57
|
+
def to_str(self) -> str:
|
58
|
+
"""Returns the string representation of the model using alias"""
|
59
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
60
|
+
|
61
|
+
def to_json(self) -> str:
|
62
|
+
"""Returns the JSON representation of the model using alias"""
|
63
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
64
|
+
return json.dumps(self.to_dict())
|
65
|
+
|
66
|
+
@classmethod
|
67
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
68
|
+
"""Create an instance of PaginatedResponseUnionFuturesTradingActionSpotTradingAction from a JSON string"""
|
69
|
+
return cls.from_dict(json.loads(json_str))
|
70
|
+
|
71
|
+
def to_dict(self) -> Dict[str, Any]:
|
72
|
+
"""Return the dictionary representation of the model using alias.
|
73
|
+
|
74
|
+
This has the following differences from calling pydantic's
|
75
|
+
`self.model_dump(by_alias=True)`:
|
76
|
+
|
77
|
+
* `None` is only added to the output dict for nullable fields that
|
78
|
+
were set at model initialization. Other fields with value `None`
|
79
|
+
are ignored.
|
80
|
+
"""
|
81
|
+
excluded_fields: Set[str] = set([])
|
82
|
+
|
83
|
+
_dict = self.model_dump(
|
84
|
+
by_alias=True,
|
85
|
+
exclude=excluded_fields,
|
86
|
+
exclude_none=True,
|
87
|
+
)
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
|
89
|
+
_items = []
|
90
|
+
if self.data:
|
91
|
+
for _item_data in self.data:
|
92
|
+
if _item_data:
|
93
|
+
_items.append(_item_data.to_dict())
|
94
|
+
_dict["data"] = _items
|
95
|
+
# set to None if prev (nullable) is None
|
96
|
+
# and model_fields_set contains the field
|
97
|
+
if self.prev is None and "prev" in self.model_fields_set:
|
98
|
+
_dict["prev"] = None
|
99
|
+
|
100
|
+
# set to None if next (nullable) is None
|
101
|
+
# and model_fields_set contains the field
|
102
|
+
if self.next is None and "next" in self.model_fields_set:
|
103
|
+
_dict["next"] = None
|
104
|
+
|
105
|
+
# set to None if last (nullable) is None
|
106
|
+
# and model_fields_set contains the field
|
107
|
+
if self.last is None and "last" in self.model_fields_set:
|
108
|
+
_dict["last"] = None
|
109
|
+
|
110
|
+
return _dict
|
111
|
+
|
112
|
+
@classmethod
|
113
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
114
|
+
"""Create an instance of PaginatedResponseUnionFuturesTradingActionSpotTradingAction from a dict"""
|
115
|
+
if obj is None:
|
116
|
+
return None
|
117
|
+
|
118
|
+
if not isinstance(obj, dict):
|
119
|
+
return cls.model_validate(obj)
|
120
|
+
|
121
|
+
_obj = cls.model_validate(
|
122
|
+
{
|
123
|
+
"data": (
|
124
|
+
[
|
125
|
+
PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner.from_dict(
|
126
|
+
_item
|
127
|
+
)
|
128
|
+
for _item in obj["data"]
|
129
|
+
]
|
130
|
+
if obj.get("data") is not None
|
131
|
+
else None
|
132
|
+
),
|
133
|
+
"total": obj.get("total"),
|
134
|
+
"page": obj.get("page"),
|
135
|
+
"page_size": obj.get("page_size"),
|
136
|
+
"prev": obj.get("prev"),
|
137
|
+
"next": obj.get("next"),
|
138
|
+
"last": obj.get("last"),
|
139
|
+
}
|
140
|
+
)
|
141
|
+
return _obj
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Trading API
|
5
|
+
|
6
|
+
API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
from inspect import getfullargspec
|
17
|
+
import json
|
18
|
+
import pprint
|
19
|
+
import re # noqa: F401
|
20
|
+
from pydantic import (
|
21
|
+
BaseModel,
|
22
|
+
ConfigDict,
|
23
|
+
Field,
|
24
|
+
StrictStr,
|
25
|
+
ValidationError,
|
26
|
+
field_validator,
|
27
|
+
)
|
28
|
+
from typing import Optional
|
29
|
+
from crypticorn.trade.client.models.futures_trading_action import FuturesTradingAction
|
30
|
+
from crypticorn.trade.client.models.spot_trading_action import SpotTradingAction
|
31
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
32
|
+
from typing_extensions import Literal, Self
|
33
|
+
from pydantic import Field
|
34
|
+
|
35
|
+
PAGINATEDRESPONSEUNIONFUTURESTRADINGACTIONSPOTTRADINGACTIONDATAINNER_ANY_OF_SCHEMAS = [
|
36
|
+
"FuturesTradingAction",
|
37
|
+
"SpotTradingAction",
|
38
|
+
]
|
39
|
+
|
40
|
+
|
41
|
+
class PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner(BaseModel):
|
42
|
+
"""
|
43
|
+
PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner
|
44
|
+
"""
|
45
|
+
|
46
|
+
# data type: FuturesTradingAction
|
47
|
+
anyof_schema_1_validator: Optional[FuturesTradingAction] = None
|
48
|
+
# data type: SpotTradingAction
|
49
|
+
anyof_schema_2_validator: Optional[SpotTradingAction] = None
|
50
|
+
if TYPE_CHECKING:
|
51
|
+
actual_instance: Optional[Union[FuturesTradingAction, SpotTradingAction]] = None
|
52
|
+
else:
|
53
|
+
actual_instance: Any = None
|
54
|
+
any_of_schemas: Set[str] = {"FuturesTradingAction", "SpotTradingAction"}
|
55
|
+
|
56
|
+
model_config = {
|
57
|
+
"validate_assignment": True,
|
58
|
+
"protected_namespaces": (),
|
59
|
+
}
|
60
|
+
|
61
|
+
def __init__(self, *args, **kwargs) -> None:
|
62
|
+
if args:
|
63
|
+
if len(args) > 1:
|
64
|
+
raise ValueError(
|
65
|
+
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
66
|
+
)
|
67
|
+
if kwargs:
|
68
|
+
raise ValueError(
|
69
|
+
"If a position argument is used, keyword arguments cannot be used."
|
70
|
+
)
|
71
|
+
super().__init__(actual_instance=args[0])
|
72
|
+
else:
|
73
|
+
super().__init__(**kwargs)
|
74
|
+
|
75
|
+
@field_validator("actual_instance")
|
76
|
+
def actual_instance_must_validate_anyof(cls, v):
|
77
|
+
instance = (
|
78
|
+
PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner.model_construct()
|
79
|
+
)
|
80
|
+
error_messages = []
|
81
|
+
# validate data type: FuturesTradingAction
|
82
|
+
if not isinstance(v, FuturesTradingAction):
|
83
|
+
error_messages.append(
|
84
|
+
f"Error! Input type `{type(v)}` is not `FuturesTradingAction`"
|
85
|
+
)
|
86
|
+
else:
|
87
|
+
return v
|
88
|
+
|
89
|
+
# validate data type: SpotTradingAction
|
90
|
+
if not isinstance(v, SpotTradingAction):
|
91
|
+
error_messages.append(
|
92
|
+
f"Error! Input type `{type(v)}` is not `SpotTradingAction`"
|
93
|
+
)
|
94
|
+
else:
|
95
|
+
return v
|
96
|
+
|
97
|
+
if error_messages:
|
98
|
+
# no match
|
99
|
+
raise ValueError(
|
100
|
+
"No match found when setting the actual_instance in PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner with anyOf schemas: FuturesTradingAction, SpotTradingAction. Details: "
|
101
|
+
+ ", ".join(error_messages)
|
102
|
+
)
|
103
|
+
else:
|
104
|
+
return v
|
105
|
+
|
106
|
+
@classmethod
|
107
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
108
|
+
return cls.from_json(json.dumps(obj))
|
109
|
+
|
110
|
+
@classmethod
|
111
|
+
def from_json(cls, json_str: str) -> Self:
|
112
|
+
"""Returns the object represented by the json string"""
|
113
|
+
instance = cls.model_construct()
|
114
|
+
error_messages = []
|
115
|
+
# anyof_schema_1_validator: Optional[FuturesTradingAction] = None
|
116
|
+
try:
|
117
|
+
instance.actual_instance = FuturesTradingAction.from_json(json_str)
|
118
|
+
return instance
|
119
|
+
except (ValidationError, ValueError) as e:
|
120
|
+
error_messages.append(str(e))
|
121
|
+
# anyof_schema_2_validator: Optional[SpotTradingAction] = None
|
122
|
+
try:
|
123
|
+
instance.actual_instance = SpotTradingAction.from_json(json_str)
|
124
|
+
return instance
|
125
|
+
except (ValidationError, ValueError) as e:
|
126
|
+
error_messages.append(str(e))
|
127
|
+
|
128
|
+
if error_messages:
|
129
|
+
# no match
|
130
|
+
raise ValueError(
|
131
|
+
"No match found when deserializing the JSON string into PaginatedResponseUnionFuturesTradingActionSpotTradingActionDataInner with anyOf schemas: FuturesTradingAction, SpotTradingAction. Details: "
|
132
|
+
+ ", ".join(error_messages)
|
133
|
+
)
|
134
|
+
else:
|
135
|
+
return instance
|
136
|
+
|
137
|
+
def to_json(self) -> str:
|
138
|
+
"""Returns the JSON representation of the actual instance"""
|
139
|
+
if self.actual_instance is None:
|
140
|
+
return "null"
|
141
|
+
|
142
|
+
if hasattr(self.actual_instance, "to_json") and callable(
|
143
|
+
self.actual_instance.to_json
|
144
|
+
):
|
145
|
+
return self.actual_instance.to_json()
|
146
|
+
else:
|
147
|
+
return json.dumps(self.actual_instance)
|
148
|
+
|
149
|
+
def to_dict(
|
150
|
+
self,
|
151
|
+
) -> Optional[Union[Dict[str, Any], FuturesTradingAction, SpotTradingAction]]:
|
152
|
+
"""Returns the dict representation of the actual instance"""
|
153
|
+
if self.actual_instance is None:
|
154
|
+
return None
|
155
|
+
|
156
|
+
if hasattr(self.actual_instance, "to_dict") and callable(
|
157
|
+
self.actual_instance.to_dict
|
158
|
+
):
|
159
|
+
return self.actual_instance.to_dict()
|
160
|
+
else:
|
161
|
+
return self.actual_instance
|
162
|
+
|
163
|
+
def to_str(self) -> str:
|
164
|
+
"""Returns the string representation of the actual instance"""
|
165
|
+
return pprint.pformat(self.model_dump())
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Trading API
|
5
|
+
|
6
|
+
API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List, Union
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
|
26
|
+
class PnL(BaseModel):
|
27
|
+
"""
|
28
|
+
The profit and loss of a bot by timestamp. In the case of sampling, the PnL is the sum of the PnLs between the prior timestamp and the current timestamp.
|
29
|
+
""" # noqa: E501
|
30
|
+
|
31
|
+
timestamp: StrictInt = Field(description="Timestamp of the order")
|
32
|
+
pnl: Union[StrictFloat, StrictInt] = Field(
|
33
|
+
description="The profit and loss of the order"
|
34
|
+
)
|
35
|
+
cum_pnl: Union[StrictFloat, StrictInt] = Field(
|
36
|
+
description="The cumulative profit and loss of the bot until the order (inclusive)"
|
37
|
+
)
|
38
|
+
__properties: ClassVar[List[str]] = ["timestamp", "pnl", "cum_pnl"]
|
39
|
+
|
40
|
+
model_config = ConfigDict(
|
41
|
+
populate_by_name=True,
|
42
|
+
validate_assignment=True,
|
43
|
+
protected_namespaces=(),
|
44
|
+
)
|
45
|
+
|
46
|
+
def to_str(self) -> str:
|
47
|
+
"""Returns the string representation of the model using alias"""
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
49
|
+
|
50
|
+
def to_json(self) -> str:
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
53
|
+
return json.dumps(self.to_dict())
|
54
|
+
|
55
|
+
@classmethod
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
57
|
+
"""Create an instance of PnL from a JSON string"""
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
59
|
+
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
62
|
+
|
63
|
+
This has the following differences from calling pydantic's
|
64
|
+
`self.model_dump(by_alias=True)`:
|
65
|
+
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
67
|
+
were set at model initialization. Other fields with value `None`
|
68
|
+
are ignored.
|
69
|
+
"""
|
70
|
+
excluded_fields: Set[str] = set([])
|
71
|
+
|
72
|
+
_dict = self.model_dump(
|
73
|
+
by_alias=True,
|
74
|
+
exclude=excluded_fields,
|
75
|
+
exclude_none=True,
|
76
|
+
)
|
77
|
+
return _dict
|
78
|
+
|
79
|
+
@classmethod
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
81
|
+
"""Create an instance of PnL from a dict"""
|
82
|
+
if obj is None:
|
83
|
+
return None
|
84
|
+
|
85
|
+
if not isinstance(obj, dict):
|
86
|
+
return cls.model_validate(obj)
|
87
|
+
|
88
|
+
_obj = cls.model_validate(
|
89
|
+
{
|
90
|
+
"timestamp": obj.get("timestamp"),
|
91
|
+
"pnl": obj.get("pnl"),
|
92
|
+
"cum_pnl": obj.get("cum_pnl"),
|
93
|
+
}
|
94
|
+
)
|
95
|
+
return _obj
|