crypticorn 2.16.0__py3-none-any.whl → 2.17.0__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 +2 -2
- crypticorn/auth/client/api/admin_api.py +397 -13
- crypticorn/auth/client/api/auth_api.py +3610 -341
- crypticorn/auth/client/api/service_api.py +249 -7
- crypticorn/auth/client/api/user_api.py +2295 -179
- crypticorn/auth/client/api/wallet_api.py +1468 -81
- crypticorn/auth/client/configuration.py +2 -2
- crypticorn/auth/client/models/create_api_key_request.py +2 -1
- crypticorn/auth/client/models/get_api_keys200_response_inner.py +2 -1
- crypticorn/auth/client/rest.py +23 -4
- crypticorn/auth/main.py +8 -5
- 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 +226 -59
- crypticorn/common/__init__.py +1 -0
- crypticorn/common/auth.py +45 -14
- crypticorn/common/decorators.py +1 -2
- crypticorn/common/enums.py +0 -2
- crypticorn/common/errors.py +10 -0
- crypticorn/common/metrics.py +30 -0
- crypticorn/common/middleware.py +94 -1
- crypticorn/common/pagination.py +252 -20
- crypticorn/common/router/admin_router.py +2 -2
- crypticorn/common/router/status_router.py +40 -2
- crypticorn/common/scopes.py +2 -2
- crypticorn/common/warnings.py +7 -0
- 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 +2986 -0
- crypticorn/dex/client/api/signals_api.py +1798 -0
- crypticorn/dex/client/api/status_api.py +892 -0
- crypticorn/dex/client/api_client.py +758 -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 +158 -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 +1173 -47
- crypticorn/hive/client/api/data_api.py +499 -17
- crypticorn/hive/client/api/models_api.py +1595 -87
- crypticorn/hive/client/api/status_api.py +397 -16
- crypticorn/hive/client/api_client.py +0 -5
- crypticorn/hive/client/models/api_error_identifier.py +1 -1
- 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/client/rest.py +23 -4
- crypticorn/hive/main.py +99 -25
- crypticorn/hive/utils.py +2 -2
- crypticorn/klines/client/api/admin_api.py +1173 -47
- crypticorn/klines/client/api/change_in_timeframe_api.py +269 -11
- crypticorn/klines/client/api/funding_rates_api.py +315 -11
- crypticorn/klines/client/api/ohlcv_data_api.py +390 -11
- crypticorn/klines/client/api/status_api.py +397 -16
- crypticorn/klines/client/api/symbols_api.py +216 -11
- crypticorn/klines/client/api/udf_api.py +1268 -51
- crypticorn/klines/client/api_client.py +0 -5
- crypticorn/klines/client/models/api_error_identifier.py +3 -1
- 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/klines/client/rest.py +23 -4
- crypticorn/klines/main.py +89 -12
- crypticorn/metrics/client/api/admin_api.py +1173 -47
- crypticorn/metrics/client/api/exchanges_api.py +1370 -145
- crypticorn/metrics/client/api/indicators_api.py +622 -17
- crypticorn/metrics/client/api/logs_api.py +296 -11
- crypticorn/metrics/client/api/marketcap_api.py +1207 -67
- crypticorn/metrics/client/api/markets_api.py +343 -11
- crypticorn/metrics/client/api/quote_currencies_api.py +228 -11
- crypticorn/metrics/client/api/status_api.py +397 -16
- crypticorn/metrics/client/api/tokens_api.py +382 -15
- crypticorn/metrics/client/api_client.py +0 -5
- crypticorn/metrics/client/configuration.py +4 -2
- 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/metrics/client/rest.py +23 -4
- crypticorn/metrics/main.py +113 -19
- crypticorn/pay/client/api/admin_api.py +1585 -57
- crypticorn/pay/client/api/now_payments_api.py +961 -39
- crypticorn/pay/client/api/payments_api.py +562 -17
- crypticorn/pay/client/api/products_api.py +880 -30
- crypticorn/pay/client/api/status_api.py +397 -16
- crypticorn/pay/client/api_client.py +0 -5
- crypticorn/pay/client/configuration.py +2 -2
- crypticorn/pay/client/models/api_error_identifier.py +7 -7
- 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/pay/client/models/scope.py +1 -0
- crypticorn/pay/client/rest.py +23 -4
- crypticorn/pay/main.py +10 -6
- crypticorn/trade/client/__init__.py +11 -1
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/admin_api.py +1184 -55
- crypticorn/trade/client/api/api_keys_api.py +1678 -162
- crypticorn/trade/client/api/bots_api.py +7563 -187
- crypticorn/trade/client/api/exchanges_api.py +565 -19
- crypticorn/trade/client/api/notifications_api.py +1290 -116
- crypticorn/trade/client/api/orders_api.py +393 -55
- crypticorn/trade/client/api/status_api.py +397 -13
- crypticorn/trade/client/api/strategies_api.py +1133 -77
- crypticorn/trade/client/api/trading_actions_api.py +786 -65
- crypticorn/trade/client/models/__init__.py +11 -0
- crypticorn/trade/client/models/actions_count.py +88 -0
- crypticorn/trade/client/models/api_error_identifier.py +1 -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.py +6 -1
- crypticorn/trade/client/models/exchange_key.py +1 -1
- crypticorn/trade/client/models/exchange_key_balance.py +111 -0
- crypticorn/trade/client/models/exchange_key_create.py +17 -1
- crypticorn/trade/client/models/exchange_key_update.py +17 -1
- crypticorn/trade/client/models/execution_ids.py +1 -1
- crypticorn/trade/client/models/futures_balance.py +27 -25
- crypticorn/trade/client/models/notification.py +17 -1
- crypticorn/trade/client/models/notification_create.py +18 -2
- 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/pn_l.py +95 -0
- crypticorn/trade/client/models/post_futures_action.py +1 -1
- crypticorn/trade/client/models/spot_balance.py +109 -0
- crypticorn/trade/client/models/strategy.py +22 -4
- crypticorn/trade/client/models/strategy_create.py +23 -5
- crypticorn/trade/client/models/strategy_exchange_info.py +16 -4
- crypticorn/trade/client/models/strategy_update.py +19 -3
- crypticorn/trade/client/models/tpsl.py +4 -19
- crypticorn/trade/client/models/tpsl_create.py +6 -19
- crypticorn/trade/client/rest.py +23 -4
- crypticorn/trade/main.py +15 -12
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/METADATA +65 -20
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/RECORD +163 -128
- crypticorn/trade/client/api/futures_trading_panel_api.py +0 -1285
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/WHEEL +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0.dist-info}/top_level.txt +0 -0
@@ -28,7 +28,7 @@ from typing_extensions import Self
|
|
28
28
|
|
29
29
|
class NotificationCreate(BaseModel):
|
30
30
|
"""
|
31
|
-
Notification model for
|
31
|
+
Notification model for creating new system alerts and messages.
|
32
32
|
""" # noqa: E501
|
33
33
|
|
34
34
|
viewed: Optional[StrictBool] = Field(
|
@@ -46,6 +46,7 @@ class NotificationCreate(BaseModel):
|
|
46
46
|
type: ApiErrorType = Field(
|
47
47
|
description="Type of the notification. Of type ApiErrorType"
|
48
48
|
)
|
49
|
+
additional_properties: Dict[str, Any] = {}
|
49
50
|
__properties: ClassVar[List[str]] = [
|
50
51
|
"viewed",
|
51
52
|
"sent",
|
@@ -83,14 +84,24 @@ class NotificationCreate(BaseModel):
|
|
83
84
|
* `None` is only added to the output dict for nullable fields that
|
84
85
|
were set at model initialization. Other fields with value `None`
|
85
86
|
are ignored.
|
87
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
86
88
|
"""
|
87
|
-
excluded_fields: Set[str] = set(
|
89
|
+
excluded_fields: Set[str] = set(
|
90
|
+
[
|
91
|
+
"additional_properties",
|
92
|
+
]
|
93
|
+
)
|
88
94
|
|
89
95
|
_dict = self.model_dump(
|
90
96
|
by_alias=True,
|
91
97
|
exclude=excluded_fields,
|
92
98
|
exclude_none=True,
|
93
99
|
)
|
100
|
+
# puts key-value pairs in additional_properties in the top level
|
101
|
+
if self.additional_properties is not None:
|
102
|
+
for _key, _value in self.additional_properties.items():
|
103
|
+
_dict[_key] = _value
|
104
|
+
|
94
105
|
return _dict
|
95
106
|
|
96
107
|
@classmethod
|
@@ -111,4 +122,9 @@ class NotificationCreate(BaseModel):
|
|
111
122
|
"type": obj.get("type"),
|
112
123
|
}
|
113
124
|
)
|
125
|
+
# store additional fields in additional_properties
|
126
|
+
for _key in obj.keys():
|
127
|
+
if _key not in cls.__properties:
|
128
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
129
|
+
|
114
130
|
return _obj
|
@@ -30,6 +30,7 @@ class NotificationUpdate(BaseModel):
|
|
30
30
|
|
31
31
|
viewed: Optional[StrictBool] = None
|
32
32
|
sent: Optional[StrictBool] = None
|
33
|
+
additional_properties: Dict[str, Any] = {}
|
33
34
|
__properties: ClassVar[List[str]] = ["viewed", "sent"]
|
34
35
|
|
35
36
|
model_config = ConfigDict(
|
@@ -61,14 +62,24 @@ class NotificationUpdate(BaseModel):
|
|
61
62
|
* `None` is only added to the output dict for nullable fields that
|
62
63
|
were set at model initialization. Other fields with value `None`
|
63
64
|
are ignored.
|
65
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
64
66
|
"""
|
65
|
-
excluded_fields: Set[str] = set(
|
67
|
+
excluded_fields: Set[str] = set(
|
68
|
+
[
|
69
|
+
"additional_properties",
|
70
|
+
]
|
71
|
+
)
|
66
72
|
|
67
73
|
_dict = self.model_dump(
|
68
74
|
by_alias=True,
|
69
75
|
exclude=excluded_fields,
|
70
76
|
exclude_none=True,
|
71
77
|
)
|
78
|
+
# puts key-value pairs in additional_properties in the top level
|
79
|
+
if self.additional_properties is not None:
|
80
|
+
for _key, _value in self.additional_properties.items():
|
81
|
+
_dict[_key] = _value
|
82
|
+
|
72
83
|
# set to None if viewed (nullable) is None
|
73
84
|
# and model_fields_set contains the field
|
74
85
|
if self.viewed is None and "viewed" in self.model_fields_set:
|
@@ -93,4 +104,9 @@ class NotificationUpdate(BaseModel):
|
|
93
104
|
_obj = cls.model_validate(
|
94
105
|
{"viewed": obj.get("viewed"), "sent": obj.get("sent")}
|
95
106
|
)
|
107
|
+
# store additional fields in additional_properties
|
108
|
+
for _key in obj.keys():
|
109
|
+
if _key not in cls.__properties:
|
110
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
111
|
+
|
96
112
|
return _obj
|
@@ -0,0 +1,88 @@
|
|
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
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
|
26
|
+
class OrdersCount(BaseModel):
|
27
|
+
"""
|
28
|
+
The number of orders for a user by day
|
29
|
+
""" # noqa: E501
|
30
|
+
|
31
|
+
timestamp: StrictInt = Field(
|
32
|
+
description="Timestamp of the latest order for the day"
|
33
|
+
)
|
34
|
+
count: StrictInt = Field(description="The number of orders for the day")
|
35
|
+
__properties: ClassVar[List[str]] = ["timestamp", "count"]
|
36
|
+
|
37
|
+
model_config = ConfigDict(
|
38
|
+
populate_by_name=True,
|
39
|
+
validate_assignment=True,
|
40
|
+
protected_namespaces=(),
|
41
|
+
)
|
42
|
+
|
43
|
+
def to_str(self) -> str:
|
44
|
+
"""Returns the string representation of the model using alias"""
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
|
+
|
47
|
+
def to_json(self) -> str:
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
50
|
+
return json.dumps(self.to_dict())
|
51
|
+
|
52
|
+
@classmethod
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
54
|
+
"""Create an instance of OrdersCount from a JSON string"""
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
56
|
+
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
59
|
+
|
60
|
+
This has the following differences from calling pydantic's
|
61
|
+
`self.model_dump(by_alias=True)`:
|
62
|
+
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
64
|
+
were set at model initialization. Other fields with value `None`
|
65
|
+
are ignored.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([])
|
68
|
+
|
69
|
+
_dict = self.model_dump(
|
70
|
+
by_alias=True,
|
71
|
+
exclude=excluded_fields,
|
72
|
+
exclude_none=True,
|
73
|
+
)
|
74
|
+
return _dict
|
75
|
+
|
76
|
+
@classmethod
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
78
|
+
"""Create an instance of OrdersCount from a dict"""
|
79
|
+
if obj is None:
|
80
|
+
return None
|
81
|
+
|
82
|
+
if not isinstance(obj, dict):
|
83
|
+
return cls.model_validate(obj)
|
84
|
+
|
85
|
+
_obj = cls.model_validate(
|
86
|
+
{"timestamp": obj.get("timestamp"), "count": obj.get("count")}
|
87
|
+
)
|
88
|
+
return _obj
|
@@ -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.futures_trading_action import FuturesTradingAction
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class PaginatedResponseFuturesTradingAction(BaseModel):
|
28
|
+
"""
|
29
|
+
PaginatedResponseFuturesTradingAction
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
data: List[FuturesTradingAction]
|
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 PaginatedResponseFuturesTradingAction 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 PaginatedResponseFuturesTradingAction 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
|
+
[FuturesTradingAction.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,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,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
|
@@ -0,0 +1,109 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
|
26
|
+
class SpotBalance(BaseModel):
|
27
|
+
"""
|
28
|
+
Model for spot balance
|
29
|
+
""" # noqa: E501
|
30
|
+
|
31
|
+
asset: StrictStr = Field(description="Asset/Currency code")
|
32
|
+
balance: Union[StrictFloat, StrictInt] = Field(description="Balance of the asset")
|
33
|
+
available: Union[StrictFloat, StrictInt] = Field(
|
34
|
+
description="Available balance for trading/withdrawal"
|
35
|
+
)
|
36
|
+
frozen: Union[StrictFloat, StrictInt] = Field(
|
37
|
+
description="Frozen funds not available for use"
|
38
|
+
)
|
39
|
+
allocated: Optional[Union[StrictFloat, StrictInt]] = Field(
|
40
|
+
default=0, description="Allocated balance for bots. Added on runtime."
|
41
|
+
)
|
42
|
+
__properties: ClassVar[List[str]] = [
|
43
|
+
"asset",
|
44
|
+
"balance",
|
45
|
+
"available",
|
46
|
+
"frozen",
|
47
|
+
"allocated",
|
48
|
+
]
|
49
|
+
|
50
|
+
model_config = ConfigDict(
|
51
|
+
populate_by_name=True,
|
52
|
+
validate_assignment=True,
|
53
|
+
protected_namespaces=(),
|
54
|
+
)
|
55
|
+
|
56
|
+
def to_str(self) -> str:
|
57
|
+
"""Returns the string representation of the model using alias"""
|
58
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
59
|
+
|
60
|
+
def to_json(self) -> str:
|
61
|
+
"""Returns the JSON representation of the model using alias"""
|
62
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
63
|
+
return json.dumps(self.to_dict())
|
64
|
+
|
65
|
+
@classmethod
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
67
|
+
"""Create an instance of SpotBalance from a JSON string"""
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
69
|
+
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
72
|
+
|
73
|
+
This has the following differences from calling pydantic's
|
74
|
+
`self.model_dump(by_alias=True)`:
|
75
|
+
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
77
|
+
were set at model initialization. Other fields with value `None`
|
78
|
+
are ignored.
|
79
|
+
"""
|
80
|
+
excluded_fields: Set[str] = set([])
|
81
|
+
|
82
|
+
_dict = self.model_dump(
|
83
|
+
by_alias=True,
|
84
|
+
exclude=excluded_fields,
|
85
|
+
exclude_none=True,
|
86
|
+
)
|
87
|
+
return _dict
|
88
|
+
|
89
|
+
@classmethod
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
91
|
+
"""Create an instance of SpotBalance from a dict"""
|
92
|
+
if obj is None:
|
93
|
+
return None
|
94
|
+
|
95
|
+
if not isinstance(obj, dict):
|
96
|
+
return cls.model_validate(obj)
|
97
|
+
|
98
|
+
_obj = cls.model_validate(
|
99
|
+
{
|
100
|
+
"asset": obj.get("asset"),
|
101
|
+
"balance": obj.get("balance"),
|
102
|
+
"available": obj.get("available"),
|
103
|
+
"frozen": obj.get("frozen"),
|
104
|
+
"allocated": (
|
105
|
+
obj.get("allocated") if obj.get("allocated") is not None else 0
|
106
|
+
),
|
107
|
+
}
|
108
|
+
)
|
109
|
+
return _obj
|