crypticorn 2.17.0rc3__py3-none-any.whl → 2.17.0rc5__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 (137) hide show
  1. crypticorn/auth/client/api/admin_api.py +0 -2
  2. crypticorn/auth/client/api/auth_api.py +0 -4
  3. crypticorn/auth/client/api/service_api.py +0 -4
  4. crypticorn/auth/client/api/user_api.py +0 -4
  5. crypticorn/auth/client/api/wallet_api.py +0 -4
  6. crypticorn/auth/client/api_client.py +0 -5
  7. crypticorn/auth/client/models/add_wallet_request.py +1 -1
  8. crypticorn/auth/client/models/authorize_user_request.py +1 -1
  9. crypticorn/auth/client/models/create_api_key_request.py +1 -1
  10. crypticorn/auth/client/models/create_user_request.py +1 -1
  11. crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
  12. crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
  13. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
  14. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
  15. crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
  16. crypticorn/auth/client/models/logout_default_response.py +1 -1
  17. crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
  18. crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
  19. crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
  20. crypticorn/auth/client/models/token_info200_response.py +1 -1
  21. crypticorn/auth/client/models/update_user_request.py +1 -1
  22. crypticorn/auth/client/models/user_by_username200_response.py +1 -1
  23. crypticorn/auth/client/models/verify200_response.py +1 -1
  24. crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
  25. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
  26. crypticorn/auth/client/models/whoami200_response.py +1 -1
  27. crypticorn/cli/init.py +1 -1
  28. crypticorn/cli/templates/.env.docker.temp +3 -0
  29. crypticorn/cli/templates/.env.example.temp +4 -0
  30. crypticorn/client.py +0 -1
  31. crypticorn/common/auth.py +5 -16
  32. crypticorn/common/decorators.py +1 -2
  33. crypticorn/common/enums.py +0 -2
  34. crypticorn/common/metrics.py +1 -1
  35. crypticorn/common/middleware.py +0 -1
  36. crypticorn/common/pagination.py +135 -22
  37. crypticorn/common/utils.py +1 -2
  38. crypticorn/dex/__init__.py +6 -0
  39. crypticorn/dex/client/__init__.py +49 -0
  40. crypticorn/dex/client/api/__init__.py +6 -0
  41. crypticorn/dex/client/api/admin_api.py +3046 -0
  42. crypticorn/dex/client/api/signals_api.py +1821 -0
  43. crypticorn/dex/client/api/status_api.py +907 -0
  44. crypticorn/dex/client/api_client.py +753 -0
  45. crypticorn/dex/client/api_response.py +20 -0
  46. crypticorn/dex/client/configuration.py +620 -0
  47. crypticorn/dex/client/exceptions.py +220 -0
  48. crypticorn/dex/client/models/__init__.py +30 -0
  49. crypticorn/dex/client/models/api_error_identifier.py +121 -0
  50. crypticorn/dex/client/models/api_error_level.py +37 -0
  51. crypticorn/dex/client/models/api_error_type.py +37 -0
  52. crypticorn/dex/client/models/exception_detail.py +117 -0
  53. crypticorn/dex/client/models/log_level.py +38 -0
  54. crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
  55. crypticorn/dex/client/models/risk.py +86 -0
  56. crypticorn/dex/client/models/signal_overview_stats.py +156 -0
  57. crypticorn/dex/client/models/signal_volume.py +84 -0
  58. crypticorn/dex/client/models/signal_with_token.py +163 -0
  59. crypticorn/dex/client/models/token_data.py +127 -0
  60. crypticorn/dex/client/models/token_detail.py +116 -0
  61. crypticorn/dex/client/py.typed +0 -0
  62. crypticorn/dex/client/rest.py +217 -0
  63. crypticorn/dex/main.py +1 -0
  64. crypticorn/hive/client/api/admin_api.py +0 -3
  65. crypticorn/hive/client/api/data_api.py +0 -4
  66. crypticorn/hive/client/api/models_api.py +1 -4
  67. crypticorn/hive/client/api/status_api.py +0 -3
  68. crypticorn/hive/client/api_client.py +0 -5
  69. crypticorn/hive/client/models/coin_info.py +1 -1
  70. crypticorn/hive/client/models/exception_detail.py +1 -1
  71. crypticorn/hive/client/models/target_info.py +1 -1
  72. crypticorn/hive/utils.py +2 -2
  73. crypticorn/klines/client/api/admin_api.py +0 -3
  74. crypticorn/klines/client/api/change_in_timeframe_api.py +0 -4
  75. crypticorn/klines/client/api/funding_rates_api.py +0 -4
  76. crypticorn/klines/client/api/ohlcv_data_api.py +0 -4
  77. crypticorn/klines/client/api/status_api.py +0 -3
  78. crypticorn/klines/client/api/symbols_api.py +0 -4
  79. crypticorn/klines/client/api/udf_api.py +0 -2
  80. crypticorn/klines/client/api_client.py +0 -5
  81. crypticorn/klines/client/models/exception_detail.py +1 -1
  82. crypticorn/klines/client/models/ohlcv.py +1 -1
  83. crypticorn/klines/client/models/symbol_group.py +1 -1
  84. crypticorn/klines/client/models/udf_config.py +1 -1
  85. crypticorn/metrics/client/api/admin_api.py +0 -3
  86. crypticorn/metrics/client/api/exchanges_api.py +0 -4
  87. crypticorn/metrics/client/api/indicators_api.py +0 -4
  88. crypticorn/metrics/client/api/logs_api.py +0 -4
  89. crypticorn/metrics/client/api/marketcap_api.py +0 -4
  90. crypticorn/metrics/client/api/markets_api.py +0 -4
  91. crypticorn/metrics/client/api/quote_currencies_api.py +0 -4
  92. crypticorn/metrics/client/api/status_api.py +0 -3
  93. crypticorn/metrics/client/api/tokens_api.py +0 -2
  94. crypticorn/metrics/client/api_client.py +0 -5
  95. crypticorn/metrics/client/models/exception_detail.py +1 -1
  96. crypticorn/metrics/client/models/exchange_mapping.py +1 -1
  97. crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
  98. crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
  99. crypticorn/metrics/client/models/ohlcv.py +1 -1
  100. crypticorn/pay/client/api/admin_api.py +0 -3
  101. crypticorn/pay/client/api/now_payments_api.py +0 -4
  102. crypticorn/pay/client/api/payments_api.py +0 -4
  103. crypticorn/pay/client/api/products_api.py +0 -4
  104. crypticorn/pay/client/api/status_api.py +0 -3
  105. crypticorn/pay/client/api_client.py +0 -5
  106. crypticorn/pay/client/models/exception_detail.py +1 -1
  107. crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
  108. crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
  109. crypticorn/pay/client/models/product.py +1 -1
  110. crypticorn/pay/client/models/product_create.py +1 -1
  111. crypticorn/pay/client/models/product_update.py +1 -1
  112. crypticorn/trade/client/__init__.py +5 -0
  113. crypticorn/trade/client/api/admin_api.py +22 -23
  114. crypticorn/trade/client/api/bots_api.py +4712 -168
  115. crypticorn/trade/client/api/orders_api.py +220 -106
  116. crypticorn/trade/client/configuration.py +2 -2
  117. crypticorn/trade/client/models/__init__.py +5 -0
  118. crypticorn/trade/client/models/bot.py +7 -18
  119. crypticorn/trade/client/models/bot_create.py +17 -1
  120. crypticorn/trade/client/models/bot_update.py +17 -1
  121. crypticorn/trade/client/models/exchange_key_create.py +17 -1
  122. crypticorn/trade/client/models/exchange_key_update.py +17 -1
  123. crypticorn/trade/client/models/notification.py +17 -1
  124. crypticorn/trade/client/models/notification_create.py +17 -1
  125. crypticorn/trade/client/models/notification_update.py +17 -1
  126. crypticorn/trade/client/models/orders_count.py +88 -0
  127. crypticorn/trade/client/models/paginated_response_order.py +134 -0
  128. crypticorn/trade/client/models/pn_l.py +95 -0
  129. crypticorn/trade/client/models/strategy.py +17 -1
  130. crypticorn/trade/client/models/strategy_create.py +17 -1
  131. crypticorn/trade/client/models/strategy_update.py +17 -1
  132. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/METADATA +1 -1
  133. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/RECORD +137 -106
  134. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/WHEEL +0 -0
  135. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/entry_points.txt +0 -0
  136. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/licenses/LICENSE +0 -0
  137. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/top_level.txt +0 -0
@@ -36,6 +36,7 @@ class BotCreate(BaseModel):
36
36
  description="UID for the trading strategy used by the bot"
37
37
  )
38
38
  api_key_id: StrictStr = Field(description="UID for the API key")
39
+ additional_properties: Dict[str, Any] = {}
39
40
  __properties: ClassVar[List[str]] = [
40
41
  "name",
41
42
  "allocation",
@@ -73,14 +74,24 @@ class BotCreate(BaseModel):
73
74
  * `None` is only added to the output dict for nullable fields that
74
75
  were set at model initialization. Other fields with value `None`
75
76
  are ignored.
77
+ * Fields in `self.additional_properties` are added to the output dict.
76
78
  """
77
- excluded_fields: Set[str] = set([])
79
+ excluded_fields: Set[str] = set(
80
+ [
81
+ "additional_properties",
82
+ ]
83
+ )
78
84
 
79
85
  _dict = self.model_dump(
80
86
  by_alias=True,
81
87
  exclude=excluded_fields,
82
88
  exclude_none=True,
83
89
  )
90
+ # puts key-value pairs in additional_properties in the top level
91
+ if self.additional_properties is not None:
92
+ for _key, _value in self.additional_properties.items():
93
+ _dict[_key] = _value
94
+
84
95
  return _dict
85
96
 
86
97
  @classmethod
@@ -101,4 +112,9 @@ class BotCreate(BaseModel):
101
112
  "api_key_id": obj.get("api_key_id"),
102
113
  }
103
114
  )
115
+ # store additional fields in additional_properties
116
+ for _key in obj.keys():
117
+ if _key not in cls.__properties:
118
+ _obj.additional_properties[_key] = obj.get(_key)
119
+
104
120
  return _obj
@@ -32,6 +32,7 @@ class BotUpdate(BaseModel):
32
32
  name: Optional[StrictStr] = None
33
33
  allocation: Optional[StrictInt] = None
34
34
  status: Optional[BotStatus] = None
35
+ additional_properties: Dict[str, Any] = {}
35
36
  __properties: ClassVar[List[str]] = ["name", "allocation", "status"]
36
37
 
37
38
  model_config = ConfigDict(
@@ -63,14 +64,24 @@ class BotUpdate(BaseModel):
63
64
  * `None` is only added to the output dict for nullable fields that
64
65
  were set at model initialization. Other fields with value `None`
65
66
  are ignored.
67
+ * Fields in `self.additional_properties` are added to the output dict.
66
68
  """
67
- excluded_fields: Set[str] = set([])
69
+ excluded_fields: Set[str] = set(
70
+ [
71
+ "additional_properties",
72
+ ]
73
+ )
68
74
 
69
75
  _dict = self.model_dump(
70
76
  by_alias=True,
71
77
  exclude=excluded_fields,
72
78
  exclude_none=True,
73
79
  )
80
+ # puts key-value pairs in additional_properties in the top level
81
+ if self.additional_properties is not None:
82
+ for _key, _value in self.additional_properties.items():
83
+ _dict[_key] = _value
84
+
74
85
  # set to None if name (nullable) is None
75
86
  # and model_fields_set contains the field
76
87
  if self.name is None and "name" in self.model_fields_set:
@@ -104,4 +115,9 @@ class BotUpdate(BaseModel):
104
115
  "status": obj.get("status"),
105
116
  }
106
117
  )
118
+ # store additional fields in additional_properties
119
+ for _key in obj.keys():
120
+ if _key not in cls.__properties:
121
+ _obj.additional_properties[_key] = obj.get(_key)
122
+
107
123
  return _obj
@@ -34,6 +34,7 @@ class ExchangeKeyCreate(BaseModel):
34
34
  secret: StrictStr = Field(description="API secret")
35
35
  passphrase: Optional[StrictStr] = None
36
36
  exchange: Exchange = Field(description="The exchange the API key is for.")
37
+ additional_properties: Dict[str, Any] = {}
37
38
  __properties: ClassVar[List[str]] = [
38
39
  "label",
39
40
  "api_key",
@@ -71,14 +72,24 @@ class ExchangeKeyCreate(BaseModel):
71
72
  * `None` is only added to the output dict for nullable fields that
72
73
  were set at model initialization. Other fields with value `None`
73
74
  are ignored.
75
+ * Fields in `self.additional_properties` are added to the output dict.
74
76
  """
75
- excluded_fields: Set[str] = set([])
77
+ excluded_fields: Set[str] = set(
78
+ [
79
+ "additional_properties",
80
+ ]
81
+ )
76
82
 
77
83
  _dict = self.model_dump(
78
84
  by_alias=True,
79
85
  exclude=excluded_fields,
80
86
  exclude_none=True,
81
87
  )
88
+ # puts key-value pairs in additional_properties in the top level
89
+ if self.additional_properties is not None:
90
+ for _key, _value in self.additional_properties.items():
91
+ _dict[_key] = _value
92
+
82
93
  # set to None if passphrase (nullable) is None
83
94
  # and model_fields_set contains the field
84
95
  if self.passphrase is None and "passphrase" in self.model_fields_set:
@@ -104,4 +115,9 @@ class ExchangeKeyCreate(BaseModel):
104
115
  "exchange": obj.get("exchange"),
105
116
  }
106
117
  )
118
+ # store additional fields in additional_properties
119
+ for _key in obj.keys():
120
+ if _key not in cls.__properties:
121
+ _obj.additional_properties[_key] = obj.get(_key)
122
+
107
123
  return _obj
@@ -32,6 +32,7 @@ class ExchangeKeyUpdate(BaseModel):
32
32
  api_key: Optional[StrictStr] = None
33
33
  secret: Optional[StrictStr] = None
34
34
  passphrase: Optional[StrictStr] = None
35
+ additional_properties: Dict[str, Any] = {}
35
36
  __properties: ClassVar[List[str]] = ["label", "api_key", "secret", "passphrase"]
36
37
 
37
38
  model_config = ConfigDict(
@@ -63,14 +64,24 @@ class ExchangeKeyUpdate(BaseModel):
63
64
  * `None` is only added to the output dict for nullable fields that
64
65
  were set at model initialization. Other fields with value `None`
65
66
  are ignored.
67
+ * Fields in `self.additional_properties` are added to the output dict.
66
68
  """
67
- excluded_fields: Set[str] = set([])
69
+ excluded_fields: Set[str] = set(
70
+ [
71
+ "additional_properties",
72
+ ]
73
+ )
68
74
 
69
75
  _dict = self.model_dump(
70
76
  by_alias=True,
71
77
  exclude=excluded_fields,
72
78
  exclude_none=True,
73
79
  )
80
+ # puts key-value pairs in additional_properties in the top level
81
+ if self.additional_properties is not None:
82
+ for _key, _value in self.additional_properties.items():
83
+ _dict[_key] = _value
84
+
74
85
  # set to None if label (nullable) is None
75
86
  # and model_fields_set contains the field
76
87
  if self.label is None and "label" in self.model_fields_set:
@@ -110,4 +121,9 @@ class ExchangeKeyUpdate(BaseModel):
110
121
  "passphrase": obj.get("passphrase"),
111
122
  }
112
123
  )
124
+ # store additional fields in additional_properties
125
+ for _key in obj.keys():
126
+ if _key not in cls.__properties:
127
+ _obj.additional_properties[_key] = obj.get(_key)
128
+
113
129
  return _obj
@@ -56,6 +56,7 @@ class Notification(BaseModel):
56
56
  type: ApiErrorType = Field(
57
57
  description="Type of the notification. Of type ApiErrorType"
58
58
  )
59
+ additional_properties: Dict[str, Any] = {}
59
60
  __properties: ClassVar[List[str]] = [
60
61
  "user_id",
61
62
  "created_at",
@@ -97,14 +98,24 @@ class Notification(BaseModel):
97
98
  * `None` is only added to the output dict for nullable fields that
98
99
  were set at model initialization. Other fields with value `None`
99
100
  are ignored.
101
+ * Fields in `self.additional_properties` are added to the output dict.
100
102
  """
101
- excluded_fields: Set[str] = set([])
103
+ excluded_fields: Set[str] = set(
104
+ [
105
+ "additional_properties",
106
+ ]
107
+ )
102
108
 
103
109
  _dict = self.model_dump(
104
110
  by_alias=True,
105
111
  exclude=excluded_fields,
106
112
  exclude_none=True,
107
113
  )
114
+ # puts key-value pairs in additional_properties in the top level
115
+ if self.additional_properties is not None:
116
+ for _key, _value in self.additional_properties.items():
117
+ _dict[_key] = _value
118
+
108
119
  return _dict
109
120
 
110
121
  @classmethod
@@ -129,4 +140,9 @@ class Notification(BaseModel):
129
140
  "type": obj.get("type"),
130
141
  }
131
142
  )
143
+ # store additional fields in additional_properties
144
+ for _key in obj.keys():
145
+ if _key not in cls.__properties:
146
+ _obj.additional_properties[_key] = obj.get(_key)
147
+
132
148
  return _obj
@@ -46,6 +46,7 @@ class NotificationCreate(BaseModel):
46
46
  type: ApiErrorType = Field(
47
47
  description="Type of the notification. Of type ApiErrorType"
48
48
  )
49
+ additional_properties: Dict[str, Any] = {}
49
50
  __properties: ClassVar[List[str]] = [
50
51
  "viewed",
51
52
  "sent",
@@ -83,14 +84,24 @@ class NotificationCreate(BaseModel):
83
84
  * `None` is only added to the output dict for nullable fields that
84
85
  were set at model initialization. Other fields with value `None`
85
86
  are ignored.
87
+ * Fields in `self.additional_properties` are added to the output dict.
86
88
  """
87
- excluded_fields: Set[str] = set([])
89
+ excluded_fields: Set[str] = set(
90
+ [
91
+ "additional_properties",
92
+ ]
93
+ )
88
94
 
89
95
  _dict = self.model_dump(
90
96
  by_alias=True,
91
97
  exclude=excluded_fields,
92
98
  exclude_none=True,
93
99
  )
100
+ # puts key-value pairs in additional_properties in the top level
101
+ if self.additional_properties is not None:
102
+ for _key, _value in self.additional_properties.items():
103
+ _dict[_key] = _value
104
+
94
105
  return _dict
95
106
 
96
107
  @classmethod
@@ -111,4 +122,9 @@ class NotificationCreate(BaseModel):
111
122
  "type": obj.get("type"),
112
123
  }
113
124
  )
125
+ # store additional fields in additional_properties
126
+ for _key in obj.keys():
127
+ if _key not in cls.__properties:
128
+ _obj.additional_properties[_key] = obj.get(_key)
129
+
114
130
  return _obj
@@ -30,6 +30,7 @@ class NotificationUpdate(BaseModel):
30
30
 
31
31
  viewed: Optional[StrictBool] = None
32
32
  sent: Optional[StrictBool] = None
33
+ additional_properties: Dict[str, Any] = {}
33
34
  __properties: ClassVar[List[str]] = ["viewed", "sent"]
34
35
 
35
36
  model_config = ConfigDict(
@@ -61,14 +62,24 @@ class NotificationUpdate(BaseModel):
61
62
  * `None` is only added to the output dict for nullable fields that
62
63
  were set at model initialization. Other fields with value `None`
63
64
  are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
64
66
  """
65
- excluded_fields: Set[str] = set([])
67
+ excluded_fields: Set[str] = set(
68
+ [
69
+ "additional_properties",
70
+ ]
71
+ )
66
72
 
67
73
  _dict = self.model_dump(
68
74
  by_alias=True,
69
75
  exclude=excluded_fields,
70
76
  exclude_none=True,
71
77
  )
78
+ # puts key-value pairs in additional_properties in the top level
79
+ if self.additional_properties is not None:
80
+ for _key, _value in self.additional_properties.items():
81
+ _dict[_key] = _value
82
+
72
83
  # set to None if viewed (nullable) is None
73
84
  # and model_fields_set contains the field
74
85
  if self.viewed is None and "viewed" in self.model_fields_set:
@@ -93,4 +104,9 @@ class NotificationUpdate(BaseModel):
93
104
  _obj = cls.model_validate(
94
105
  {"viewed": obj.get("viewed"), "sent": obj.get("sent")}
95
106
  )
107
+ # store additional fields in additional_properties
108
+ for _key in obj.keys():
109
+ if _key not in cls.__properties:
110
+ _obj.additional_properties[_key] = obj.get(_key)
111
+
96
112
  return _obj
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Trading API
5
+
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class OrdersCount(BaseModel):
27
+ """
28
+ The number of orders for a user by day
29
+ """ # noqa: E501
30
+
31
+ timestamp: StrictInt = Field(
32
+ description="Timestamp of the latest order for the day"
33
+ )
34
+ count: StrictInt = Field(description="The number of orders for the day")
35
+ __properties: ClassVar[List[str]] = ["timestamp", "count"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of OrdersCount from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of OrdersCount from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate(
86
+ {"timestamp": obj.get("timestamp"), "count": obj.get("count")}
87
+ )
88
+ return _obj
@@ -0,0 +1,134 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Trading API
5
+
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from crypticorn.trade.client.models.order import Order
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class PaginatedResponseOrder(BaseModel):
28
+ """
29
+ PaginatedResponseOrder
30
+ """ # noqa: E501
31
+
32
+ data: List[Order]
33
+ total: StrictInt = Field(description="The total number of items")
34
+ page: StrictInt = Field(description="The current page number")
35
+ page_size: StrictInt = Field(description="The number of items per page")
36
+ prev: Optional[StrictInt] = None
37
+ next: Optional[StrictInt] = None
38
+ last: Optional[StrictInt] = None
39
+ __properties: ClassVar[List[str]] = [
40
+ "data",
41
+ "total",
42
+ "page",
43
+ "page_size",
44
+ "prev",
45
+ "next",
46
+ "last",
47
+ ]
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
+ return json.dumps(self.to_dict())
63
+
64
+ @classmethod
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
66
+ """Create an instance of PaginatedResponseOrder from a JSON string"""
67
+ return cls.from_dict(json.loads(json_str))
68
+
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ """
79
+ excluded_fields: Set[str] = set([])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
87
+ _items = []
88
+ if self.data:
89
+ for _item_data in self.data:
90
+ if _item_data:
91
+ _items.append(_item_data.to_dict())
92
+ _dict["data"] = _items
93
+ # set to None if prev (nullable) is None
94
+ # and model_fields_set contains the field
95
+ if self.prev is None and "prev" in self.model_fields_set:
96
+ _dict["prev"] = None
97
+
98
+ # set to None if next (nullable) is None
99
+ # and model_fields_set contains the field
100
+ if self.next is None and "next" in self.model_fields_set:
101
+ _dict["next"] = None
102
+
103
+ # set to None if last (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.last is None and "last" in self.model_fields_set:
106
+ _dict["last"] = None
107
+
108
+ return _dict
109
+
110
+ @classmethod
111
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
112
+ """Create an instance of PaginatedResponseOrder from a dict"""
113
+ if obj is None:
114
+ return None
115
+
116
+ if not isinstance(obj, dict):
117
+ return cls.model_validate(obj)
118
+
119
+ _obj = cls.model_validate(
120
+ {
121
+ "data": (
122
+ [Order.from_dict(_item) for _item in obj["data"]]
123
+ if obj.get("data") is not None
124
+ else None
125
+ ),
126
+ "total": obj.get("total"),
127
+ "page": obj.get("page"),
128
+ "page_size": obj.get("page_size"),
129
+ "prev": obj.get("prev"),
130
+ "next": obj.get("next"),
131
+ "last": obj.get("last"),
132
+ }
133
+ )
134
+ return _obj
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Trading API
5
+
6
+ API for automated trading and exchange interface. This API is used to trade on the exchange and manage bots, API keys, orders, and more.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class PnL(BaseModel):
27
+ """
28
+ The profit and loss of a bot by timestamp. In the case of sampling, the PnL is the sum of the PnLs between the prior timestamp and the current timestamp.
29
+ """ # noqa: E501
30
+
31
+ timestamp: StrictInt = Field(description="Timestamp of the order")
32
+ pnl: Union[StrictFloat, StrictInt] = Field(
33
+ description="The profit and loss of the order"
34
+ )
35
+ cum_pnl: Union[StrictFloat, StrictInt] = Field(
36
+ description="The cumulative profit and loss of the bot until the order (inclusive)"
37
+ )
38
+ __properties: ClassVar[List[str]] = ["timestamp", "pnl", "cum_pnl"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of PnL from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of PnL from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "timestamp": obj.get("timestamp"),
91
+ "pnl": obj.get("pnl"),
92
+ "cum_pnl": obj.get("cum_pnl"),
93
+ }
94
+ )
95
+ return _obj
@@ -61,6 +61,7 @@ class Strategy(BaseModel):
61
61
  description="Leverage for the strategy"
62
62
  )
63
63
  market_type: MarketType = Field(description="Market of operation of the strategy")
64
+ additional_properties: Dict[str, Any] = {}
64
65
  __properties: ClassVar[List[str]] = [
65
66
  "created_at",
66
67
  "updated_at",
@@ -105,8 +106,13 @@ class Strategy(BaseModel):
105
106
  * `None` is only added to the output dict for nullable fields that
106
107
  were set at model initialization. Other fields with value `None`
107
108
  are ignored.
109
+ * Fields in `self.additional_properties` are added to the output dict.
108
110
  """
109
- excluded_fields: Set[str] = set([])
111
+ excluded_fields: Set[str] = set(
112
+ [
113
+ "additional_properties",
114
+ ]
115
+ )
110
116
 
111
117
  _dict = self.model_dump(
112
118
  by_alias=True,
@@ -120,6 +126,11 @@ class Strategy(BaseModel):
120
126
  if _item_exchanges:
121
127
  _items.append(_item_exchanges.to_dict())
122
128
  _dict["exchanges"] = _items
129
+ # puts key-value pairs in additional_properties in the top level
130
+ if self.additional_properties is not None:
131
+ for _key, _value in self.additional_properties.items():
132
+ _dict[_key] = _value
133
+
123
134
  # set to None if margin_mode (nullable) is None
124
135
  # and model_fields_set contains the field
125
136
  if self.margin_mode is None and "margin_mode" in self.model_fields_set:
@@ -159,4 +170,9 @@ class Strategy(BaseModel):
159
170
  "market_type": obj.get("market_type"),
160
171
  }
161
172
  )
173
+ # store additional fields in additional_properties
174
+ for _key in obj.keys():
175
+ if _key not in cls.__properties:
176
+ _obj.additional_properties[_key] = obj.get(_key)
177
+
162
178
  return _obj