crypticorn 2.11.6__py3-none-any.whl → 2.11.8__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/common/errors.py +14 -3
- crypticorn/trade/client/__init__.py +27 -9
- crypticorn/trade/client/api/__init__.py +1 -0
- crypticorn/trade/client/api/admin_api.py +1455 -0
- crypticorn/trade/client/api/api_keys_api.py +60 -58
- crypticorn/trade/client/api/bots_api.py +289 -48
- crypticorn/trade/client/api/exchanges_api.py +474 -17
- crypticorn/trade/client/api/futures_trading_panel_api.py +1 -1
- crypticorn/trade/client/api/notifications_api.py +80 -96
- crypticorn/trade/client/api/orders_api.py +7 -7
- crypticorn/trade/client/api/status_api.py +5 -232
- crypticorn/trade/client/api/strategies_api.py +55 -54
- crypticorn/trade/client/api/trading_actions_api.py +42 -38
- crypticorn/trade/client/api_client.py +1 -1
- crypticorn/trade/client/configuration.py +1 -1
- crypticorn/trade/client/exceptions.py +1 -1
- crypticorn/trade/client/models/__init__.py +26 -9
- crypticorn/trade/client/models/api_error_identifier.py +116 -0
- crypticorn/trade/client/models/api_error_level.py +37 -0
- crypticorn/trade/client/models/api_error_type.py +37 -0
- crypticorn/trade/client/models/{bot_model.py → bot.py} +59 -60
- crypticorn/trade/client/models/bot_create.py +104 -0
- crypticorn/trade/client/models/bot_status.py +1 -1
- crypticorn/trade/client/models/bot_update.py +107 -0
- crypticorn/trade/client/models/exception_detail.py +8 -5
- crypticorn/trade/client/models/exchange.py +36 -0
- crypticorn/trade/client/models/exchange_key.py +111 -0
- crypticorn/trade/client/models/exchange_key_create.py +107 -0
- crypticorn/trade/client/models/{exchange_key_model.py → exchange_key_update.py} +12 -47
- crypticorn/trade/client/models/execution_ids.py +1 -1
- crypticorn/trade/client/models/futures_balance.py +1 -1
- crypticorn/trade/client/models/futures_trading_action.py +24 -16
- crypticorn/trade/client/models/{spot_trading_action.py → futures_trading_action_create.py} +24 -28
- crypticorn/trade/client/models/log_level.py +38 -0
- crypticorn/trade/client/models/margin_mode.py +1 -1
- crypticorn/trade/client/models/market_type.py +35 -0
- crypticorn/trade/client/models/{notification_model.py → notification.py} +35 -40
- crypticorn/trade/client/models/notification_create.py +114 -0
- crypticorn/trade/client/models/notification_update.py +96 -0
- crypticorn/trade/client/models/{order_model.py → order.py} +66 -59
- crypticorn/trade/client/models/order_status.py +1 -1
- crypticorn/trade/client/models/post_futures_action.py +1 -1
- crypticorn/trade/client/models/{action_model.py → spot_trading_action_create.py} +7 -65
- crypticorn/trade/client/models/{strategy_model_input.py → strategy.py} +32 -31
- crypticorn/trade/client/models/{strategy_model_output.py → strategy_create.py} +22 -36
- crypticorn/trade/client/models/strategy_exchange_info.py +4 -3
- crypticorn/trade/client/models/strategy_update.py +147 -0
- crypticorn/trade/client/models/tpsl.py +1 -1
- crypticorn/trade/client/models/trading_action_type.py +1 -1
- crypticorn/trade/client/rest.py +1 -1
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/METADATA +1 -1
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/RECORD +56 -42
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/WHEEL +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.8.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Trading API
|
5
5
|
|
6
|
-
API for automated trading and exchange interface
|
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
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -19,38 +19,53 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.trade.client.models.api_error_level import ApiErrorLevel
|
24
|
+
from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
22
25
|
from typing import Optional, Set
|
23
26
|
from typing_extensions import Self
|
24
27
|
|
25
28
|
|
26
|
-
class
|
29
|
+
class Notification(BaseModel):
|
27
30
|
"""
|
28
|
-
|
31
|
+
Notification model for read operations.
|
29
32
|
""" # noqa: E501
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
user_id: StrictStr = Field(description="UID for the user")
|
35
|
+
id: Optional[StrictStr] = Field(
|
36
|
+
default=None, description="Unique identifier for the resource"
|
37
|
+
)
|
38
|
+
created_at: Optional[StrictInt] = Field(
|
39
|
+
default=None, description="Timestamp of creation"
|
40
|
+
)
|
41
|
+
updated_at: Optional[StrictInt] = Field(
|
42
|
+
default=None, description="Timestamp of last update"
|
43
|
+
)
|
38
44
|
viewed: Optional[StrictBool] = Field(
|
39
45
|
default=False, description="Whether the notification has been marked as seen"
|
40
46
|
)
|
41
47
|
sent: Optional[StrictBool] = Field(
|
42
48
|
default=False, description="Whether the notification has been sent as an email"
|
43
49
|
)
|
50
|
+
identifier: ApiErrorIdentifier = Field(
|
51
|
+
description="Identifier string. Must match the mapping key in the frontend."
|
52
|
+
)
|
53
|
+
level: ApiErrorLevel = Field(
|
54
|
+
description="Level of the notification. Of type ApiErrorLevel"
|
55
|
+
)
|
56
|
+
type: ApiErrorType = Field(
|
57
|
+
description="Type of the notification. Of type ApiErrorType"
|
58
|
+
)
|
44
59
|
__properties: ClassVar[List[str]] = [
|
60
|
+
"user_id",
|
61
|
+
"id",
|
45
62
|
"created_at",
|
46
63
|
"updated_at",
|
47
|
-
"
|
64
|
+
"viewed",
|
65
|
+
"sent",
|
48
66
|
"identifier",
|
49
67
|
"level",
|
50
68
|
"type",
|
51
|
-
"user_id",
|
52
|
-
"viewed",
|
53
|
-
"sent",
|
54
69
|
]
|
55
70
|
|
56
71
|
model_config = ConfigDict(
|
@@ -70,7 +85,7 @@ class NotificationModel(BaseModel):
|
|
70
85
|
|
71
86
|
@classmethod
|
72
87
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
73
|
-
"""Create an instance of
|
88
|
+
"""Create an instance of Notification from a JSON string"""
|
74
89
|
return cls.from_dict(json.loads(json_str))
|
75
90
|
|
76
91
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -90,31 +105,11 @@ class NotificationModel(BaseModel):
|
|
90
105
|
exclude=excluded_fields,
|
91
106
|
exclude_none=True,
|
92
107
|
)
|
93
|
-
# set to None if created_at (nullable) is None
|
94
|
-
# and model_fields_set contains the field
|
95
|
-
if self.created_at is None and "created_at" in self.model_fields_set:
|
96
|
-
_dict["created_at"] = None
|
97
|
-
|
98
|
-
# set to None if updated_at (nullable) is None
|
99
|
-
# and model_fields_set contains the field
|
100
|
-
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
101
|
-
_dict["updated_at"] = None
|
102
|
-
|
103
|
-
# set to None if id (nullable) is None
|
104
|
-
# and model_fields_set contains the field
|
105
|
-
if self.id is None and "id" in self.model_fields_set:
|
106
|
-
_dict["id"] = None
|
107
|
-
|
108
|
-
# set to None if user_id (nullable) is None
|
109
|
-
# and model_fields_set contains the field
|
110
|
-
if self.user_id is None and "user_id" in self.model_fields_set:
|
111
|
-
_dict["user_id"] = None
|
112
|
-
|
113
108
|
return _dict
|
114
109
|
|
115
110
|
@classmethod
|
116
111
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
117
|
-
"""Create an instance of
|
112
|
+
"""Create an instance of Notification from a dict"""
|
118
113
|
if obj is None:
|
119
114
|
return None
|
120
115
|
|
@@ -123,15 +118,15 @@ class NotificationModel(BaseModel):
|
|
123
118
|
|
124
119
|
_obj = cls.model_validate(
|
125
120
|
{
|
121
|
+
"user_id": obj.get("user_id"),
|
122
|
+
"id": obj.get("id"),
|
126
123
|
"created_at": obj.get("created_at"),
|
127
124
|
"updated_at": obj.get("updated_at"),
|
128
|
-
"
|
125
|
+
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
126
|
+
"sent": obj.get("sent") if obj.get("sent") is not None else False,
|
129
127
|
"identifier": obj.get("identifier"),
|
130
128
|
"level": obj.get("level"),
|
131
129
|
"type": obj.get("type"),
|
132
|
-
"user_id": obj.get("user_id"),
|
133
|
-
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
134
|
-
"sent": obj.get("sent") if obj.get("sent") is not None else False,
|
135
130
|
}
|
136
131
|
)
|
137
132
|
return _obj
|
@@ -0,0 +1,114 @@
|
|
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, StrictBool
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.trade.client.models.api_error_level import ApiErrorLevel
|
24
|
+
from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
|
29
|
+
class NotificationCreate(BaseModel):
|
30
|
+
"""
|
31
|
+
Notification model for create operations.
|
32
|
+
""" # noqa: E501
|
33
|
+
|
34
|
+
viewed: Optional[StrictBool] = Field(
|
35
|
+
default=False, description="Whether the notification has been marked as seen"
|
36
|
+
)
|
37
|
+
sent: Optional[StrictBool] = Field(
|
38
|
+
default=False, description="Whether the notification has been sent as an email"
|
39
|
+
)
|
40
|
+
identifier: ApiErrorIdentifier = Field(
|
41
|
+
description="Identifier string. Must match the mapping key in the frontend."
|
42
|
+
)
|
43
|
+
level: ApiErrorLevel = Field(
|
44
|
+
description="Level of the notification. Of type ApiErrorLevel"
|
45
|
+
)
|
46
|
+
type: ApiErrorType = Field(
|
47
|
+
description="Type of the notification. Of type ApiErrorType"
|
48
|
+
)
|
49
|
+
__properties: ClassVar[List[str]] = [
|
50
|
+
"viewed",
|
51
|
+
"sent",
|
52
|
+
"identifier",
|
53
|
+
"level",
|
54
|
+
"type",
|
55
|
+
]
|
56
|
+
|
57
|
+
model_config = ConfigDict(
|
58
|
+
populate_by_name=True,
|
59
|
+
validate_assignment=True,
|
60
|
+
protected_namespaces=(),
|
61
|
+
)
|
62
|
+
|
63
|
+
def to_str(self) -> str:
|
64
|
+
"""Returns the string representation of the model using alias"""
|
65
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
66
|
+
|
67
|
+
def to_json(self) -> str:
|
68
|
+
"""Returns the JSON representation of the model using alias"""
|
69
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
70
|
+
return json.dumps(self.to_dict())
|
71
|
+
|
72
|
+
@classmethod
|
73
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
74
|
+
"""Create an instance of NotificationCreate from a JSON string"""
|
75
|
+
return cls.from_dict(json.loads(json_str))
|
76
|
+
|
77
|
+
def to_dict(self) -> Dict[str, Any]:
|
78
|
+
"""Return the dictionary representation of the model using alias.
|
79
|
+
|
80
|
+
This has the following differences from calling pydantic's
|
81
|
+
`self.model_dump(by_alias=True)`:
|
82
|
+
|
83
|
+
* `None` is only added to the output dict for nullable fields that
|
84
|
+
were set at model initialization. Other fields with value `None`
|
85
|
+
are ignored.
|
86
|
+
"""
|
87
|
+
excluded_fields: Set[str] = set([])
|
88
|
+
|
89
|
+
_dict = self.model_dump(
|
90
|
+
by_alias=True,
|
91
|
+
exclude=excluded_fields,
|
92
|
+
exclude_none=True,
|
93
|
+
)
|
94
|
+
return _dict
|
95
|
+
|
96
|
+
@classmethod
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
98
|
+
"""Create an instance of NotificationCreate 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
|
+
{
|
107
|
+
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
108
|
+
"sent": obj.get("sent") if obj.get("sent") is not None else False,
|
109
|
+
"identifier": obj.get("identifier"),
|
110
|
+
"level": obj.get("level"),
|
111
|
+
"type": obj.get("type"),
|
112
|
+
}
|
113
|
+
)
|
114
|
+
return _obj
|
@@ -0,0 +1,96 @@
|
|
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, StrictBool
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
|
26
|
+
class NotificationUpdate(BaseModel):
|
27
|
+
"""
|
28
|
+
Notification model for API update operations.
|
29
|
+
""" # noqa: E501
|
30
|
+
|
31
|
+
viewed: Optional[StrictBool] = None
|
32
|
+
sent: Optional[StrictBool] = None
|
33
|
+
__properties: ClassVar[List[str]] = ["viewed", "sent"]
|
34
|
+
|
35
|
+
model_config = ConfigDict(
|
36
|
+
populate_by_name=True,
|
37
|
+
validate_assignment=True,
|
38
|
+
protected_namespaces=(),
|
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 NotificationUpdate 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
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
# set to None if viewed (nullable) is None
|
73
|
+
# and model_fields_set contains the field
|
74
|
+
if self.viewed is None and "viewed" in self.model_fields_set:
|
75
|
+
_dict["viewed"] = None
|
76
|
+
|
77
|
+
# set to None if sent (nullable) is None
|
78
|
+
# and model_fields_set contains the field
|
79
|
+
if self.sent is None and "sent" in self.model_fields_set:
|
80
|
+
_dict["sent"] = None
|
81
|
+
|
82
|
+
return _dict
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
86
|
+
"""Create an instance of NotificationUpdate from a dict"""
|
87
|
+
if obj is None:
|
88
|
+
return None
|
89
|
+
|
90
|
+
if not isinstance(obj, dict):
|
91
|
+
return cls.model_validate(obj)
|
92
|
+
|
93
|
+
_obj = cls.model_validate(
|
94
|
+
{"viewed": obj.get("viewed"), "sent": obj.get("sent")}
|
95
|
+
)
|
96
|
+
return _obj
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Trading API
|
5
5
|
|
6
|
-
API for automated trading and exchange interface
|
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
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -19,21 +19,31 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
24
|
+
from crypticorn.trade.client.models.exchange import Exchange
|
22
25
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
26
|
+
from crypticorn.trade.client.models.market_type import MarketType
|
23
27
|
from crypticorn.trade.client.models.order_status import OrderStatus
|
24
28
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
25
29
|
from typing import Optional, Set
|
26
30
|
from typing_extensions import Self
|
27
31
|
|
28
32
|
|
29
|
-
class
|
33
|
+
class Order(BaseModel):
|
30
34
|
"""
|
31
35
|
Response model for orders. All optional as the model is built step by step.
|
32
36
|
""" # noqa: E501
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
38
|
+
id: Optional[StrictStr] = Field(
|
39
|
+
default=None, description="Unique identifier for the resource"
|
40
|
+
)
|
41
|
+
created_at: Optional[StrictInt] = Field(
|
42
|
+
default=None, description="Timestamp of creation"
|
43
|
+
)
|
44
|
+
updated_at: Optional[StrictInt] = Field(
|
45
|
+
default=None, description="Timestamp of last update"
|
46
|
+
)
|
37
47
|
trading_action_id: Optional[StrictStr] = None
|
38
48
|
execution_id: Optional[StrictStr] = None
|
39
49
|
exchange_order_id: Optional[StrictStr] = None
|
@@ -42,32 +52,45 @@ class OrderModel(BaseModel):
|
|
42
52
|
user_id: Optional[StrictStr] = None
|
43
53
|
bot_id: Optional[StrictStr] = None
|
44
54
|
client_order_id: Optional[StrictStr] = None
|
45
|
-
exchange: Optional[
|
46
|
-
default=None, description="Supported exchanges for trading"
|
47
|
-
)
|
55
|
+
exchange: Optional[Exchange] = None
|
48
56
|
symbol: Optional[StrictStr] = None
|
49
57
|
common_symbol: Optional[StrictStr] = None
|
50
58
|
price: Optional[Union[StrictFloat, StrictInt]] = None
|
51
59
|
action_type: Optional[TradingActionType] = None
|
52
|
-
market_type: Optional[
|
60
|
+
market_type: Optional[MarketType] = None
|
53
61
|
margin_mode: Optional[MarginMode] = None
|
54
|
-
status_code: Optional[
|
55
|
-
default=None, description="API error identifiers"
|
56
|
-
)
|
62
|
+
status_code: Optional[ApiErrorIdentifier] = None
|
57
63
|
status: Optional[OrderStatus] = None
|
58
|
-
filled_perc: Optional[
|
59
|
-
|
60
|
-
|
64
|
+
filled_perc: Optional[
|
65
|
+
Union[
|
66
|
+
Annotated[float, Field(le=1.0, strict=True, ge=0.0)],
|
67
|
+
Annotated[int, Field(le=1, strict=True, ge=0)],
|
68
|
+
]
|
69
|
+
] = Field(default=0, description="Percentage of the order filled")
|
70
|
+
filled_qty: Optional[
|
71
|
+
Union[
|
72
|
+
Annotated[float, Field(strict=True, ge=0.0)],
|
73
|
+
Annotated[int, Field(strict=True, ge=0)],
|
74
|
+
]
|
75
|
+
] = Field(
|
76
|
+
default=0,
|
77
|
+
description="Quantity filled. Needed for pnl calculation. In the symbol's base currency.",
|
78
|
+
)
|
79
|
+
fee: Optional[Union[StrictFloat, StrictInt]] = Field(
|
80
|
+
default=0, description="Fees for the order"
|
81
|
+
)
|
61
82
|
leverage: Optional[Union[StrictFloat, StrictInt]] = None
|
62
83
|
order_details: Optional[Any] = Field(
|
63
84
|
default=None, description="Exchange specific details of the order"
|
64
85
|
)
|
65
|
-
pnl: Optional[Union[StrictFloat, StrictInt]] =
|
86
|
+
pnl: Optional[Union[StrictFloat, StrictInt]] = Field(
|
87
|
+
default=0, description="Profit and loss for the order"
|
88
|
+
)
|
66
89
|
order_time: Optional[StrictInt] = None
|
67
90
|
__properties: ClassVar[List[str]] = [
|
91
|
+
"id",
|
68
92
|
"created_at",
|
69
93
|
"updated_at",
|
70
|
-
"id",
|
71
94
|
"trading_action_id",
|
72
95
|
"execution_id",
|
73
96
|
"exchange_order_id",
|
@@ -111,7 +134,7 @@ class OrderModel(BaseModel):
|
|
111
134
|
|
112
135
|
@classmethod
|
113
136
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
114
|
-
"""Create an instance of
|
137
|
+
"""Create an instance of Order from a JSON string"""
|
115
138
|
return cls.from_dict(json.loads(json_str))
|
116
139
|
|
117
140
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -134,21 +157,6 @@ class OrderModel(BaseModel):
|
|
134
157
|
# override the default output from pydantic by calling `to_dict()` of order_details
|
135
158
|
if self.order_details:
|
136
159
|
_dict["order_details"] = self.order_details.to_dict()
|
137
|
-
# set to None if created_at (nullable) is None
|
138
|
-
# and model_fields_set contains the field
|
139
|
-
if self.created_at is None and "created_at" in self.model_fields_set:
|
140
|
-
_dict["created_at"] = None
|
141
|
-
|
142
|
-
# set to None if updated_at (nullable) is None
|
143
|
-
# and model_fields_set contains the field
|
144
|
-
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
145
|
-
_dict["updated_at"] = None
|
146
|
-
|
147
|
-
# set to None if id (nullable) is None
|
148
|
-
# and model_fields_set contains the field
|
149
|
-
if self.id is None and "id" in self.model_fields_set:
|
150
|
-
_dict["id"] = None
|
151
|
-
|
152
160
|
# set to None if trading_action_id (nullable) is None
|
153
161
|
# and model_fields_set contains the field
|
154
162
|
if (
|
@@ -195,6 +203,11 @@ class OrderModel(BaseModel):
|
|
195
203
|
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
196
204
|
_dict["client_order_id"] = None
|
197
205
|
|
206
|
+
# set to None if exchange (nullable) is None
|
207
|
+
# and model_fields_set contains the field
|
208
|
+
if self.exchange is None and "exchange" in self.model_fields_set:
|
209
|
+
_dict["exchange"] = None
|
210
|
+
|
198
211
|
# set to None if symbol (nullable) is None
|
199
212
|
# and model_fields_set contains the field
|
200
213
|
if self.symbol is None and "symbol" in self.model_fields_set:
|
@@ -215,31 +228,26 @@ class OrderModel(BaseModel):
|
|
215
228
|
if self.action_type is None and "action_type" in self.model_fields_set:
|
216
229
|
_dict["action_type"] = None
|
217
230
|
|
231
|
+
# set to None if market_type (nullable) is None
|
232
|
+
# and model_fields_set contains the field
|
233
|
+
if self.market_type is None and "market_type" in self.model_fields_set:
|
234
|
+
_dict["market_type"] = None
|
235
|
+
|
218
236
|
# set to None if margin_mode (nullable) is None
|
219
237
|
# and model_fields_set contains the field
|
220
238
|
if self.margin_mode is None and "margin_mode" in self.model_fields_set:
|
221
239
|
_dict["margin_mode"] = None
|
222
240
|
|
241
|
+
# set to None if status_code (nullable) is None
|
242
|
+
# and model_fields_set contains the field
|
243
|
+
if self.status_code is None and "status_code" in self.model_fields_set:
|
244
|
+
_dict["status_code"] = None
|
245
|
+
|
223
246
|
# set to None if status (nullable) is None
|
224
247
|
# and model_fields_set contains the field
|
225
248
|
if self.status is None and "status" in self.model_fields_set:
|
226
249
|
_dict["status"] = None
|
227
250
|
|
228
|
-
# set to None if filled_perc (nullable) is None
|
229
|
-
# and model_fields_set contains the field
|
230
|
-
if self.filled_perc is None and "filled_perc" in self.model_fields_set:
|
231
|
-
_dict["filled_perc"] = None
|
232
|
-
|
233
|
-
# set to None if filled_qty (nullable) is None
|
234
|
-
# and model_fields_set contains the field
|
235
|
-
if self.filled_qty is None and "filled_qty" in self.model_fields_set:
|
236
|
-
_dict["filled_qty"] = None
|
237
|
-
|
238
|
-
# set to None if fee (nullable) is None
|
239
|
-
# and model_fields_set contains the field
|
240
|
-
if self.fee is None and "fee" in self.model_fields_set:
|
241
|
-
_dict["fee"] = None
|
242
|
-
|
243
251
|
# set to None if leverage (nullable) is None
|
244
252
|
# and model_fields_set contains the field
|
245
253
|
if self.leverage is None and "leverage" in self.model_fields_set:
|
@@ -250,11 +258,6 @@ class OrderModel(BaseModel):
|
|
250
258
|
if self.order_details is None and "order_details" in self.model_fields_set:
|
251
259
|
_dict["order_details"] = None
|
252
260
|
|
253
|
-
# set to None if pnl (nullable) is None
|
254
|
-
# and model_fields_set contains the field
|
255
|
-
if self.pnl is None and "pnl" in self.model_fields_set:
|
256
|
-
_dict["pnl"] = None
|
257
|
-
|
258
261
|
# set to None if order_time (nullable) is None
|
259
262
|
# and model_fields_set contains the field
|
260
263
|
if self.order_time is None and "order_time" in self.model_fields_set:
|
@@ -264,7 +267,7 @@ class OrderModel(BaseModel):
|
|
264
267
|
|
265
268
|
@classmethod
|
266
269
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
267
|
-
"""Create an instance of
|
270
|
+
"""Create an instance of Order from a dict"""
|
268
271
|
if obj is None:
|
269
272
|
return None
|
270
273
|
|
@@ -273,9 +276,9 @@ class OrderModel(BaseModel):
|
|
273
276
|
|
274
277
|
_obj = cls.model_validate(
|
275
278
|
{
|
279
|
+
"id": obj.get("id"),
|
276
280
|
"created_at": obj.get("created_at"),
|
277
281
|
"updated_at": obj.get("updated_at"),
|
278
|
-
"id": obj.get("id"),
|
279
282
|
"trading_action_id": obj.get("trading_action_id"),
|
280
283
|
"execution_id": obj.get("execution_id"),
|
281
284
|
"exchange_order_id": obj.get("exchange_order_id"),
|
@@ -293,16 +296,20 @@ class OrderModel(BaseModel):
|
|
293
296
|
"margin_mode": obj.get("margin_mode"),
|
294
297
|
"status_code": obj.get("status_code"),
|
295
298
|
"status": obj.get("status"),
|
296
|
-
"filled_perc":
|
297
|
-
|
298
|
-
|
299
|
+
"filled_perc": (
|
300
|
+
obj.get("filled_perc") if obj.get("filled_perc") is not None else 0
|
301
|
+
),
|
302
|
+
"filled_qty": (
|
303
|
+
obj.get("filled_qty") if obj.get("filled_qty") is not None else 0
|
304
|
+
),
|
305
|
+
"fee": obj.get("fee") if obj.get("fee") is not None else 0,
|
299
306
|
"leverage": obj.get("leverage"),
|
300
307
|
"order_details": (
|
301
308
|
AnyOf.from_dict(obj["order_details"])
|
302
309
|
if obj.get("order_details") is not None
|
303
310
|
else None
|
304
311
|
),
|
305
|
-
"pnl": obj.get("pnl"),
|
312
|
+
"pnl": obj.get("pnl") if obj.get("pnl") is not None else 0,
|
306
313
|
"order_time": obj.get("order_time"),
|
307
314
|
}
|
308
315
|
)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Trading API
|
5
5
|
|
6
|
-
API for automated trading and exchange interface
|
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
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Trading API
|
5
5
|
|
6
|
-
API for automated trading and exchange interface
|
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
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|