crypticorn 1.0.2rc3__py3-none-any.whl → 2.0.0__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/__init__.py +3 -3
- crypticorn/auth/__init__.py +2 -0
- crypticorn/auth/client/__init__.py +112 -0
- crypticorn/auth/client/api/__init__.py +8 -0
- crypticorn/auth/client/api/admin_api.py +522 -0
- crypticorn/auth/client/api/auth_api.py +2089 -0
- crypticorn/auth/client/api/service_api.py +309 -0
- crypticorn/auth/client/api/user_api.py +2540 -0
- crypticorn/auth/client/api/wallet_api.py +1698 -0
- crypticorn/auth/client/api_client.py +758 -0
- crypticorn/auth/client/api_response.py +20 -0
- crypticorn/auth/client/configuration.py +584 -0
- crypticorn/auth/client/exceptions.py +220 -0
- crypticorn/auth/client/models/__init__.py +91 -0
- crypticorn/auth/client/models/add_wallet200_response.py +86 -0
- crypticorn/auth/client/models/add_wallet_request.py +107 -0
- crypticorn/auth/client/models/authorize_user200_response.py +107 -0
- crypticorn/auth/client/models/authorize_user200_response_auth.py +101 -0
- crypticorn/auth/client/models/authorize_user_request.py +96 -0
- crypticorn/auth/client/models/create_user_request.py +114 -0
- crypticorn/auth/client/models/list_wallets200_response.py +137 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner.py +115 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +115 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +168 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +191 -0
- crypticorn/auth/client/models/list_wallets200_response_data_inner.py +102 -0
- crypticorn/auth/client/models/list_wallets200_response_user_value.py +118 -0
- crypticorn/auth/client/models/logout_default_response.py +108 -0
- crypticorn/auth/client/models/logout_default_response_issues_inner.py +83 -0
- crypticorn/auth/client/models/refresh_token_info200_response.py +97 -0
- crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +105 -0
- crypticorn/auth/client/models/resend_verification_email_request.py +84 -0
- crypticorn/auth/client/models/revoke_user_tokens_request.py +83 -0
- crypticorn/auth/client/models/rotate_tokens200_response.py +110 -0
- crypticorn/auth/client/models/token_info200_response.py +97 -0
- crypticorn/auth/client/models/unlink_wallet_request.py +83 -0
- crypticorn/auth/client/models/update_user_request.py +93 -0
- crypticorn/auth/client/models/user_reset_password_request.py +87 -0
- crypticorn/auth/client/models/user_set_password_request.py +89 -0
- crypticorn/auth/client/models/verify200_response.py +110 -0
- crypticorn/auth/client/models/verify_email200_response.py +107 -0
- crypticorn/auth/client/models/verify_email200_response_auth.py +101 -0
- crypticorn/auth/client/models/verify_email200_response_auth_auth.py +110 -0
- crypticorn/auth/client/models/verify_email_request.py +83 -0
- crypticorn/auth/client/models/verify_wallet_request.py +91 -0
- crypticorn/auth/client/models/wallet_verified200_response.py +83 -0
- crypticorn/auth/client/models/whoami200_response.py +104 -0
- crypticorn/auth/client/rest.py +195 -0
- crypticorn/auth/main.py +45 -0
- crypticorn/client.py +46 -8
- crypticorn/common/__init__.py +5 -0
- crypticorn/common/auth.py +43 -0
- crypticorn/common/auth_client.py +163 -0
- crypticorn/common/errors.py +432 -0
- crypticorn/common/scopes.py +29 -0
- crypticorn/common/urls.py +25 -0
- crypticorn/hive/__init__.py +2 -1
- crypticorn/hive/client/__init__.py +57 -0
- crypticorn/hive/client/api/__init__.py +6 -0
- crypticorn/hive/client/api/data_api.py +594 -0
- crypticorn/hive/client/api/models_api.py +1680 -0
- crypticorn/hive/client/api/status_api.py +263 -0
- crypticorn/hive/client/api_client.py +758 -0
- crypticorn/hive/client/api_response.py +20 -0
- crypticorn/hive/client/configuration.py +612 -0
- crypticorn/hive/client/exceptions.py +220 -0
- crypticorn/hive/client/models/__init__.py +38 -0
- crypticorn/hive/client/models/coins.py +44 -0
- crypticorn/hive/client/models/data_download_response.py +113 -0
- crypticorn/hive/client/models/data_info.py +115 -0
- crypticorn/hive/client/models/data_value_value_value_inner.py +154 -0
- crypticorn/hive/client/models/data_version.py +35 -0
- crypticorn/hive/client/models/download_links.py +91 -0
- crypticorn/hive/client/models/evaluation.py +86 -0
- crypticorn/hive/client/models/evaluation_response.py +85 -0
- crypticorn/hive/client/models/feature_size.py +36 -0
- crypticorn/hive/client/models/http_validation_error.py +99 -0
- crypticorn/hive/client/models/model.py +133 -0
- crypticorn/hive/client/models/model_create.py +93 -0
- crypticorn/hive/client/models/model_status.py +35 -0
- crypticorn/hive/client/models/model_update.py +83 -0
- crypticorn/hive/client/models/target.py +36 -0
- crypticorn/hive/client/models/target_type.py +35 -0
- crypticorn/hive/client/models/validation_error.py +105 -0
- crypticorn/hive/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/hive/client/py.typed +0 -0
- crypticorn/hive/client/rest.py +195 -0
- crypticorn/hive/main.py +27 -100
- crypticorn/klines/client/__init__.py +21 -7
- crypticorn/klines/client/api/__init__.py +0 -1
- crypticorn/klines/client/api/funding_rates_api.py +90 -79
- crypticorn/klines/client/api/health_check_api.py +29 -45
- crypticorn/klines/client/api/ohlcv_data_api.py +104 -87
- crypticorn/klines/client/api/symbols_api.py +36 -54
- crypticorn/klines/client/api/udf_api.py +228 -352
- crypticorn/klines/client/api_client.py +106 -148
- crypticorn/klines/client/api_response.py +2 -3
- crypticorn/klines/client/configuration.py +64 -50
- crypticorn/klines/client/exceptions.py +20 -16
- crypticorn/klines/client/models/__init__.py +21 -7
- crypticorn/klines/client/models/base_response_health_check_response.py +21 -15
- crypticorn/klines/client/models/base_response_list_funding_rate_response.py +21 -15
- crypticorn/klines/client/models/base_response_list_str.py +16 -14
- crypticorn/klines/client/models/base_response_ohlcv_response.py +21 -15
- crypticorn/klines/client/models/error_response.py +23 -15
- crypticorn/klines/client/models/exchange.py +11 -11
- crypticorn/klines/client/models/funding_rate_response.py +11 -11
- crypticorn/klines/client/models/health_check_response.py +14 -12
- crypticorn/klines/client/models/history_error_response.py +11 -11
- crypticorn/klines/client/models/history_no_data_response.py +16 -16
- crypticorn/klines/client/models/history_success_response.py +16 -16
- crypticorn/klines/client/models/http_validation_error.py +14 -10
- crypticorn/klines/client/models/market.py +2 -4
- crypticorn/klines/client/models/ohlcv_response.py +22 -15
- crypticorn/klines/client/models/resolution.py +5 -7
- crypticorn/klines/client/models/response_get_history_udf_history_get.py +71 -22
- crypticorn/klines/client/models/search_symbol_response.py +22 -15
- crypticorn/klines/client/models/sort_direction.py +2 -4
- crypticorn/klines/client/models/symbol_group_response.py +5 -9
- crypticorn/klines/client/models/symbol_info_response.py +40 -24
- crypticorn/klines/client/models/symbol_type.py +5 -10
- crypticorn/klines/client/models/timeframe.py +5 -7
- crypticorn/klines/client/models/udf_config_response.py +60 -21
- crypticorn/klines/client/models/validation_error.py +19 -13
- crypticorn/klines/client/models/validation_error_loc_inner.py +32 -11
- crypticorn/klines/client/rest.py +30 -41
- crypticorn/klines/main.py +52 -15
- crypticorn/pay/__init__.py +2 -0
- crypticorn/pay/client/__init__.py +52 -0
- crypticorn/pay/client/api/__init__.py +7 -0
- crypticorn/pay/client/api/now_payments_api.py +813 -0
- crypticorn/pay/client/api/payments_api.py +799 -0
- crypticorn/pay/client/api/products_api.py +891 -0
- crypticorn/pay/client/api/status_api.py +260 -0
- crypticorn/pay/client/api_client.py +758 -0
- crypticorn/pay/client/api_response.py +20 -0
- crypticorn/pay/client/configuration.py +612 -0
- crypticorn/pay/client/exceptions.py +220 -0
- crypticorn/pay/client/models/__init__.py +32 -0
- crypticorn/pay/client/models/api_status_res.py +83 -0
- crypticorn/pay/client/models/combined_payment_history.py +101 -0
- crypticorn/pay/client/models/create_invoice_req.py +188 -0
- crypticorn/pay/client/models/create_invoice_res.py +188 -0
- crypticorn/pay/client/models/currency.py +165 -0
- crypticorn/pay/client/models/estimate_price_req.py +91 -0
- crypticorn/pay/client/models/estimate_price_res.py +102 -0
- crypticorn/pay/client/models/get_currencies_res.py +99 -0
- crypticorn/pay/client/models/get_payment_status_res.py +222 -0
- crypticorn/pay/client/models/get_payments_list_res.py +109 -0
- crypticorn/pay/client/models/http_validation_error.py +99 -0
- crypticorn/pay/client/models/min_amount_req.py +124 -0
- crypticorn/pay/client/models/min_amount_res.py +105 -0
- crypticorn/pay/client/models/now_api_status_res.py +83 -0
- crypticorn/pay/client/models/now_create_invoice_req.py +188 -0
- crypticorn/pay/client/models/now_create_invoice_res.py +188 -0
- crypticorn/pay/client/models/now_fee_structure.py +104 -0
- crypticorn/pay/client/models/now_payment_model.py +124 -0
- crypticorn/pay/client/models/now_payment_status.py +42 -0
- crypticorn/pay/client/models/now_webhook_payload.py +181 -0
- crypticorn/pay/client/models/payment.py +231 -0
- crypticorn/pay/client/models/payment_status.py +40 -0
- crypticorn/pay/client/models/product.py +87 -0
- crypticorn/pay/client/models/product_model.py +119 -0
- crypticorn/pay/client/models/product_subs_model.py +108 -0
- crypticorn/pay/client/models/services.py +34 -0
- crypticorn/pay/client/models/unified_payment_model.py +112 -0
- crypticorn/pay/client/models/validation_error.py +105 -0
- crypticorn/pay/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/pay/client/py.typed +0 -0
- crypticorn/pay/client/rest.py +195 -0
- crypticorn/pay/main.py +35 -0
- crypticorn/trade/client/__init__.py +9 -4
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/api_keys_api.py +203 -304
- crypticorn/trade/client/api/bots_api.py +177 -250
- crypticorn/trade/client/api/exchanges_api.py +38 -57
- crypticorn/trade/client/api/futures_trading_panel_api.py +223 -321
- crypticorn/trade/client/api/notifications_api.py +247 -364
- crypticorn/trade/client/api/orders_api.py +44 -63
- crypticorn/trade/client/api/status_api.py +35 -53
- crypticorn/trade/client/api/strategies_api.py +852 -64
- crypticorn/trade/client/api/trading_actions_api.py +126 -203
- crypticorn/trade/client/api_client.py +115 -154
- crypticorn/trade/client/api_response.py +2 -3
- crypticorn/trade/client/configuration.py +128 -90
- crypticorn/trade/client/exceptions.py +21 -17
- crypticorn/trade/client/models/__init__.py +9 -4
- crypticorn/trade/client/models/action_model.py +114 -50
- crypticorn/trade/client/models/api_error_identifier.py +60 -51
- crypticorn/trade/client/models/api_error_level.py +37 -0
- crypticorn/trade/client/models/api_error_type.py +37 -0
- crypticorn/trade/client/models/api_key_model.py +49 -28
- crypticorn/trade/client/models/bot_model.py +76 -31
- crypticorn/trade/client/models/bot_status.py +37 -0
- crypticorn/trade/client/models/exchange.py +3 -5
- crypticorn/trade/client/models/execution_ids.py +14 -14
- crypticorn/trade/client/models/futures_balance.py +39 -23
- crypticorn/trade/client/models/futures_trading_action.py +98 -46
- crypticorn/trade/client/models/http_validation_error.py +15 -11
- crypticorn/trade/client/models/margin_mode.py +3 -5
- crypticorn/trade/client/models/market_type.py +3 -5
- crypticorn/trade/client/models/notification_model.py +60 -27
- crypticorn/trade/client/models/notification_type.py +4 -6
- crypticorn/trade/client/models/order_model.py +125 -65
- crypticorn/trade/client/models/order_status.py +6 -8
- crypticorn/trade/client/models/post_futures_action.py +16 -12
- crypticorn/trade/client/models/strategy_exchange_info.py +11 -12
- crypticorn/trade/client/models/strategy_model.py +66 -27
- crypticorn/trade/client/models/strategy_model_input.py +160 -0
- crypticorn/trade/client/models/strategy_model_output.py +160 -0
- crypticorn/trade/client/models/tpsl.py +35 -21
- crypticorn/trade/client/models/trading_action_type.py +5 -7
- crypticorn/trade/client/models/update_notification.py +17 -13
- crypticorn/trade/client/models/validation_error.py +20 -14
- crypticorn/trade/client/models/validation_error_loc_inner.py +33 -12
- crypticorn/trade/client/rest.py +108 -170
- crypticorn/trade/main.py +26 -19
- crypticorn-2.0.0.dist-info/METADATA +74 -0
- crypticorn-2.0.0.dist-info/RECORD +226 -0
- {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/WHEEL +1 -1
- crypticorn/hive/requirements.txt +0 -4
- crypticorn/hive/utils.py +0 -109
- crypticorn/klines/requirements.txt +0 -4
- crypticorn/klines/test/test_base_response_health_check_response.py +0 -56
- crypticorn/klines/test/test_base_response_list_funding_rate_response.py +0 -59
- crypticorn/klines/test/test_base_response_list_str.py +0 -56
- crypticorn/klines/test/test_base_response_ohlcv_response.py +0 -72
- crypticorn/klines/test/test_error_response.py +0 -57
- crypticorn/klines/test/test_exchange.py +0 -56
- crypticorn/klines/test/test_funding_rate_response.py +0 -56
- crypticorn/klines/test/test_funding_rates_api.py +0 -38
- crypticorn/klines/test/test_health_check_api.py +0 -38
- crypticorn/klines/test/test_health_check_response.py +0 -52
- crypticorn/klines/test/test_history_error_response.py +0 -53
- crypticorn/klines/test/test_history_no_data_response.py +0 -69
- crypticorn/klines/test/test_history_success_response.py +0 -87
- crypticorn/klines/test/test_http_validation_error.py +0 -58
- crypticorn/klines/test/test_market.py +0 -33
- crypticorn/klines/test/test_ohlcv_data_api.py +0 -38
- crypticorn/klines/test/test_ohlcv_response.py +0 -86
- crypticorn/klines/test/test_resolution.py +0 -33
- crypticorn/klines/test/test_response_get_history_udf_history_get.py +0 -89
- crypticorn/klines/test/test_search_symbol_response.py +0 -62
- crypticorn/klines/test/test_sort_direction.py +0 -33
- crypticorn/klines/test/test_symbol_group_response.py +0 -53
- crypticorn/klines/test/test_symbol_info_response.py +0 -84
- crypticorn/klines/test/test_symbol_type.py +0 -54
- crypticorn/klines/test/test_symbols_api.py +0 -38
- crypticorn/klines/test/test_timeframe.py +0 -33
- crypticorn/klines/test/test_udf_api.py +0 -80
- crypticorn/klines/test/test_udf_config_response.py +0 -95
- crypticorn/klines/test/test_validation_error.py +0 -60
- crypticorn/klines/test/test_validation_error_loc_inner.py +0 -50
- crypticorn/trade/requirements.txt +0 -4
- crypticorn-1.0.2rc3.dist-info/LICENSE.md +0 -19
- crypticorn-1.0.2rc3.dist-info/METADATA +0 -47
- crypticorn-1.0.2rc3.dist-info/RECORD +0 -128
- /crypticorn/{klines/test/__init__.py → auth/client/py.typed} +0 -0
- {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/top_level.txt +0 -0
@@ -25,9 +25,16 @@ import urllib3
|
|
25
25
|
|
26
26
|
|
27
27
|
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
"multipleOf",
|
29
|
+
"maximum",
|
30
|
+
"exclusiveMaximum",
|
31
|
+
"minimum",
|
32
|
+
"exclusiveMinimum",
|
33
|
+
"maxLength",
|
34
|
+
"minLength",
|
35
|
+
"pattern",
|
36
|
+
"maxItems",
|
37
|
+
"minItems",
|
31
38
|
}
|
32
39
|
|
33
40
|
ServerVariablesT = Dict[str, str]
|
@@ -112,8 +119,7 @@ HTTPSignatureAuthSetting = TypedDict(
|
|
112
119
|
|
113
120
|
AuthSettings = TypedDict(
|
114
121
|
"AuthSettings",
|
115
|
-
{
|
116
|
-
},
|
122
|
+
{},
|
117
123
|
total=False,
|
118
124
|
)
|
119
125
|
|
@@ -167,25 +173,26 @@ class Configuration:
|
|
167
173
|
|
168
174
|
def __init__(
|
169
175
|
self,
|
170
|
-
host: Optional[str]=None,
|
171
|
-
api_key: Optional[Dict[str, str]]=None,
|
172
|
-
api_key_prefix: Optional[Dict[str, str]]=None,
|
173
|
-
username: Optional[str]=None,
|
174
|
-
password: Optional[str]=None,
|
175
|
-
access_token: Optional[str]=None,
|
176
|
-
server_index: Optional[int]=None,
|
177
|
-
server_variables: Optional[ServerVariablesT]=None,
|
178
|
-
server_operation_index: Optional[Dict[int, int]]=None,
|
179
|
-
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
180
|
-
ignore_operation_servers: bool=False,
|
181
|
-
ssl_ca_cert: Optional[str]=None,
|
176
|
+
host: Optional[str] = None,
|
177
|
+
api_key: Optional[Dict[str, str]] = None,
|
178
|
+
api_key_prefix: Optional[Dict[str, str]] = None,
|
179
|
+
username: Optional[str] = None,
|
180
|
+
password: Optional[str] = None,
|
181
|
+
access_token: Optional[str] = None,
|
182
|
+
server_index: Optional[int] = None,
|
183
|
+
server_variables: Optional[ServerVariablesT] = None,
|
184
|
+
server_operation_index: Optional[Dict[int, int]] = None,
|
185
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None,
|
186
|
+
ignore_operation_servers: bool = False,
|
187
|
+
ssl_ca_cert: Optional[str] = None,
|
182
188
|
retries: Optional[int] = None,
|
183
189
|
*,
|
184
190
|
debug: Optional[bool] = None,
|
185
191
|
) -> None:
|
186
|
-
"""Constructor
|
187
|
-
|
188
|
-
|
192
|
+
"""Constructor"""
|
193
|
+
self._base_path = (
|
194
|
+
"https://api.crypticorn.dev/v1/klines" if host is None else host
|
195
|
+
)
|
189
196
|
"""Default Base url
|
190
197
|
"""
|
191
198
|
self.server_index = 0 if server_index is None and host is None else server_index
|
@@ -230,7 +237,7 @@ class Configuration:
|
|
230
237
|
"""
|
231
238
|
self.logger["package_logger"] = logging.getLogger("client")
|
232
239
|
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
|
233
|
-
self.logger_format =
|
240
|
+
self.logger_format = "%(asctime)s %(levelname)s %(message)s"
|
234
241
|
"""Log format
|
235
242
|
"""
|
236
243
|
self.logger_stream_handler = None
|
@@ -285,7 +292,7 @@ class Configuration:
|
|
285
292
|
self.proxy_headers = None
|
286
293
|
"""Proxy headers
|
287
294
|
"""
|
288
|
-
self.safe_chars_for_path_param =
|
295
|
+
self.safe_chars_for_path_param = ""
|
289
296
|
"""Safe chars for path_param
|
290
297
|
"""
|
291
298
|
self.retries = retries
|
@@ -306,12 +313,12 @@ class Configuration:
|
|
306
313
|
"""date format
|
307
314
|
"""
|
308
315
|
|
309
|
-
def __deepcopy__(self, memo:
|
316
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
310
317
|
cls = self.__class__
|
311
318
|
result = cls.__new__(cls)
|
312
319
|
memo[id(self)] = result
|
313
320
|
for k, v in self.__dict__.items():
|
314
|
-
if k not in (
|
321
|
+
if k not in ("logger", "logger_file_handler"):
|
315
322
|
setattr(result, k, copy.deepcopy(v, memo))
|
316
323
|
# shallow copy of loggers
|
317
324
|
result.logger = copy.copy(self.logger)
|
@@ -443,7 +450,9 @@ class Configuration:
|
|
443
450
|
self.__logger_format = value
|
444
451
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
445
452
|
|
446
|
-
def get_api_key_with_prefix(
|
453
|
+
def get_api_key_with_prefix(
|
454
|
+
self, identifier: str, alias: Optional[str] = None
|
455
|
+
) -> Optional[str]:
|
447
456
|
"""Gets API key (with prefix if set).
|
448
457
|
|
449
458
|
:param identifier: The identifier of apiKey.
|
@@ -452,7 +461,9 @@ class Configuration:
|
|
452
461
|
"""
|
453
462
|
if self.refresh_api_key_hook is not None:
|
454
463
|
self.refresh_api_key_hook(self)
|
455
|
-
key = self.api_key.get(
|
464
|
+
key = self.api_key.get(
|
465
|
+
identifier, self.api_key.get(alias) if alias is not None else None
|
466
|
+
)
|
456
467
|
if key:
|
457
468
|
prefix = self.api_key_prefix.get(identifier)
|
458
469
|
if prefix:
|
@@ -473,11 +484,11 @@ class Configuration:
|
|
473
484
|
password = ""
|
474
485
|
if self.password is not None:
|
475
486
|
password = self.password
|
476
|
-
return urllib3.util.make_headers(
|
477
|
-
|
478
|
-
)
|
487
|
+
return urllib3.util.make_headers(basic_auth=username + ":" + password).get(
|
488
|
+
"authorization"
|
489
|
+
)
|
479
490
|
|
480
|
-
def auth_settings(self)-> AuthSettings:
|
491
|
+
def auth_settings(self) -> AuthSettings:
|
481
492
|
"""Gets Auth Settings dict for api client.
|
482
493
|
|
483
494
|
:return: The Auth Settings information dict.
|
@@ -490,12 +501,13 @@ class Configuration:
|
|
490
501
|
|
491
502
|
:return: The report for debugging.
|
492
503
|
"""
|
493
|
-
return
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
504
|
+
return (
|
505
|
+
"Python SDK Debug Report:\n"
|
506
|
+
"OS: {env}\n"
|
507
|
+
"Python Version: {pyversion}\n"
|
508
|
+
"Version of the API: 1.0.0\n"
|
509
|
+
"SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
|
510
|
+
)
|
499
511
|
|
500
512
|
def get_host_settings(self) -> List[HostSetting]:
|
501
513
|
"""Gets an array of host settings
|
@@ -504,16 +516,16 @@ class Configuration:
|
|
504
516
|
"""
|
505
517
|
return [
|
506
518
|
{
|
507
|
-
|
508
|
-
|
519
|
+
"url": "https://api.crypticorn.dev/v1/klines",
|
520
|
+
"description": "No description provided",
|
509
521
|
}
|
510
522
|
]
|
511
523
|
|
512
524
|
def get_host_from_settings(
|
513
525
|
self,
|
514
526
|
index: Optional[int],
|
515
|
-
variables: Optional[ServerVariablesT]=None,
|
516
|
-
servers: Optional[List[HostSetting]]=None,
|
527
|
+
variables: Optional[ServerVariablesT] = None,
|
528
|
+
servers: Optional[List[HostSetting]] = None,
|
517
529
|
) -> str:
|
518
530
|
"""Gets host URL based on the index and variables
|
519
531
|
:param index: array index of the host settings
|
@@ -532,22 +544,22 @@ class Configuration:
|
|
532
544
|
except IndexError:
|
533
545
|
raise ValueError(
|
534
546
|
"Invalid index {0} when selecting the host settings. "
|
535
|
-
"Must be less than {1}".format(index, len(servers))
|
547
|
+
"Must be less than {1}".format(index, len(servers))
|
548
|
+
)
|
536
549
|
|
537
|
-
url = server[
|
550
|
+
url = server["url"]
|
538
551
|
|
539
552
|
# go through variables and replace placeholders
|
540
|
-
for variable_name, variable in server.get(
|
541
|
-
used_value = variables.get(
|
542
|
-
variable_name, variable['default_value'])
|
553
|
+
for variable_name, variable in server.get("variables", {}).items():
|
554
|
+
used_value = variables.get(variable_name, variable["default_value"])
|
543
555
|
|
544
|
-
if
|
545
|
-
and used_value not in variable['enum_values']:
|
556
|
+
if "enum_values" in variable and used_value not in variable["enum_values"]:
|
546
557
|
raise ValueError(
|
547
558
|
"The variable `{0}` in the host URL has invalid value "
|
548
559
|
"{1}. Must be {2}.".format(
|
549
|
-
variable_name, variables[variable_name],
|
550
|
-
|
560
|
+
variable_name, variables[variable_name], variable["enum_values"]
|
561
|
+
)
|
562
|
+
)
|
551
563
|
|
552
564
|
url = url.replace("{" + variable_name + "}", used_value)
|
553
565
|
|
@@ -556,7 +568,9 @@ class Configuration:
|
|
556
568
|
@property
|
557
569
|
def host(self) -> str:
|
558
570
|
"""Return generated host."""
|
559
|
-
return self.get_host_from_settings(
|
571
|
+
return self.get_host_from_settings(
|
572
|
+
self.server_index, variables=self.server_variables
|
573
|
+
)
|
560
574
|
|
561
575
|
@host.setter
|
562
576
|
def host(self, value: str) -> None:
|
@@ -14,14 +14,16 @@
|
|
14
14
|
from typing import Any, Optional
|
15
15
|
from typing_extensions import Self
|
16
16
|
|
17
|
+
|
17
18
|
class OpenApiException(Exception):
|
18
19
|
"""The base exception class for all OpenAPIExceptions"""
|
19
20
|
|
20
21
|
|
21
22
|
class ApiTypeError(OpenApiException, TypeError):
|
22
|
-
def __init__(
|
23
|
-
|
24
|
-
|
23
|
+
def __init__(
|
24
|
+
self, msg, path_to_item=None, valid_classes=None, key_type=None
|
25
|
+
) -> None:
|
26
|
+
"""Raises an exception for TypeErrors
|
25
27
|
|
26
28
|
Args:
|
27
29
|
msg (str): the exception message
|
@@ -104,9 +106,9 @@ class ApiKeyError(OpenApiException, KeyError):
|
|
104
106
|
class ApiException(OpenApiException):
|
105
107
|
|
106
108
|
def __init__(
|
107
|
-
self,
|
108
|
-
status=None,
|
109
|
-
reason=None,
|
109
|
+
self,
|
110
|
+
status=None,
|
111
|
+
reason=None,
|
110
112
|
http_resp=None,
|
111
113
|
*,
|
112
114
|
body: Optional[str] = None,
|
@@ -125,17 +127,17 @@ class ApiException(OpenApiException):
|
|
125
127
|
self.reason = http_resp.reason
|
126
128
|
if self.body is None:
|
127
129
|
try:
|
128
|
-
self.body = http_resp.data.decode(
|
130
|
+
self.body = http_resp.data.decode("utf-8")
|
129
131
|
except Exception:
|
130
132
|
pass
|
131
133
|
self.headers = http_resp.getheaders()
|
132
134
|
|
133
135
|
@classmethod
|
134
136
|
def from_response(
|
135
|
-
cls,
|
136
|
-
*,
|
137
|
-
http_resp,
|
138
|
-
body: Optional[str],
|
137
|
+
cls,
|
138
|
+
*,
|
139
|
+
http_resp,
|
140
|
+
body: Optional[str],
|
139
141
|
data: Optional[Any],
|
140
142
|
) -> Self:
|
141
143
|
if http_resp.status == 400:
|
@@ -155,7 +157,9 @@ class ApiException(OpenApiException):
|
|
155
157
|
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
156
158
|
|
157
159
|
if http_resp.status == 422:
|
158
|
-
raise UnprocessableEntityException(
|
160
|
+
raise UnprocessableEntityException(
|
161
|
+
http_resp=http_resp, body=body, data=data
|
162
|
+
)
|
159
163
|
|
160
164
|
if 500 <= http_resp.status <= 599:
|
161
165
|
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
@@ -163,11 +167,9 @@ class ApiException(OpenApiException):
|
|
163
167
|
|
164
168
|
def __str__(self):
|
165
169
|
"""Custom error messages for exception"""
|
166
|
-
error_message = "({0})\n"\
|
167
|
-
"Reason: {1}\n".format(self.status, self.reason)
|
170
|
+
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
|
168
171
|
if self.headers:
|
169
|
-
error_message += "HTTP response headers: {0}\n".format(
|
170
|
-
self.headers)
|
172
|
+
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
171
173
|
|
172
174
|
if self.data or self.body:
|
173
175
|
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
@@ -197,11 +199,13 @@ class ServiceException(ApiException):
|
|
197
199
|
|
198
200
|
class ConflictException(ApiException):
|
199
201
|
"""Exception for HTTP 409 Conflict."""
|
202
|
+
|
200
203
|
pass
|
201
204
|
|
202
205
|
|
203
206
|
class UnprocessableEntityException(ApiException):
|
204
207
|
"""Exception for HTTP 422 Unprocessable Entity."""
|
208
|
+
|
205
209
|
pass
|
206
210
|
|
207
211
|
|
@@ -14,22 +14,34 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
# import models into model package
|
17
|
-
from crypticorn.klines.client.models.base_response_health_check_response import
|
18
|
-
|
17
|
+
from crypticorn.klines.client.models.base_response_health_check_response import (
|
18
|
+
BaseResponseHealthCheckResponse,
|
19
|
+
)
|
20
|
+
from crypticorn.klines.client.models.base_response_list_funding_rate_response import (
|
21
|
+
BaseResponseListFundingRateResponse,
|
22
|
+
)
|
19
23
|
from crypticorn.klines.client.models.base_response_list_str import BaseResponseListStr
|
20
|
-
from crypticorn.klines.client.models.base_response_ohlcv_response import
|
24
|
+
from crypticorn.klines.client.models.base_response_ohlcv_response import (
|
25
|
+
BaseResponseOHLCVResponse,
|
26
|
+
)
|
21
27
|
from crypticorn.klines.client.models.error_response import ErrorResponse
|
22
28
|
from crypticorn.klines.client.models.exchange import Exchange
|
23
29
|
from crypticorn.klines.client.models.funding_rate_response import FundingRateResponse
|
24
30
|
from crypticorn.klines.client.models.http_validation_error import HTTPValidationError
|
25
31
|
from crypticorn.klines.client.models.health_check_response import HealthCheckResponse
|
26
32
|
from crypticorn.klines.client.models.history_error_response import HistoryErrorResponse
|
27
|
-
from crypticorn.klines.client.models.history_no_data_response import
|
28
|
-
|
33
|
+
from crypticorn.klines.client.models.history_no_data_response import (
|
34
|
+
HistoryNoDataResponse,
|
35
|
+
)
|
36
|
+
from crypticorn.klines.client.models.history_success_response import (
|
37
|
+
HistorySuccessResponse,
|
38
|
+
)
|
29
39
|
from crypticorn.klines.client.models.market import Market
|
30
40
|
from crypticorn.klines.client.models.ohlcv_response import OHLCVResponse
|
31
41
|
from crypticorn.klines.client.models.resolution import Resolution
|
32
|
-
from crypticorn.klines.client.models.response_get_history_udf_history_get import
|
42
|
+
from crypticorn.klines.client.models.response_get_history_udf_history_get import (
|
43
|
+
ResponseGetHistoryUdfHistoryGet,
|
44
|
+
)
|
33
45
|
from crypticorn.klines.client.models.search_symbol_response import SearchSymbolResponse
|
34
46
|
from crypticorn.klines.client.models.sort_direction import SortDirection
|
35
47
|
from crypticorn.klines.client.models.symbol_group_response import SymbolGroupResponse
|
@@ -38,4 +50,6 @@ from crypticorn.klines.client.models.symbol_type import SymbolType
|
|
38
50
|
from crypticorn.klines.client.models.timeframe import Timeframe
|
39
51
|
from crypticorn.klines.client.models.udf_config_response import UDFConfigResponse
|
40
52
|
from crypticorn.klines.client.models.validation_error import ValidationError
|
41
|
-
from crypticorn.klines.client.models.validation_error_loc_inner import
|
53
|
+
from crypticorn.klines.client.models.validation_error_loc_inner import (
|
54
|
+
ValidationErrorLocInner,
|
55
|
+
)
|
@@ -24,10 +24,12 @@ from crypticorn.klines.client.models.health_check_response import HealthCheckRes
|
|
24
24
|
from typing import Optional, Set
|
25
25
|
from typing_extensions import Self
|
26
26
|
|
27
|
+
|
27
28
|
class BaseResponseHealthCheckResponse(BaseModel):
|
28
29
|
"""
|
29
30
|
BaseResponseHealthCheckResponse
|
30
|
-
"""
|
31
|
+
""" # noqa: E501
|
32
|
+
|
31
33
|
success: Optional[StrictBool] = True
|
32
34
|
message: Optional[StrictStr] = None
|
33
35
|
data: Optional[HealthCheckResponse] = None
|
@@ -40,7 +42,6 @@ class BaseResponseHealthCheckResponse(BaseModel):
|
|
40
42
|
protected_namespaces=(),
|
41
43
|
)
|
42
44
|
|
43
|
-
|
44
45
|
def to_str(self) -> str:
|
45
46
|
"""Returns the string representation of the model using alias"""
|
46
47
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -65,8 +66,7 @@ class BaseResponseHealthCheckResponse(BaseModel):
|
|
65
66
|
were set at model initialization. Other fields with value `None`
|
66
67
|
are ignored.
|
67
68
|
"""
|
68
|
-
excluded_fields: Set[str] = set([
|
69
|
-
])
|
69
|
+
excluded_fields: Set[str] = set([])
|
70
70
|
|
71
71
|
_dict = self.model_dump(
|
72
72
|
by_alias=True,
|
@@ -75,16 +75,16 @@ class BaseResponseHealthCheckResponse(BaseModel):
|
|
75
75
|
)
|
76
76
|
# override the default output from pydantic by calling `to_dict()` of data
|
77
77
|
if self.data:
|
78
|
-
_dict[
|
78
|
+
_dict["data"] = self.data.to_dict()
|
79
79
|
# set to None if message (nullable) is None
|
80
80
|
# and model_fields_set contains the field
|
81
81
|
if self.message is None and "message" in self.model_fields_set:
|
82
|
-
_dict[
|
82
|
+
_dict["message"] = None
|
83
83
|
|
84
84
|
# set to None if data (nullable) is None
|
85
85
|
# and model_fields_set contains the field
|
86
86
|
if self.data is None and "data" in self.model_fields_set:
|
87
|
-
_dict[
|
87
|
+
_dict["data"] = None
|
88
88
|
|
89
89
|
return _dict
|
90
90
|
|
@@ -97,12 +97,18 @@ class BaseResponseHealthCheckResponse(BaseModel):
|
|
97
97
|
if not isinstance(obj, dict):
|
98
98
|
return cls.model_validate(obj)
|
99
99
|
|
100
|
-
_obj = cls.model_validate(
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
_obj = cls.model_validate(
|
101
|
+
{
|
102
|
+
"success": (
|
103
|
+
obj.get("success") if obj.get("success") is not None else True
|
104
|
+
),
|
105
|
+
"message": obj.get("message"),
|
106
|
+
"data": (
|
107
|
+
HealthCheckResponse.from_dict(obj["data"])
|
108
|
+
if obj.get("data") is not None
|
109
|
+
else None
|
110
|
+
),
|
111
|
+
"timestamp": obj.get("timestamp"),
|
112
|
+
}
|
113
|
+
)
|
106
114
|
return _obj
|
107
|
-
|
108
|
-
|
@@ -24,10 +24,12 @@ from crypticorn.klines.client.models.funding_rate_response import FundingRateRes
|
|
24
24
|
from typing import Optional, Set
|
25
25
|
from typing_extensions import Self
|
26
26
|
|
27
|
+
|
27
28
|
class BaseResponseListFundingRateResponse(BaseModel):
|
28
29
|
"""
|
29
30
|
BaseResponseListFundingRateResponse
|
30
|
-
"""
|
31
|
+
""" # noqa: E501
|
32
|
+
|
31
33
|
success: Optional[StrictBool] = True
|
32
34
|
message: Optional[StrictStr] = None
|
33
35
|
data: Optional[List[FundingRateResponse]] = None
|
@@ -40,7 +42,6 @@ class BaseResponseListFundingRateResponse(BaseModel):
|
|
40
42
|
protected_namespaces=(),
|
41
43
|
)
|
42
44
|
|
43
|
-
|
44
45
|
def to_str(self) -> str:
|
45
46
|
"""Returns the string representation of the model using alias"""
|
46
47
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -65,8 +66,7 @@ class BaseResponseListFundingRateResponse(BaseModel):
|
|
65
66
|
were set at model initialization. Other fields with value `None`
|
66
67
|
are ignored.
|
67
68
|
"""
|
68
|
-
excluded_fields: Set[str] = set([
|
69
|
-
])
|
69
|
+
excluded_fields: Set[str] = set([])
|
70
70
|
|
71
71
|
_dict = self.model_dump(
|
72
72
|
by_alias=True,
|
@@ -79,16 +79,16 @@ class BaseResponseListFundingRateResponse(BaseModel):
|
|
79
79
|
for _item_data in self.data:
|
80
80
|
if _item_data:
|
81
81
|
_items.append(_item_data.to_dict())
|
82
|
-
_dict[
|
82
|
+
_dict["data"] = _items
|
83
83
|
# set to None if message (nullable) is None
|
84
84
|
# and model_fields_set contains the field
|
85
85
|
if self.message is None and "message" in self.model_fields_set:
|
86
|
-
_dict[
|
86
|
+
_dict["message"] = None
|
87
87
|
|
88
88
|
# set to None if data (nullable) is None
|
89
89
|
# and model_fields_set contains the field
|
90
90
|
if self.data is None and "data" in self.model_fields_set:
|
91
|
-
_dict[
|
91
|
+
_dict["data"] = None
|
92
92
|
|
93
93
|
return _dict
|
94
94
|
|
@@ -101,12 +101,18 @@ class BaseResponseListFundingRateResponse(BaseModel):
|
|
101
101
|
if not isinstance(obj, dict):
|
102
102
|
return cls.model_validate(obj)
|
103
103
|
|
104
|
-
_obj = cls.model_validate(
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
_obj = cls.model_validate(
|
105
|
+
{
|
106
|
+
"success": (
|
107
|
+
obj.get("success") if obj.get("success") is not None else True
|
108
|
+
),
|
109
|
+
"message": obj.get("message"),
|
110
|
+
"data": (
|
111
|
+
[FundingRateResponse.from_dict(_item) for _item in obj["data"]]
|
112
|
+
if obj.get("data") is not None
|
113
|
+
else None
|
114
|
+
),
|
115
|
+
"timestamp": obj.get("timestamp"),
|
116
|
+
}
|
117
|
+
)
|
110
118
|
return _obj
|
111
|
-
|
112
|
-
|
@@ -23,10 +23,12 @@ from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing import Optional, Set
|
24
24
|
from typing_extensions import Self
|
25
25
|
|
26
|
+
|
26
27
|
class BaseResponseListStr(BaseModel):
|
27
28
|
"""
|
28
29
|
BaseResponseListStr
|
29
|
-
"""
|
30
|
+
""" # noqa: E501
|
31
|
+
|
30
32
|
success: Optional[StrictBool] = True
|
31
33
|
message: Optional[StrictStr] = None
|
32
34
|
data: Optional[List[StrictStr]] = None
|
@@ -39,7 +41,6 @@ class BaseResponseListStr(BaseModel):
|
|
39
41
|
protected_namespaces=(),
|
40
42
|
)
|
41
43
|
|
42
|
-
|
43
44
|
def to_str(self) -> str:
|
44
45
|
"""Returns the string representation of the model using alias"""
|
45
46
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -64,8 +65,7 @@ class BaseResponseListStr(BaseModel):
|
|
64
65
|
were set at model initialization. Other fields with value `None`
|
65
66
|
are ignored.
|
66
67
|
"""
|
67
|
-
excluded_fields: Set[str] = set([
|
68
|
-
])
|
68
|
+
excluded_fields: Set[str] = set([])
|
69
69
|
|
70
70
|
_dict = self.model_dump(
|
71
71
|
by_alias=True,
|
@@ -75,12 +75,12 @@ class BaseResponseListStr(BaseModel):
|
|
75
75
|
# set to None if message (nullable) is None
|
76
76
|
# and model_fields_set contains the field
|
77
77
|
if self.message is None and "message" in self.model_fields_set:
|
78
|
-
_dict[
|
78
|
+
_dict["message"] = None
|
79
79
|
|
80
80
|
# set to None if data (nullable) is None
|
81
81
|
# and model_fields_set contains the field
|
82
82
|
if self.data is None and "data" in self.model_fields_set:
|
83
|
-
_dict[
|
83
|
+
_dict["data"] = None
|
84
84
|
|
85
85
|
return _dict
|
86
86
|
|
@@ -93,12 +93,14 @@ class BaseResponseListStr(BaseModel):
|
|
93
93
|
if not isinstance(obj, dict):
|
94
94
|
return cls.model_validate(obj)
|
95
95
|
|
96
|
-
_obj = cls.model_validate(
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
96
|
+
_obj = cls.model_validate(
|
97
|
+
{
|
98
|
+
"success": (
|
99
|
+
obj.get("success") if obj.get("success") is not None else True
|
100
|
+
),
|
101
|
+
"message": obj.get("message"),
|
102
|
+
"data": obj.get("data"),
|
103
|
+
"timestamp": obj.get("timestamp"),
|
104
|
+
}
|
105
|
+
)
|
102
106
|
return _obj
|
103
|
-
|
104
|
-
|
@@ -24,10 +24,12 @@ from crypticorn.klines.client.models.ohlcv_response import OHLCVResponse
|
|
24
24
|
from typing import Optional, Set
|
25
25
|
from typing_extensions import Self
|
26
26
|
|
27
|
+
|
27
28
|
class BaseResponseOHLCVResponse(BaseModel):
|
28
29
|
"""
|
29
30
|
BaseResponseOHLCVResponse
|
30
|
-
"""
|
31
|
+
""" # noqa: E501
|
32
|
+
|
31
33
|
success: Optional[StrictBool] = True
|
32
34
|
message: Optional[StrictStr] = None
|
33
35
|
data: Optional[OHLCVResponse] = None
|
@@ -40,7 +42,6 @@ class BaseResponseOHLCVResponse(BaseModel):
|
|
40
42
|
protected_namespaces=(),
|
41
43
|
)
|
42
44
|
|
43
|
-
|
44
45
|
def to_str(self) -> str:
|
45
46
|
"""Returns the string representation of the model using alias"""
|
46
47
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -65,8 +66,7 @@ class BaseResponseOHLCVResponse(BaseModel):
|
|
65
66
|
were set at model initialization. Other fields with value `None`
|
66
67
|
are ignored.
|
67
68
|
"""
|
68
|
-
excluded_fields: Set[str] = set([
|
69
|
-
])
|
69
|
+
excluded_fields: Set[str] = set([])
|
70
70
|
|
71
71
|
_dict = self.model_dump(
|
72
72
|
by_alias=True,
|
@@ -75,16 +75,16 @@ class BaseResponseOHLCVResponse(BaseModel):
|
|
75
75
|
)
|
76
76
|
# override the default output from pydantic by calling `to_dict()` of data
|
77
77
|
if self.data:
|
78
|
-
_dict[
|
78
|
+
_dict["data"] = self.data.to_dict()
|
79
79
|
# set to None if message (nullable) is None
|
80
80
|
# and model_fields_set contains the field
|
81
81
|
if self.message is None and "message" in self.model_fields_set:
|
82
|
-
_dict[
|
82
|
+
_dict["message"] = None
|
83
83
|
|
84
84
|
# set to None if data (nullable) is None
|
85
85
|
# and model_fields_set contains the field
|
86
86
|
if self.data is None and "data" in self.model_fields_set:
|
87
|
-
_dict[
|
87
|
+
_dict["data"] = None
|
88
88
|
|
89
89
|
return _dict
|
90
90
|
|
@@ -97,12 +97,18 @@ class BaseResponseOHLCVResponse(BaseModel):
|
|
97
97
|
if not isinstance(obj, dict):
|
98
98
|
return cls.model_validate(obj)
|
99
99
|
|
100
|
-
_obj = cls.model_validate(
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
_obj = cls.model_validate(
|
101
|
+
{
|
102
|
+
"success": (
|
103
|
+
obj.get("success") if obj.get("success") is not None else True
|
104
|
+
),
|
105
|
+
"message": obj.get("message"),
|
106
|
+
"data": (
|
107
|
+
OHLCVResponse.from_dict(obj["data"])
|
108
|
+
if obj.get("data") is not None
|
109
|
+
else None
|
110
|
+
),
|
111
|
+
"timestamp": obj.get("timestamp"),
|
112
|
+
}
|
113
|
+
)
|
106
114
|
return _obj
|
107
|
-
|
108
|
-
|