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
@@ -0,0 +1,107 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.trade.client.models.exchange import Exchange
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class ExchangeKeyCreate(BaseModel):
|
28
|
+
"""
|
29
|
+
Exchange key model for API create operations.
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
label: StrictStr = Field(description="Label for the API key")
|
33
|
+
api_key: StrictStr = Field(description="API key")
|
34
|
+
secret: StrictStr = Field(description="API secret")
|
35
|
+
passphrase: Optional[StrictStr] = None
|
36
|
+
exchange: Exchange = Field(description="The exchange the API key is for.")
|
37
|
+
__properties: ClassVar[List[str]] = [
|
38
|
+
"label",
|
39
|
+
"api_key",
|
40
|
+
"secret",
|
41
|
+
"passphrase",
|
42
|
+
"exchange",
|
43
|
+
]
|
44
|
+
|
45
|
+
model_config = ConfigDict(
|
46
|
+
populate_by_name=True,
|
47
|
+
validate_assignment=True,
|
48
|
+
protected_namespaces=(),
|
49
|
+
)
|
50
|
+
|
51
|
+
def to_str(self) -> str:
|
52
|
+
"""Returns the string representation of the model using alias"""
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
54
|
+
|
55
|
+
def to_json(self) -> str:
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
58
|
+
return json.dumps(self.to_dict())
|
59
|
+
|
60
|
+
@classmethod
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
62
|
+
"""Create an instance of ExchangeKeyCreate from a JSON string"""
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
64
|
+
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
67
|
+
|
68
|
+
This has the following differences from calling pydantic's
|
69
|
+
`self.model_dump(by_alias=True)`:
|
70
|
+
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
72
|
+
were set at model initialization. Other fields with value `None`
|
73
|
+
are ignored.
|
74
|
+
"""
|
75
|
+
excluded_fields: Set[str] = set([])
|
76
|
+
|
77
|
+
_dict = self.model_dump(
|
78
|
+
by_alias=True,
|
79
|
+
exclude=excluded_fields,
|
80
|
+
exclude_none=True,
|
81
|
+
)
|
82
|
+
# set to None if passphrase (nullable) is None
|
83
|
+
# and model_fields_set contains the field
|
84
|
+
if self.passphrase is None and "passphrase" in self.model_fields_set:
|
85
|
+
_dict["passphrase"] = None
|
86
|
+
|
87
|
+
return _dict
|
88
|
+
|
89
|
+
@classmethod
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
91
|
+
"""Create an instance of ExchangeKeyCreate 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
|
+
"label": obj.get("label"),
|
101
|
+
"api_key": obj.get("api_key"),
|
102
|
+
"secret": obj.get("secret"),
|
103
|
+
"passphrase": obj.get("passphrase"),
|
104
|
+
"exchange": obj.get("exchange"),
|
105
|
+
}
|
106
|
+
)
|
107
|
+
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)
|
@@ -17,37 +17,22 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import BaseModel, ConfigDict,
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
22
|
from typing import Optional, Set
|
23
23
|
from typing_extensions import Self
|
24
24
|
|
25
25
|
|
26
|
-
class
|
26
|
+
class ExchangeKeyUpdate(BaseModel):
|
27
27
|
"""
|
28
|
-
|
28
|
+
Exchange key model for API update operations.
|
29
29
|
""" # noqa: E501
|
30
30
|
|
31
|
-
|
32
|
-
updated_at: Optional[StrictInt] = None
|
33
|
-
id: Optional[StrictStr] = None
|
34
|
-
exchange: StrictStr = Field(description="Supported exchanges for trading")
|
31
|
+
label: Optional[StrictStr] = None
|
35
32
|
api_key: Optional[StrictStr] = None
|
36
33
|
secret: Optional[StrictStr] = None
|
37
34
|
passphrase: Optional[StrictStr] = None
|
38
|
-
|
39
|
-
user_id: Optional[StrictStr] = None
|
40
|
-
__properties: ClassVar[List[str]] = [
|
41
|
-
"created_at",
|
42
|
-
"updated_at",
|
43
|
-
"id",
|
44
|
-
"exchange",
|
45
|
-
"api_key",
|
46
|
-
"secret",
|
47
|
-
"passphrase",
|
48
|
-
"label",
|
49
|
-
"user_id",
|
50
|
-
]
|
35
|
+
__properties: ClassVar[List[str]] = ["label", "api_key", "secret", "passphrase"]
|
51
36
|
|
52
37
|
model_config = ConfigDict(
|
53
38
|
populate_by_name=True,
|
@@ -66,7 +51,7 @@ class ExchangeKeyModel(BaseModel):
|
|
66
51
|
|
67
52
|
@classmethod
|
68
53
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
69
|
-
"""Create an instance of
|
54
|
+
"""Create an instance of ExchangeKeyUpdate from a JSON string"""
|
70
55
|
return cls.from_dict(json.loads(json_str))
|
71
56
|
|
72
57
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -86,20 +71,10 @@ class ExchangeKeyModel(BaseModel):
|
|
86
71
|
exclude=excluded_fields,
|
87
72
|
exclude_none=True,
|
88
73
|
)
|
89
|
-
# set to None if
|
74
|
+
# set to None if label (nullable) is None
|
90
75
|
# and model_fields_set contains the field
|
91
|
-
if self.
|
92
|
-
_dict["
|
93
|
-
|
94
|
-
# set to None if updated_at (nullable) is None
|
95
|
-
# and model_fields_set contains the field
|
96
|
-
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
97
|
-
_dict["updated_at"] = None
|
98
|
-
|
99
|
-
# set to None if id (nullable) is None
|
100
|
-
# and model_fields_set contains the field
|
101
|
-
if self.id is None and "id" in self.model_fields_set:
|
102
|
-
_dict["id"] = None
|
76
|
+
if self.label is None and "label" in self.model_fields_set:
|
77
|
+
_dict["label"] = None
|
103
78
|
|
104
79
|
# set to None if api_key (nullable) is None
|
105
80
|
# and model_fields_set contains the field
|
@@ -116,16 +91,11 @@ class ExchangeKeyModel(BaseModel):
|
|
116
91
|
if self.passphrase is None and "passphrase" in self.model_fields_set:
|
117
92
|
_dict["passphrase"] = None
|
118
93
|
|
119
|
-
# set to None if user_id (nullable) is None
|
120
|
-
# and model_fields_set contains the field
|
121
|
-
if self.user_id is None and "user_id" in self.model_fields_set:
|
122
|
-
_dict["user_id"] = None
|
123
|
-
|
124
94
|
return _dict
|
125
95
|
|
126
96
|
@classmethod
|
127
97
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
128
|
-
"""Create an instance of
|
98
|
+
"""Create an instance of ExchangeKeyUpdate from a dict"""
|
129
99
|
if obj is None:
|
130
100
|
return None
|
131
101
|
|
@@ -134,15 +104,10 @@ class ExchangeKeyModel(BaseModel):
|
|
134
104
|
|
135
105
|
_obj = cls.model_validate(
|
136
106
|
{
|
137
|
-
"
|
138
|
-
"updated_at": obj.get("updated_at"),
|
139
|
-
"id": obj.get("id"),
|
140
|
-
"exchange": obj.get("exchange"),
|
107
|
+
"label": obj.get("label"),
|
141
108
|
"api_key": obj.get("api_key"),
|
142
109
|
"secret": obj.get("secret"),
|
143
110
|
"passphrase": obj.get("passphrase"),
|
144
|
-
"label": obj.get("label"),
|
145
|
-
"user_id": obj.get("user_id"),
|
146
111
|
}
|
147
112
|
)
|
148
113
|
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)
|
@@ -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)
|
@@ -29,6 +29,7 @@ from pydantic import (
|
|
29
29
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
30
30
|
from typing_extensions import Annotated
|
31
31
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
32
|
+
from crypticorn.trade.client.models.market_type import MarketType
|
32
33
|
from crypticorn.trade.client.models.tpsl import TPSL
|
33
34
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
34
35
|
from typing import Optional, Set
|
@@ -40,12 +41,19 @@ class FuturesTradingAction(BaseModel):
|
|
40
41
|
Model for futures trading actions
|
41
42
|
""" # noqa: E501
|
42
43
|
|
43
|
-
id: Optional[StrictStr] =
|
44
|
+
id: Optional[StrictStr] = Field(
|
45
|
+
default=None, description="Unique identifier for the resource"
|
46
|
+
)
|
47
|
+
created_at: Optional[StrictInt] = Field(
|
48
|
+
default=None, description="Timestamp of creation"
|
49
|
+
)
|
50
|
+
updated_at: Optional[StrictInt] = Field(
|
51
|
+
default=None, description="Timestamp of last update"
|
52
|
+
)
|
44
53
|
execution_id: Optional[StrictStr] = None
|
45
54
|
open_order_execution_id: Optional[StrictStr] = None
|
46
|
-
client_order_id: Optional[StrictStr] = None
|
47
55
|
action_type: TradingActionType = Field(description="The type of action.")
|
48
|
-
market_type:
|
56
|
+
market_type: MarketType = Field(description="The type of market the action is for.")
|
49
57
|
strategy_id: StrictStr = Field(description="UID for the strategy.")
|
50
58
|
symbol: StrictStr = Field(
|
51
59
|
description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)"
|
@@ -64,14 +72,16 @@ class FuturesTradingAction(BaseModel):
|
|
64
72
|
take_profit: Optional[List[TPSL]] = None
|
65
73
|
stop_loss: Optional[List[TPSL]] = None
|
66
74
|
expiry_timestamp: Optional[StrictInt] = None
|
75
|
+
client_order_id: Optional[StrictStr] = None
|
67
76
|
position_id: Optional[StrictStr] = None
|
68
77
|
leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
|
69
78
|
margin_mode: Optional[MarginMode] = None
|
70
79
|
__properties: ClassVar[List[str]] = [
|
71
80
|
"id",
|
81
|
+
"created_at",
|
82
|
+
"updated_at",
|
72
83
|
"execution_id",
|
73
84
|
"open_order_execution_id",
|
74
|
-
"client_order_id",
|
75
85
|
"action_type",
|
76
86
|
"market_type",
|
77
87
|
"strategy_id",
|
@@ -82,6 +92,7 @@ class FuturesTradingAction(BaseModel):
|
|
82
92
|
"take_profit",
|
83
93
|
"stop_loss",
|
84
94
|
"expiry_timestamp",
|
95
|
+
"client_order_id",
|
85
96
|
"position_id",
|
86
97
|
"leverage",
|
87
98
|
"margin_mode",
|
@@ -138,11 +149,6 @@ class FuturesTradingAction(BaseModel):
|
|
138
149
|
if _item_stop_loss:
|
139
150
|
_items.append(_item_stop_loss.to_dict())
|
140
151
|
_dict["stop_loss"] = _items
|
141
|
-
# set to None if id (nullable) is None
|
142
|
-
# and model_fields_set contains the field
|
143
|
-
if self.id is None and "id" in self.model_fields_set:
|
144
|
-
_dict["id"] = None
|
145
|
-
|
146
152
|
# set to None if execution_id (nullable) is None
|
147
153
|
# and model_fields_set contains the field
|
148
154
|
if self.execution_id is None and "execution_id" in self.model_fields_set:
|
@@ -156,11 +162,6 @@ class FuturesTradingAction(BaseModel):
|
|
156
162
|
):
|
157
163
|
_dict["open_order_execution_id"] = None
|
158
164
|
|
159
|
-
# set to None if client_order_id (nullable) is None
|
160
|
-
# and model_fields_set contains the field
|
161
|
-
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
162
|
-
_dict["client_order_id"] = None
|
163
|
-
|
164
165
|
# set to None if is_limit (nullable) is None
|
165
166
|
# and model_fields_set contains the field
|
166
167
|
if self.is_limit is None and "is_limit" in self.model_fields_set:
|
@@ -189,6 +190,11 @@ class FuturesTradingAction(BaseModel):
|
|
189
190
|
):
|
190
191
|
_dict["expiry_timestamp"] = None
|
191
192
|
|
193
|
+
# set to None if client_order_id (nullable) is None
|
194
|
+
# and model_fields_set contains the field
|
195
|
+
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
196
|
+
_dict["client_order_id"] = None
|
197
|
+
|
192
198
|
# set to None if position_id (nullable) is None
|
193
199
|
# and model_fields_set contains the field
|
194
200
|
if self.position_id is None and "position_id" in self.model_fields_set:
|
@@ -218,9 +224,10 @@ class FuturesTradingAction(BaseModel):
|
|
218
224
|
_obj = cls.model_validate(
|
219
225
|
{
|
220
226
|
"id": obj.get("id"),
|
227
|
+
"created_at": obj.get("created_at"),
|
228
|
+
"updated_at": obj.get("updated_at"),
|
221
229
|
"execution_id": obj.get("execution_id"),
|
222
230
|
"open_order_execution_id": obj.get("open_order_execution_id"),
|
223
|
-
"client_order_id": obj.get("client_order_id"),
|
224
231
|
"action_type": obj.get("action_type"),
|
225
232
|
"market_type": obj.get("market_type"),
|
226
233
|
"strategy_id": obj.get("strategy_id"),
|
@@ -239,6 +246,7 @@ class FuturesTradingAction(BaseModel):
|
|
239
246
|
else None
|
240
247
|
),
|
241
248
|
"expiry_timestamp": obj.get("expiry_timestamp"),
|
249
|
+
"client_order_id": obj.get("client_order_id"),
|
242
250
|
"position_id": obj.get("position_id"),
|
243
251
|
"leverage": (
|
244
252
|
obj.get("leverage") if obj.get("leverage") is not None else 1
|
@@ -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)
|
@@ -28,23 +28,23 @@ from pydantic import (
|
|
28
28
|
)
|
29
29
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
30
30
|
from typing_extensions import Annotated
|
31
|
+
from crypticorn.trade.client.models.margin_mode import MarginMode
|
32
|
+
from crypticorn.trade.client.models.market_type import MarketType
|
31
33
|
from crypticorn.trade.client.models.tpsl import TPSL
|
32
34
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
33
35
|
from typing import Optional, Set
|
34
36
|
from typing_extensions import Self
|
35
37
|
|
36
38
|
|
37
|
-
class
|
39
|
+
class FuturesTradingActionCreate(BaseModel):
|
38
40
|
"""
|
39
|
-
Model for
|
41
|
+
Model for sending futures trading actions
|
40
42
|
""" # noqa: E501
|
41
43
|
|
42
|
-
id: Optional[StrictStr] = None
|
43
44
|
execution_id: Optional[StrictStr] = None
|
44
45
|
open_order_execution_id: Optional[StrictStr] = None
|
45
|
-
client_order_id: Optional[StrictStr] = None
|
46
46
|
action_type: TradingActionType = Field(description="The type of action.")
|
47
|
-
market_type:
|
47
|
+
market_type: MarketType = Field(description="The type of market the action is for.")
|
48
48
|
strategy_id: StrictStr = Field(description="UID for the strategy.")
|
49
49
|
symbol: StrictStr = Field(
|
50
50
|
description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)"
|
@@ -63,12 +63,11 @@ class SpotTradingAction(BaseModel):
|
|
63
63
|
take_profit: Optional[List[TPSL]] = None
|
64
64
|
stop_loss: Optional[List[TPSL]] = None
|
65
65
|
expiry_timestamp: Optional[StrictInt] = None
|
66
|
-
|
66
|
+
leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
|
67
|
+
margin_mode: Optional[MarginMode] = None
|
67
68
|
__properties: ClassVar[List[str]] = [
|
68
|
-
"id",
|
69
69
|
"execution_id",
|
70
70
|
"open_order_execution_id",
|
71
|
-
"client_order_id",
|
72
71
|
"action_type",
|
73
72
|
"market_type",
|
74
73
|
"strategy_id",
|
@@ -79,7 +78,8 @@ class SpotTradingAction(BaseModel):
|
|
79
78
|
"take_profit",
|
80
79
|
"stop_loss",
|
81
80
|
"expiry_timestamp",
|
82
|
-
"
|
81
|
+
"leverage",
|
82
|
+
"margin_mode",
|
83
83
|
]
|
84
84
|
|
85
85
|
model_config = ConfigDict(
|
@@ -99,7 +99,7 @@ class SpotTradingAction(BaseModel):
|
|
99
99
|
|
100
100
|
@classmethod
|
101
101
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
102
|
-
"""Create an instance of
|
102
|
+
"""Create an instance of FuturesTradingActionCreate from a JSON string"""
|
103
103
|
return cls.from_dict(json.loads(json_str))
|
104
104
|
|
105
105
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -133,11 +133,6 @@ class SpotTradingAction(BaseModel):
|
|
133
133
|
if _item_stop_loss:
|
134
134
|
_items.append(_item_stop_loss.to_dict())
|
135
135
|
_dict["stop_loss"] = _items
|
136
|
-
# set to None if id (nullable) is None
|
137
|
-
# and model_fields_set contains the field
|
138
|
-
if self.id is None and "id" in self.model_fields_set:
|
139
|
-
_dict["id"] = None
|
140
|
-
|
141
136
|
# set to None if execution_id (nullable) is None
|
142
137
|
# and model_fields_set contains the field
|
143
138
|
if self.execution_id is None and "execution_id" in self.model_fields_set:
|
@@ -151,11 +146,6 @@ class SpotTradingAction(BaseModel):
|
|
151
146
|
):
|
152
147
|
_dict["open_order_execution_id"] = None
|
153
148
|
|
154
|
-
# set to None if client_order_id (nullable) is None
|
155
|
-
# and model_fields_set contains the field
|
156
|
-
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
157
|
-
_dict["client_order_id"] = None
|
158
|
-
|
159
149
|
# set to None if is_limit (nullable) is None
|
160
150
|
# and model_fields_set contains the field
|
161
151
|
if self.is_limit is None and "is_limit" in self.model_fields_set:
|
@@ -184,16 +174,21 @@ class SpotTradingAction(BaseModel):
|
|
184
174
|
):
|
185
175
|
_dict["expiry_timestamp"] = None
|
186
176
|
|
187
|
-
# set to None if
|
177
|
+
# set to None if leverage (nullable) is None
|
188
178
|
# and model_fields_set contains the field
|
189
|
-
if self.
|
190
|
-
_dict["
|
179
|
+
if self.leverage is None and "leverage" in self.model_fields_set:
|
180
|
+
_dict["leverage"] = None
|
181
|
+
|
182
|
+
# set to None if margin_mode (nullable) is None
|
183
|
+
# and model_fields_set contains the field
|
184
|
+
if self.margin_mode is None and "margin_mode" in self.model_fields_set:
|
185
|
+
_dict["margin_mode"] = None
|
191
186
|
|
192
187
|
return _dict
|
193
188
|
|
194
189
|
@classmethod
|
195
190
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
196
|
-
"""Create an instance of
|
191
|
+
"""Create an instance of FuturesTradingActionCreate from a dict"""
|
197
192
|
if obj is None:
|
198
193
|
return None
|
199
194
|
|
@@ -202,10 +197,8 @@ class SpotTradingAction(BaseModel):
|
|
202
197
|
|
203
198
|
_obj = cls.model_validate(
|
204
199
|
{
|
205
|
-
"id": obj.get("id"),
|
206
200
|
"execution_id": obj.get("execution_id"),
|
207
201
|
"open_order_execution_id": obj.get("open_order_execution_id"),
|
208
|
-
"client_order_id": obj.get("client_order_id"),
|
209
202
|
"action_type": obj.get("action_type"),
|
210
203
|
"market_type": obj.get("market_type"),
|
211
204
|
"strategy_id": obj.get("strategy_id"),
|
@@ -224,7 +217,10 @@ class SpotTradingAction(BaseModel):
|
|
224
217
|
else None
|
225
218
|
),
|
226
219
|
"expiry_timestamp": obj.get("expiry_timestamp"),
|
227
|
-
"
|
220
|
+
"leverage": (
|
221
|
+
obj.get("leverage") if obj.get("leverage") is not None else 1
|
222
|
+
),
|
223
|
+
"margin_mode": obj.get("margin_mode"),
|
228
224
|
}
|
229
225
|
)
|
230
226
|
return _obj
|
@@ -0,0 +1,38 @@
|
|
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 json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class LogLevel(str, Enum):
|
22
|
+
"""
|
23
|
+
LogLevel
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
DEBUG = "DEBUG"
|
30
|
+
INFO = "INFO"
|
31
|
+
WARNING = "WARNING"
|
32
|
+
ERROR = "ERROR"
|
33
|
+
CRITICAL = "CRITICAL"
|
34
|
+
|
35
|
+
@classmethod
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
37
|
+
"""Create an instance of LogLevel from a JSON string"""
|
38
|
+
return cls(json.loads(json_str))
|
@@ -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)
|
@@ -0,0 +1,35 @@
|
|
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 json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class MarketType(str, Enum):
|
22
|
+
"""
|
23
|
+
Market types
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
SPOT = "spot"
|
30
|
+
FUTURES = "futures"
|
31
|
+
|
32
|
+
@classmethod
|
33
|
+
def from_json(cls, json_str: str) -> Self:
|
34
|
+
"""Create an instance of MarketType from a JSON string"""
|
35
|
+
return cls(json.loads(json_str))
|