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
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -16,7 +16,6 @@ import copy
|
|
16
16
|
import http.client as httplib
|
17
17
|
import logging
|
18
18
|
from logging import FileHandler
|
19
|
-
import multiprocessing
|
20
19
|
import sys
|
21
20
|
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
|
22
21
|
from typing_extensions import NotRequired, Self
|
@@ -25,9 +24,16 @@ import urllib3
|
|
25
24
|
|
26
25
|
|
27
26
|
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
"multipleOf",
|
28
|
+
"maximum",
|
29
|
+
"exclusiveMaximum",
|
30
|
+
"minimum",
|
31
|
+
"exclusiveMinimum",
|
32
|
+
"maxLength",
|
33
|
+
"minLength",
|
34
|
+
"pattern",
|
35
|
+
"maxItems",
|
36
|
+
"minItems",
|
31
37
|
}
|
32
38
|
|
33
39
|
ServerVariablesT = Dict[str, str]
|
@@ -113,7 +119,8 @@ HTTPSignatureAuthSetting = TypedDict(
|
|
113
119
|
AuthSettings = TypedDict(
|
114
120
|
"AuthSettings",
|
115
121
|
{
|
116
|
-
"
|
122
|
+
"HTTPBearer": BearerAuthSetting,
|
123
|
+
"APIKeyHeader": APIKeyAuthSetting,
|
117
124
|
},
|
118
125
|
total=False,
|
119
126
|
)
|
@@ -134,59 +141,77 @@ class HostSetting(TypedDict):
|
|
134
141
|
class Configuration:
|
135
142
|
"""This class contains various settings of the API client.
|
136
143
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
144
|
+
:param host: Base url.
|
145
|
+
:param ignore_operation_servers
|
146
|
+
Boolean to ignore operation servers for the API client.
|
147
|
+
Config will use `host` as the base url regardless of the operation servers.
|
148
|
+
:param api_key: Dict to store API key(s).
|
149
|
+
Each entry in the dict specifies an API key.
|
150
|
+
The dict key is the name of the security scheme in the OAS specification.
|
151
|
+
The dict value is the API key secret.
|
152
|
+
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
|
153
|
+
The dict key is the name of the security scheme in the OAS specification.
|
154
|
+
The dict value is an API key prefix when generating the auth data.
|
155
|
+
:param username: Username for HTTP basic authentication.
|
156
|
+
:param password: Password for HTTP basic authentication.
|
157
|
+
:param access_token: Access token.
|
158
|
+
:param server_index: Index to servers configuration.
|
159
|
+
:param server_variables: Mapping with string values to replace variables in
|
160
|
+
templated server configuration. The validation of enums is performed for
|
161
|
+
variables with defined enum values before.
|
162
|
+
:param server_operation_index: Mapping from operation ID to an index to server
|
163
|
+
configuration.
|
164
|
+
:param server_operation_variables: Mapping from operation ID to a mapping with
|
165
|
+
string values to replace variables in templated server configuration.
|
166
|
+
The validation of enums is performed for variables with defined enum
|
167
|
+
values before.
|
168
|
+
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
169
|
+
in PEM format.
|
170
|
+
:param retries: Number of retries for API requests.
|
171
|
+
|
172
|
+
:Example:
|
173
|
+
|
174
|
+
API Key Authentication Example.
|
175
|
+
Given the following security scheme in the OpenAPI specification:
|
176
|
+
components:
|
177
|
+
securitySchemes:
|
178
|
+
cookieAuth: # name for the security scheme
|
179
|
+
type: apiKey
|
180
|
+
in: cookie
|
181
|
+
name: JSESSIONID # cookie name
|
182
|
+
|
183
|
+
You can programmatically set the cookie:
|
184
|
+
|
185
|
+
conf = client.Configuration(
|
186
|
+
api_key={'cookieAuth': 'abc123'}
|
187
|
+
api_key_prefix={'cookieAuth': 'JSESSIONID'}
|
188
|
+
)
|
189
|
+
|
190
|
+
The following cookie will be added to the HTTP request:
|
191
|
+
Cookie: JSESSIONID abc123
|
166
192
|
"""
|
167
193
|
|
168
194
|
_default: ClassVar[Optional[Self]] = None
|
169
195
|
|
170
196
|
def __init__(
|
171
197
|
self,
|
172
|
-
host: Optional[str]=None,
|
173
|
-
api_key: Optional[Dict[str, str]]=None,
|
174
|
-
api_key_prefix: Optional[Dict[str, str]]=None,
|
175
|
-
username: Optional[str]=None,
|
176
|
-
password: Optional[str]=None,
|
177
|
-
access_token: Optional[str]=None,
|
178
|
-
server_index: Optional[int]=None,
|
179
|
-
server_variables: Optional[ServerVariablesT]=None,
|
180
|
-
server_operation_index: Optional[Dict[int, int]]=None,
|
181
|
-
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
182
|
-
ignore_operation_servers: bool=False,
|
183
|
-
ssl_ca_cert: Optional[str]=None,
|
198
|
+
host: Optional[str] = None,
|
199
|
+
api_key: Optional[Dict[str, str]] = None,
|
200
|
+
api_key_prefix: Optional[Dict[str, str]] = None,
|
201
|
+
username: Optional[str] = None,
|
202
|
+
password: Optional[str] = None,
|
203
|
+
access_token: Optional[str] = None,
|
204
|
+
server_index: Optional[int] = None,
|
205
|
+
server_variables: Optional[ServerVariablesT] = None,
|
206
|
+
server_operation_index: Optional[Dict[int, int]] = None,
|
207
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None,
|
208
|
+
ignore_operation_servers: bool = False,
|
209
|
+
ssl_ca_cert: Optional[str] = None,
|
184
210
|
retries: Optional[int] = None,
|
185
211
|
*,
|
186
212
|
debug: Optional[bool] = None,
|
187
213
|
) -> None:
|
188
|
-
"""Constructor
|
189
|
-
"""
|
214
|
+
"""Constructor"""
|
190
215
|
self._base_path = "http://localhost/v1/trade" if host is None else host
|
191
216
|
"""Default Base url
|
192
217
|
"""
|
@@ -232,7 +257,7 @@ class Configuration:
|
|
232
257
|
"""
|
233
258
|
self.logger["package_logger"] = logging.getLogger("client")
|
234
259
|
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
|
235
|
-
self.logger_format =
|
260
|
+
self.logger_format = "%(asctime)s %(levelname)s %(message)s"
|
236
261
|
"""Log format
|
237
262
|
"""
|
238
263
|
self.logger_stream_handler = None
|
@@ -273,12 +298,9 @@ class Configuration:
|
|
273
298
|
Set this to the SNI value expected by the server.
|
274
299
|
"""
|
275
300
|
|
276
|
-
self.connection_pool_maxsize =
|
277
|
-
"""
|
278
|
-
|
279
|
-
not the best value when you are making a lot of possibly parallel
|
280
|
-
requests to the same host, which is often the case here.
|
281
|
-
cpu_count * 5 is used as default value to increase performance.
|
301
|
+
self.connection_pool_maxsize = 100
|
302
|
+
"""This value is passed to the aiohttp to limit simultaneous connections.
|
303
|
+
Default values is 100, None means no-limit.
|
282
304
|
"""
|
283
305
|
|
284
306
|
self.proxy: Optional[str] = None
|
@@ -287,7 +309,7 @@ class Configuration:
|
|
287
309
|
self.proxy_headers = None
|
288
310
|
"""Proxy headers
|
289
311
|
"""
|
290
|
-
self.safe_chars_for_path_param =
|
312
|
+
self.safe_chars_for_path_param = ""
|
291
313
|
"""Safe chars for path_param
|
292
314
|
"""
|
293
315
|
self.retries = retries
|
@@ -308,12 +330,12 @@ class Configuration:
|
|
308
330
|
"""date format
|
309
331
|
"""
|
310
332
|
|
311
|
-
def __deepcopy__(self, memo:
|
333
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
312
334
|
cls = self.__class__
|
313
335
|
result = cls.__new__(cls)
|
314
336
|
memo[id(self)] = result
|
315
337
|
for k, v in self.__dict__.items():
|
316
|
-
if k not in (
|
338
|
+
if k not in ("logger", "logger_file_handler"):
|
317
339
|
setattr(result, k, copy.deepcopy(v, memo))
|
318
340
|
# shallow copy of loggers
|
319
341
|
result.logger = copy.copy(self.logger)
|
@@ -445,7 +467,9 @@ class Configuration:
|
|
445
467
|
self.__logger_format = value
|
446
468
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
447
469
|
|
448
|
-
def get_api_key_with_prefix(
|
470
|
+
def get_api_key_with_prefix(
|
471
|
+
self, identifier: str, alias: Optional[str] = None
|
472
|
+
) -> Optional[str]:
|
449
473
|
"""Gets API key (with prefix if set).
|
450
474
|
|
451
475
|
:param identifier: The identifier of apiKey.
|
@@ -454,7 +478,9 @@ class Configuration:
|
|
454
478
|
"""
|
455
479
|
if self.refresh_api_key_hook is not None:
|
456
480
|
self.refresh_api_key_hook(self)
|
457
|
-
key = self.api_key.get(
|
481
|
+
key = self.api_key.get(
|
482
|
+
identifier, self.api_key.get(alias) if alias is not None else None
|
483
|
+
)
|
458
484
|
if key:
|
459
485
|
prefix = self.api_key_prefix.get(identifier)
|
460
486
|
if prefix:
|
@@ -475,22 +501,31 @@ class Configuration:
|
|
475
501
|
password = ""
|
476
502
|
if self.password is not None:
|
477
503
|
password = self.password
|
478
|
-
return urllib3.util.make_headers(
|
479
|
-
|
480
|
-
)
|
504
|
+
return urllib3.util.make_headers(basic_auth=username + ":" + password).get(
|
505
|
+
"authorization"
|
506
|
+
)
|
481
507
|
|
482
|
-
def auth_settings(self)-> AuthSettings:
|
508
|
+
def auth_settings(self) -> AuthSettings:
|
483
509
|
"""Gets Auth Settings dict for api client.
|
484
510
|
|
485
511
|
:return: The Auth Settings information dict.
|
486
512
|
"""
|
487
513
|
auth: AuthSettings = {}
|
488
514
|
if self.access_token is not None:
|
489
|
-
auth[
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
515
|
+
auth["HTTPBearer"] = {
|
516
|
+
"type": "bearer",
|
517
|
+
"in": "header",
|
518
|
+
"key": "Authorization",
|
519
|
+
"value": "Bearer " + self.access_token,
|
520
|
+
}
|
521
|
+
if "APIKeyHeader" in self.api_key:
|
522
|
+
auth["APIKeyHeader"] = {
|
523
|
+
"type": "api_key",
|
524
|
+
"in": "header",
|
525
|
+
"key": "X-API-Key",
|
526
|
+
"value": self.get_api_key_with_prefix(
|
527
|
+
"APIKeyHeader",
|
528
|
+
),
|
494
529
|
}
|
495
530
|
return auth
|
496
531
|
|
@@ -499,12 +534,13 @@ class Configuration:
|
|
499
534
|
|
500
535
|
:return: The report for debugging.
|
501
536
|
"""
|
502
|
-
return
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
537
|
+
return (
|
538
|
+
"Python SDK Debug Report:\n"
|
539
|
+
"OS: {env}\n"
|
540
|
+
"Python Version: {pyversion}\n"
|
541
|
+
"Version of the API: 0.1.0\n"
|
542
|
+
"SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
|
543
|
+
)
|
508
544
|
|
509
545
|
def get_host_settings(self) -> List[HostSetting]:
|
510
546
|
"""Gets an array of host settings
|
@@ -513,16 +549,16 @@ class Configuration:
|
|
513
549
|
"""
|
514
550
|
return [
|
515
551
|
{
|
516
|
-
|
517
|
-
|
552
|
+
"url": "http://localhost/v1/trade",
|
553
|
+
"description": "No description provided",
|
518
554
|
}
|
519
555
|
]
|
520
556
|
|
521
557
|
def get_host_from_settings(
|
522
558
|
self,
|
523
559
|
index: Optional[int],
|
524
|
-
variables: Optional[ServerVariablesT]=None,
|
525
|
-
servers: Optional[List[HostSetting]]=None,
|
560
|
+
variables: Optional[ServerVariablesT] = None,
|
561
|
+
servers: Optional[List[HostSetting]] = None,
|
526
562
|
) -> str:
|
527
563
|
"""Gets host URL based on the index and variables
|
528
564
|
:param index: array index of the host settings
|
@@ -541,22 +577,22 @@ class Configuration:
|
|
541
577
|
except IndexError:
|
542
578
|
raise ValueError(
|
543
579
|
"Invalid index {0} when selecting the host settings. "
|
544
|
-
"Must be less than {1}".format(index, len(servers))
|
580
|
+
"Must be less than {1}".format(index, len(servers))
|
581
|
+
)
|
545
582
|
|
546
|
-
url = server[
|
583
|
+
url = server["url"]
|
547
584
|
|
548
585
|
# go through variables and replace placeholders
|
549
|
-
for variable_name, variable in server.get(
|
550
|
-
used_value = variables.get(
|
551
|
-
variable_name, variable['default_value'])
|
586
|
+
for variable_name, variable in server.get("variables", {}).items():
|
587
|
+
used_value = variables.get(variable_name, variable["default_value"])
|
552
588
|
|
553
|
-
if
|
554
|
-
and used_value not in variable['enum_values']:
|
589
|
+
if "enum_values" in variable and used_value not in variable["enum_values"]:
|
555
590
|
raise ValueError(
|
556
591
|
"The variable `{0}` in the host URL has invalid value "
|
557
592
|
"{1}. Must be {2}.".format(
|
558
|
-
variable_name, variables[variable_name],
|
559
|
-
|
593
|
+
variable_name, variables[variable_name], variable["enum_values"]
|
594
|
+
)
|
595
|
+
)
|
560
596
|
|
561
597
|
url = url.replace("{" + variable_name + "}", used_value)
|
562
598
|
|
@@ -565,7 +601,9 @@ class Configuration:
|
|
565
601
|
@property
|
566
602
|
def host(self) -> str:
|
567
603
|
"""Return generated host."""
|
568
|
-
return self.get_host_from_settings(
|
604
|
+
return self.get_host_from_settings(
|
605
|
+
self.server_index, variables=self.server_variables
|
606
|
+
)
|
569
607
|
|
570
608
|
@host.setter
|
571
609
|
def host(self, value: str) -> None:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -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
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# flake8: noqa
|
4
4
|
"""
|
5
|
-
|
5
|
+
Trading API
|
6
6
|
|
7
7
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
8
8
|
|
@@ -17,7 +17,10 @@
|
|
17
17
|
from crypticorn.trade.client.models.api_key_model import APIKeyModel
|
18
18
|
from crypticorn.trade.client.models.action_model import ActionModel
|
19
19
|
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
20
|
+
from crypticorn.trade.client.models.api_error_level import ApiErrorLevel
|
21
|
+
from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
20
22
|
from crypticorn.trade.client.models.bot_model import BotModel
|
23
|
+
from crypticorn.trade.client.models.bot_status import BotStatus
|
21
24
|
from crypticorn.trade.client.models.exchange import Exchange
|
22
25
|
from crypticorn.trade.client.models.execution_ids import ExecutionIds
|
23
26
|
from crypticorn.trade.client.models.futures_balance import FuturesBalance
|
@@ -26,13 +29,15 @@ from crypticorn.trade.client.models.http_validation_error import HTTPValidationE
|
|
26
29
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
27
30
|
from crypticorn.trade.client.models.market_type import MarketType
|
28
31
|
from crypticorn.trade.client.models.notification_model import NotificationModel
|
29
|
-
from crypticorn.trade.client.models.notification_type import NotificationType
|
30
32
|
from crypticorn.trade.client.models.order_model import OrderModel
|
31
33
|
from crypticorn.trade.client.models.order_status import OrderStatus
|
32
34
|
from crypticorn.trade.client.models.post_futures_action import PostFuturesAction
|
33
35
|
from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
|
34
|
-
from crypticorn.trade.client.models.
|
36
|
+
from crypticorn.trade.client.models.strategy_model_input import StrategyModelInput
|
37
|
+
from crypticorn.trade.client.models.strategy_model_output import StrategyModelOutput
|
35
38
|
from crypticorn.trade.client.models.tpsl import TPSL
|
36
39
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
37
40
|
from crypticorn.trade.client.models.validation_error import ValidationError
|
38
|
-
from crypticorn.trade.client.models.validation_error_loc_inner import
|
41
|
+
from crypticorn.trade.client.models.validation_error_loc_inner import (
|
42
|
+
ValidationErrorLocInner,
|
43
|
+
)
|