crypticorn 2.4.6__py3-none-any.whl → 2.4.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.
Files changed (52) hide show
  1. crypticorn/common/auth.py +7 -9
  2. crypticorn/common/errors.py +5 -0
  3. crypticorn/common/utils.py +15 -5
  4. crypticorn/klines/main.py +10 -5
  5. crypticorn/metrics/main.py +5 -4
  6. crypticorn/trade/client/__init__.py +6 -8
  7. crypticorn/trade/client/api/__init__.py +1 -0
  8. crypticorn/trade/client/api/api_keys_api.py +273 -167
  9. crypticorn/trade/client/api/bots_api.py +226 -140
  10. crypticorn/trade/client/api/exchanges_api.py +51 -31
  11. crypticorn/trade/client/api/futures_trading_panel_api.py +272 -169
  12. crypticorn/trade/client/api/notifications_api.py +323 -200
  13. crypticorn/trade/client/api/orders_api.py +60 -40
  14. crypticorn/trade/client/api/status_api.py +49 -31
  15. crypticorn/trade/client/api/strategies_api.py +223 -137
  16. crypticorn/trade/client/api/trading_actions_api.py +170 -106
  17. crypticorn/trade/client/api_client.py +153 -111
  18. crypticorn/trade/client/api_response.py +3 -2
  19. crypticorn/trade/client/configuration.py +115 -128
  20. crypticorn/trade/client/exceptions.py +21 -25
  21. crypticorn/trade/client/models/__init__.py +6 -8
  22. crypticorn/trade/client/models/action_model.py +54 -108
  23. crypticorn/trade/client/models/api_error_identifier.py +72 -76
  24. crypticorn/trade/client/models/api_error_level.py +11 -9
  25. crypticorn/trade/client/models/api_error_type.py +11 -9
  26. crypticorn/trade/client/models/bot_model.py +36 -57
  27. crypticorn/trade/client/models/bot_status.py +11 -9
  28. crypticorn/trade/client/models/exchange.py +9 -7
  29. crypticorn/trade/client/models/exchange_key_model.py +34 -44
  30. crypticorn/trade/client/models/execution_ids.py +18 -18
  31. crypticorn/trade/client/models/futures_balance.py +27 -43
  32. crypticorn/trade/client/models/futures_trading_action.py +50 -102
  33. crypticorn/trade/client/models/http_validation_error.py +15 -19
  34. crypticorn/trade/client/models/margin_mode.py +9 -7
  35. crypticorn/trade/client/models/market_type.py +9 -7
  36. crypticorn/trade/client/models/notification_model.py +32 -52
  37. crypticorn/trade/client/models/order_model.py +72 -112
  38. crypticorn/trade/client/models/order_status.py +12 -10
  39. crypticorn/trade/client/models/post_futures_action.py +16 -20
  40. crypticorn/trade/client/models/strategy_exchange_info.py +16 -15
  41. crypticorn/trade/client/models/strategy_model_input.py +33 -61
  42. crypticorn/trade/client/models/strategy_model_output.py +33 -61
  43. crypticorn/trade/client/models/tpsl.py +25 -39
  44. crypticorn/trade/client/models/trading_action_type.py +11 -9
  45. crypticorn/trade/client/models/validation_error.py +18 -24
  46. crypticorn/trade/client/models/validation_error_loc_inner.py +16 -37
  47. crypticorn/trade/client/rest.py +38 -23
  48. {crypticorn-2.4.6.dist-info → crypticorn-2.4.7.dist-info}/METADATA +8 -2
  49. {crypticorn-2.4.6.dist-info → crypticorn-2.4.7.dist-info}/RECORD +52 -52
  50. {crypticorn-2.4.6.dist-info → crypticorn-2.4.7.dist-info}/WHEEL +0 -0
  51. {crypticorn-2.4.6.dist-info → crypticorn-2.4.7.dist-info}/entry_points.txt +0 -0
  52. {crypticorn-2.4.6.dist-info → crypticorn-2.4.7.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -24,19 +24,15 @@ from crypticorn.trade.client.models.bot_status import BotStatus
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
 
27
-
28
27
  class BotModel(BaseModel):
29
28
  """
30
29
  BotModel
31
- """ # noqa: E501
32
-
30
+ """ # noqa: E501
33
31
  created_at: Optional[StrictInt] = None
34
32
  updated_at: Optional[StrictInt] = None
35
33
  id: Optional[StrictStr] = None
36
34
  name: StrictStr = Field(description="Name of the bot")
37
- strategy_id: StrictStr = Field(
38
- description="UID for the trading strategy used by the bot"
39
- )
35
+ strategy_id: StrictStr = Field(description="UID for the trading strategy used by the bot")
40
36
  api_key_id: StrictStr = Field(description="UID for the API key")
41
37
  allocation: StrictInt = Field(description="Initial allocation for the bot")
42
38
  status: BotStatus = Field(description="Status of the bot")
@@ -44,20 +40,7 @@ class BotModel(BaseModel):
44
40
  user_id: Optional[StrictStr] = None
45
41
  current_allocation: Optional[Union[StrictFloat, StrictInt]] = None
46
42
  current_exposure: Optional[Union[StrictFloat, StrictInt]] = None
47
- __properties: ClassVar[List[str]] = [
48
- "created_at",
49
- "updated_at",
50
- "id",
51
- "name",
52
- "strategy_id",
53
- "api_key_id",
54
- "allocation",
55
- "status",
56
- "status_code",
57
- "user_id",
58
- "current_allocation",
59
- "current_exposure",
60
- ]
43
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "name", "strategy_id", "api_key_id", "allocation", "status", "status_code", "user_id", "current_allocation", "current_exposure"]
61
44
 
62
45
  model_config = ConfigDict(
63
46
  populate_by_name=True,
@@ -65,6 +48,7 @@ class BotModel(BaseModel):
65
48
  protected_namespaces=(),
66
49
  )
67
50
 
51
+
68
52
  def to_str(self) -> str:
69
53
  """Returns the string representation of the model using alias"""
70
54
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -89,7 +73,8 @@ class BotModel(BaseModel):
89
73
  were set at model initialization. Other fields with value `None`
90
74
  are ignored.
91
75
  """
92
- excluded_fields: Set[str] = set([])
76
+ excluded_fields: Set[str] = set([
77
+ ])
93
78
 
94
79
  _dict = self.model_dump(
95
80
  by_alias=True,
@@ -99,43 +84,37 @@ class BotModel(BaseModel):
99
84
  # set to None if created_at (nullable) is None
100
85
  # and model_fields_set contains the field
101
86
  if self.created_at is None and "created_at" in self.model_fields_set:
102
- _dict["created_at"] = None
87
+ _dict['created_at'] = None
103
88
 
104
89
  # set to None if updated_at (nullable) is None
105
90
  # and model_fields_set contains the field
106
91
  if self.updated_at is None and "updated_at" in self.model_fields_set:
107
- _dict["updated_at"] = None
92
+ _dict['updated_at'] = None
108
93
 
109
94
  # set to None if id (nullable) is None
110
95
  # and model_fields_set contains the field
111
96
  if self.id is None and "id" in self.model_fields_set:
112
- _dict["id"] = None
97
+ _dict['id'] = None
113
98
 
114
99
  # set to None if status_code (nullable) is None
115
100
  # and model_fields_set contains the field
116
101
  if self.status_code is None and "status_code" in self.model_fields_set:
117
- _dict["status_code"] = None
102
+ _dict['status_code'] = None
118
103
 
119
104
  # set to None if user_id (nullable) is None
120
105
  # and model_fields_set contains the field
121
106
  if self.user_id is None and "user_id" in self.model_fields_set:
122
- _dict["user_id"] = None
107
+ _dict['user_id'] = None
123
108
 
124
109
  # set to None if current_allocation (nullable) is None
125
110
  # and model_fields_set contains the field
126
- if (
127
- self.current_allocation is None
128
- and "current_allocation" in self.model_fields_set
129
- ):
130
- _dict["current_allocation"] = None
111
+ if self.current_allocation is None and "current_allocation" in self.model_fields_set:
112
+ _dict['current_allocation'] = None
131
113
 
132
114
  # set to None if current_exposure (nullable) is None
133
115
  # and model_fields_set contains the field
134
- if (
135
- self.current_exposure is None
136
- and "current_exposure" in self.model_fields_set
137
- ):
138
- _dict["current_exposure"] = None
116
+ if self.current_exposure is None and "current_exposure" in self.model_fields_set:
117
+ _dict['current_exposure'] = None
139
118
 
140
119
  return _dict
141
120
 
@@ -148,20 +127,20 @@ class BotModel(BaseModel):
148
127
  if not isinstance(obj, dict):
149
128
  return cls.model_validate(obj)
150
129
 
151
- _obj = cls.model_validate(
152
- {
153
- "created_at": obj.get("created_at"),
154
- "updated_at": obj.get("updated_at"),
155
- "id": obj.get("id"),
156
- "name": obj.get("name"),
157
- "strategy_id": obj.get("strategy_id"),
158
- "api_key_id": obj.get("api_key_id"),
159
- "allocation": obj.get("allocation"),
160
- "status": obj.get("status"),
161
- "status_code": obj.get("status_code"),
162
- "user_id": obj.get("user_id"),
163
- "current_allocation": obj.get("current_allocation"),
164
- "current_exposure": obj.get("current_exposure"),
165
- }
166
- )
130
+ _obj = cls.model_validate({
131
+ "created_at": obj.get("created_at"),
132
+ "updated_at": obj.get("updated_at"),
133
+ "id": obj.get("id"),
134
+ "name": obj.get("name"),
135
+ "strategy_id": obj.get("strategy_id"),
136
+ "api_key_id": obj.get("api_key_id"),
137
+ "allocation": obj.get("allocation"),
138
+ "status": obj.get("status"),
139
+ "status_code": obj.get("status_code"),
140
+ "user_id": obj.get("user_id"),
141
+ "current_allocation": obj.get("current_allocation"),
142
+ "current_exposure": obj.get("current_exposure")
143
+ })
167
144
  return _obj
145
+
146
+
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -26,12 +26,14 @@ class BotStatus(str, Enum):
26
26
  """
27
27
  allowed enum values
28
28
  """
29
- RUNNING = "running"
30
- STOPPING = "stopping"
31
- STOPPED = "stopped"
32
- DELETED = "deleted"
29
+ RUNNING = 'running'
30
+ STOPPING = 'stopping'
31
+ STOPPED = 'stopped'
32
+ DELETED = 'deleted'
33
33
 
34
34
  @classmethod
35
35
  def from_json(cls, json_str: str) -> Self:
36
36
  """Create an instance of BotStatus from a JSON string"""
37
37
  return cls(json.loads(json_str))
38
+
39
+
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -26,10 +26,12 @@ class Exchange(str, Enum):
26
26
  """
27
27
  allowed enum values
28
28
  """
29
- KUCOIN = "kucoin"
30
- BINGX = "bingx"
29
+ KUCOIN = 'kucoin'
30
+ BINGX = 'bingx'
31
31
 
32
32
  @classmethod
33
33
  def from_json(cls, json_str: str) -> Self:
34
34
  """Create an instance of Exchange from a JSON string"""
35
35
  return cls(json.loads(json_str))
36
+
37
+
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -19,37 +19,25 @@ 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.exchange import Exchange
22
23
  from typing import Optional, Set
23
24
  from typing_extensions import Self
24
25
 
25
-
26
26
  class ExchangeKeyModel(BaseModel):
27
27
  """
28
28
  ExchangeKeyModel
29
- """ # noqa: E501
30
-
29
+ """ # noqa: E501
31
30
  created_at: Optional[StrictInt] = None
32
31
  updated_at: Optional[StrictInt] = None
33
32
  id: Optional[StrictStr] = None
34
- exchange: StrictStr = Field(description="Exchange name")
33
+ exchange: Exchange = Field(description="Exchange name")
35
34
  api_key: Optional[StrictStr] = None
36
35
  secret: Optional[StrictStr] = None
37
36
  passphrase: Optional[StrictStr] = None
38
37
  label: StrictStr = Field(description="Label for the API key")
39
38
  enabled: Optional[StrictBool] = None
40
39
  user_id: Optional[StrictStr] = None
41
- __properties: ClassVar[List[str]] = [
42
- "created_at",
43
- "updated_at",
44
- "id",
45
- "exchange",
46
- "api_key",
47
- "secret",
48
- "passphrase",
49
- "label",
50
- "enabled",
51
- "user_id",
52
- ]
40
+ __properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "exchange", "api_key", "secret", "passphrase", "label", "enabled", "user_id"]
53
41
 
54
42
  model_config = ConfigDict(
55
43
  populate_by_name=True,
@@ -57,6 +45,7 @@ class ExchangeKeyModel(BaseModel):
57
45
  protected_namespaces=(),
58
46
  )
59
47
 
48
+
60
49
  def to_str(self) -> str:
61
50
  """Returns the string representation of the model using alias"""
62
51
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -81,7 +70,8 @@ class ExchangeKeyModel(BaseModel):
81
70
  were set at model initialization. Other fields with value `None`
82
71
  are ignored.
83
72
  """
84
- excluded_fields: Set[str] = set([])
73
+ excluded_fields: Set[str] = set([
74
+ ])
85
75
 
86
76
  _dict = self.model_dump(
87
77
  by_alias=True,
@@ -91,42 +81,42 @@ class ExchangeKeyModel(BaseModel):
91
81
  # set to None if created_at (nullable) is None
92
82
  # and model_fields_set contains the field
93
83
  if self.created_at is None and "created_at" in self.model_fields_set:
94
- _dict["created_at"] = None
84
+ _dict['created_at'] = None
95
85
 
96
86
  # set to None if updated_at (nullable) is None
97
87
  # and model_fields_set contains the field
98
88
  if self.updated_at is None and "updated_at" in self.model_fields_set:
99
- _dict["updated_at"] = None
89
+ _dict['updated_at'] = None
100
90
 
101
91
  # set to None if id (nullable) is None
102
92
  # and model_fields_set contains the field
103
93
  if self.id is None and "id" in self.model_fields_set:
104
- _dict["id"] = None
94
+ _dict['id'] = None
105
95
 
106
96
  # set to None if api_key (nullable) is None
107
97
  # and model_fields_set contains the field
108
98
  if self.api_key is None and "api_key" in self.model_fields_set:
109
- _dict["api_key"] = None
99
+ _dict['api_key'] = None
110
100
 
111
101
  # set to None if secret (nullable) is None
112
102
  # and model_fields_set contains the field
113
103
  if self.secret is None and "secret" in self.model_fields_set:
114
- _dict["secret"] = None
104
+ _dict['secret'] = None
115
105
 
116
106
  # set to None if passphrase (nullable) is None
117
107
  # and model_fields_set contains the field
118
108
  if self.passphrase is None and "passphrase" in self.model_fields_set:
119
- _dict["passphrase"] = None
109
+ _dict['passphrase'] = None
120
110
 
121
111
  # set to None if enabled (nullable) is None
122
112
  # and model_fields_set contains the field
123
113
  if self.enabled is None and "enabled" in self.model_fields_set:
124
- _dict["enabled"] = None
114
+ _dict['enabled'] = None
125
115
 
126
116
  # set to None if user_id (nullable) is None
127
117
  # and model_fields_set contains the field
128
118
  if self.user_id is None and "user_id" in self.model_fields_set:
129
- _dict["user_id"] = None
119
+ _dict['user_id'] = None
130
120
 
131
121
  return _dict
132
122
 
@@ -139,18 +129,18 @@ class ExchangeKeyModel(BaseModel):
139
129
  if not isinstance(obj, dict):
140
130
  return cls.model_validate(obj)
141
131
 
142
- _obj = cls.model_validate(
143
- {
144
- "created_at": obj.get("created_at"),
145
- "updated_at": obj.get("updated_at"),
146
- "id": obj.get("id"),
147
- "exchange": obj.get("exchange"),
148
- "api_key": obj.get("api_key"),
149
- "secret": obj.get("secret"),
150
- "passphrase": obj.get("passphrase"),
151
- "label": obj.get("label"),
152
- "enabled": obj.get("enabled"),
153
- "user_id": obj.get("user_id"),
154
- }
155
- )
132
+ _obj = cls.model_validate({
133
+ "created_at": obj.get("created_at"),
134
+ "updated_at": obj.get("updated_at"),
135
+ "id": obj.get("id"),
136
+ "exchange": obj.get("exchange"),
137
+ "api_key": obj.get("api_key"),
138
+ "secret": obj.get("secret"),
139
+ "passphrase": obj.get("passphrase"),
140
+ "label": obj.get("label"),
141
+ "enabled": obj.get("enabled"),
142
+ "user_id": obj.get("user_id")
143
+ })
156
144
  return _obj
145
+
146
+
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -22,19 +22,13 @@ from typing import Any, ClassVar, Dict, List
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
-
26
25
  class ExecutionIds(BaseModel):
27
26
  """
28
27
  ExecutionIds
29
- """ # noqa: E501
30
-
28
+ """ # noqa: E501
31
29
  main: List[StrictStr] = Field(description="Main execution ID. List with one item.")
32
- sl: List[StrictStr] = Field(
33
- description="Stop loss execution IDs. List with multiple items ordered by the next stop loss, e.g. price = 10000 => SLs: ['900', '700', '500']."
34
- )
35
- tp: List[StrictStr] = Field(
36
- description="Take profit execution IDs. List with multiple items ordered by the next take profit, e.g. price = 10000 => TPs: ['1100', '1300', '1500']."
37
- )
30
+ sl: List[StrictStr] = Field(description="Stop loss execution IDs. List with multiple items ordered by the next stop loss, e.g. price = 10000 => SLs: ['900', '700', '500'].")
31
+ tp: List[StrictStr] = Field(description="Take profit execution IDs. List with multiple items ordered by the next take profit, e.g. price = 10000 => TPs: ['1100', '1300', '1500'].")
38
32
  __properties: ClassVar[List[str]] = ["main", "sl", "tp"]
39
33
 
40
34
  model_config = ConfigDict(
@@ -43,6 +37,7 @@ class ExecutionIds(BaseModel):
43
37
  protected_namespaces=(),
44
38
  )
45
39
 
40
+
46
41
  def to_str(self) -> str:
47
42
  """Returns the string representation of the model using alias"""
48
43
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -67,7 +62,8 @@ class ExecutionIds(BaseModel):
67
62
  were set at model initialization. Other fields with value `None`
68
63
  are ignored.
69
64
  """
70
- excluded_fields: Set[str] = set([])
65
+ excluded_fields: Set[str] = set([
66
+ ])
71
67
 
72
68
  _dict = self.model_dump(
73
69
  by_alias=True,
@@ -85,7 +81,11 @@ class ExecutionIds(BaseModel):
85
81
  if not isinstance(obj, dict):
86
82
  return cls.model_validate(obj)
87
83
 
88
- _obj = cls.model_validate(
89
- {"main": obj.get("main"), "sl": obj.get("sl"), "tp": obj.get("tp")}
90
- )
84
+ _obj = cls.model_validate({
85
+ "main": obj.get("main"),
86
+ "sl": obj.get("sl"),
87
+ "tp": obj.get("tp")
88
+ })
91
89
  return _obj
90
+
91
+
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -22,36 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
-
26
25
  class FuturesBalance(BaseModel):
27
26
  """
28
27
  Model for futures balance
29
- """ # noqa: E501
30
-
28
+ """ # noqa: E501
31
29
  api_key_id: StrictStr = Field(description="API key ID", alias="apiKeyId")
32
30
  asset: StrictStr = Field(description="Asset/Currency code")
33
31
  balance: Union[StrictFloat, StrictInt] = Field(description="Total balance/equity")
34
- available: Union[StrictFloat, StrictInt] = Field(
35
- description="Available balance for trading/withdrawal"
36
- )
37
- unrealized_pnl: Union[StrictFloat, StrictInt] = Field(
38
- description="Unrealized profit and loss", alias="unrealizedPnl"
39
- )
40
- used_margin: Optional[Union[StrictFloat, StrictInt]] = Field(
41
- default=None, alias="usedMargin"
42
- )
43
- frozen_amount: Optional[Union[StrictFloat, StrictInt]] = Field(
44
- default=None, alias="frozenAmount"
45
- )
46
- __properties: ClassVar[List[str]] = [
47
- "apiKeyId",
48
- "asset",
49
- "balance",
50
- "available",
51
- "unrealizedPnl",
52
- "usedMargin",
53
- "frozenAmount",
54
- ]
32
+ available: Union[StrictFloat, StrictInt] = Field(description="Available balance for trading/withdrawal")
33
+ unrealized_pnl: Union[StrictFloat, StrictInt] = Field(description="Unrealized profit and loss", alias="unrealizedPnl")
34
+ used_margin: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="usedMargin")
35
+ frozen_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="frozenAmount")
36
+ __properties: ClassVar[List[str]] = ["apiKeyId", "asset", "balance", "available", "unrealizedPnl", "usedMargin", "frozenAmount"]
55
37
 
56
38
  model_config = ConfigDict(
57
39
  populate_by_name=True,
@@ -59,6 +41,7 @@ class FuturesBalance(BaseModel):
59
41
  protected_namespaces=(),
60
42
  )
61
43
 
44
+
62
45
  def to_str(self) -> str:
63
46
  """Returns the string representation of the model using alias"""
64
47
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -83,7 +66,8 @@ class FuturesBalance(BaseModel):
83
66
  were set at model initialization. Other fields with value `None`
84
67
  are ignored.
85
68
  """
86
- excluded_fields: Set[str] = set([])
69
+ excluded_fields: Set[str] = set([
70
+ ])
87
71
 
88
72
  _dict = self.model_dump(
89
73
  by_alias=True,
@@ -93,12 +77,12 @@ class FuturesBalance(BaseModel):
93
77
  # set to None if used_margin (nullable) is None
94
78
  # and model_fields_set contains the field
95
79
  if self.used_margin is None and "used_margin" in self.model_fields_set:
96
- _dict["usedMargin"] = None
80
+ _dict['usedMargin'] = None
97
81
 
98
82
  # set to None if frozen_amount (nullable) is None
99
83
  # and model_fields_set contains the field
100
84
  if self.frozen_amount is None and "frozen_amount" in self.model_fields_set:
101
- _dict["frozenAmount"] = None
85
+ _dict['frozenAmount'] = None
102
86
 
103
87
  return _dict
104
88
 
@@ -111,15 +95,15 @@ class FuturesBalance(BaseModel):
111
95
  if not isinstance(obj, dict):
112
96
  return cls.model_validate(obj)
113
97
 
114
- _obj = cls.model_validate(
115
- {
116
- "apiKeyId": obj.get("apiKeyId"),
117
- "asset": obj.get("asset"),
118
- "balance": obj.get("balance"),
119
- "available": obj.get("available"),
120
- "unrealizedPnl": obj.get("unrealizedPnl"),
121
- "usedMargin": obj.get("usedMargin"),
122
- "frozenAmount": obj.get("frozenAmount"),
123
- }
124
- )
98
+ _obj = cls.model_validate({
99
+ "apiKeyId": obj.get("apiKeyId"),
100
+ "asset": obj.get("asset"),
101
+ "balance": obj.get("balance"),
102
+ "available": obj.get("available"),
103
+ "unrealizedPnl": obj.get("unrealizedPnl"),
104
+ "usedMargin": obj.get("usedMargin"),
105
+ "frozenAmount": obj.get("frozenAmount")
106
+ })
125
107
  return _obj
108
+
109
+