crypticorn 2.11.6__py3-none-any.whl → 2.11.7__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 +3 -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 +49 -48
- 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} +36 -31
- 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} +25 -33
- crypticorn/trade/client/models/{strategy_model_output.py → strategy_create.py} +16 -39
- 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.7.dist-info}/METADATA +1 -1
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/RECORD +56 -42
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/WHEEL +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.11.6.dist-info → crypticorn-2.11.7.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,30 @@ 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 crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.trade.client.models.exchange import Exchange
|
22
24
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
25
|
+
from crypticorn.trade.client.models.market_type import MarketType
|
23
26
|
from crypticorn.trade.client.models.order_status import OrderStatus
|
24
27
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
25
28
|
from typing import Optional, Set
|
26
29
|
from typing_extensions import Self
|
27
30
|
|
28
31
|
|
29
|
-
class
|
32
|
+
class Order(BaseModel):
|
30
33
|
"""
|
31
34
|
Response model for orders. All optional as the model is built step by step.
|
32
35
|
""" # noqa: E501
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
id: Optional[StrictStr] = Field(
|
38
|
+
default=None, description="Unique identifier for the resource"
|
39
|
+
)
|
40
|
+
created_at: Optional[StrictInt] = Field(
|
41
|
+
default=None, description="Timestamp of creation"
|
42
|
+
)
|
43
|
+
updated_at: Optional[StrictInt] = Field(
|
44
|
+
default=None, description="Timestamp of last update"
|
45
|
+
)
|
37
46
|
trading_action_id: Optional[StrictStr] = None
|
38
47
|
execution_id: Optional[StrictStr] = None
|
39
48
|
exchange_order_id: Optional[StrictStr] = None
|
@@ -42,18 +51,14 @@ class OrderModel(BaseModel):
|
|
42
51
|
user_id: Optional[StrictStr] = None
|
43
52
|
bot_id: Optional[StrictStr] = None
|
44
53
|
client_order_id: Optional[StrictStr] = None
|
45
|
-
exchange: Optional[
|
46
|
-
default=None, description="Supported exchanges for trading"
|
47
|
-
)
|
54
|
+
exchange: Optional[Exchange] = None
|
48
55
|
symbol: Optional[StrictStr] = None
|
49
56
|
common_symbol: Optional[StrictStr] = None
|
50
57
|
price: Optional[Union[StrictFloat, StrictInt]] = None
|
51
58
|
action_type: Optional[TradingActionType] = None
|
52
|
-
market_type: Optional[
|
59
|
+
market_type: Optional[MarketType] = None
|
53
60
|
margin_mode: Optional[MarginMode] = None
|
54
|
-
status_code: Optional[
|
55
|
-
default=None, description="API error identifiers"
|
56
|
-
)
|
61
|
+
status_code: Optional[ApiErrorIdentifier] = None
|
57
62
|
status: Optional[OrderStatus] = None
|
58
63
|
filled_perc: Optional[Union[StrictFloat, StrictInt]] = None
|
59
64
|
filled_qty: Optional[Union[StrictFloat, StrictInt]] = None
|
@@ -65,9 +70,9 @@ class OrderModel(BaseModel):
|
|
65
70
|
pnl: Optional[Union[StrictFloat, StrictInt]] = None
|
66
71
|
order_time: Optional[StrictInt] = None
|
67
72
|
__properties: ClassVar[List[str]] = [
|
73
|
+
"id",
|
68
74
|
"created_at",
|
69
75
|
"updated_at",
|
70
|
-
"id",
|
71
76
|
"trading_action_id",
|
72
77
|
"execution_id",
|
73
78
|
"exchange_order_id",
|
@@ -111,7 +116,7 @@ class OrderModel(BaseModel):
|
|
111
116
|
|
112
117
|
@classmethod
|
113
118
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
114
|
-
"""Create an instance of
|
119
|
+
"""Create an instance of Order from a JSON string"""
|
115
120
|
return cls.from_dict(json.loads(json_str))
|
116
121
|
|
117
122
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -134,21 +139,6 @@ class OrderModel(BaseModel):
|
|
134
139
|
# override the default output from pydantic by calling `to_dict()` of order_details
|
135
140
|
if self.order_details:
|
136
141
|
_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
142
|
# set to None if trading_action_id (nullable) is None
|
153
143
|
# and model_fields_set contains the field
|
154
144
|
if (
|
@@ -195,6 +185,11 @@ class OrderModel(BaseModel):
|
|
195
185
|
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
196
186
|
_dict["client_order_id"] = None
|
197
187
|
|
188
|
+
# set to None if exchange (nullable) is None
|
189
|
+
# and model_fields_set contains the field
|
190
|
+
if self.exchange is None and "exchange" in self.model_fields_set:
|
191
|
+
_dict["exchange"] = None
|
192
|
+
|
198
193
|
# set to None if symbol (nullable) is None
|
199
194
|
# and model_fields_set contains the field
|
200
195
|
if self.symbol is None and "symbol" in self.model_fields_set:
|
@@ -215,11 +210,21 @@ class OrderModel(BaseModel):
|
|
215
210
|
if self.action_type is None and "action_type" in self.model_fields_set:
|
216
211
|
_dict["action_type"] = None
|
217
212
|
|
213
|
+
# set to None if market_type (nullable) is None
|
214
|
+
# and model_fields_set contains the field
|
215
|
+
if self.market_type is None and "market_type" in self.model_fields_set:
|
216
|
+
_dict["market_type"] = None
|
217
|
+
|
218
218
|
# set to None if margin_mode (nullable) is None
|
219
219
|
# and model_fields_set contains the field
|
220
220
|
if self.margin_mode is None and "margin_mode" in self.model_fields_set:
|
221
221
|
_dict["margin_mode"] = None
|
222
222
|
|
223
|
+
# set to None if status_code (nullable) is None
|
224
|
+
# and model_fields_set contains the field
|
225
|
+
if self.status_code is None and "status_code" in self.model_fields_set:
|
226
|
+
_dict["status_code"] = None
|
227
|
+
|
223
228
|
# set to None if status (nullable) is None
|
224
229
|
# and model_fields_set contains the field
|
225
230
|
if self.status is None and "status" in self.model_fields_set:
|
@@ -264,7 +269,7 @@ class OrderModel(BaseModel):
|
|
264
269
|
|
265
270
|
@classmethod
|
266
271
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
267
|
-
"""Create an instance of
|
272
|
+
"""Create an instance of Order from a dict"""
|
268
273
|
if obj is None:
|
269
274
|
return None
|
270
275
|
|
@@ -273,9 +278,9 @@ class OrderModel(BaseModel):
|
|
273
278
|
|
274
279
|
_obj = cls.model_validate(
|
275
280
|
{
|
281
|
+
"id": obj.get("id"),
|
276
282
|
"created_at": obj.get("created_at"),
|
277
283
|
"updated_at": obj.get("updated_at"),
|
278
|
-
"id": obj.get("id"),
|
279
284
|
"trading_action_id": obj.get("trading_action_id"),
|
280
285
|
"execution_id": obj.get("execution_id"),
|
281
286
|
"exchange_order_id": obj.get("exchange_order_id"),
|
@@ -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)
|