crypticorn 2.12.1__py3-none-any.whl → 2.13.1__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/auth/client/models/create_user_request.py +4 -16
- crypticorn/auth/main.py +8 -0
- crypticorn/client.py +26 -22
- crypticorn/common/auth.py +44 -12
- crypticorn/common/errors.py +79 -76
- crypticorn/hive/client/configuration.py +2 -2
- crypticorn/hive/client/models/api_error_identifier.py +2 -2
- crypticorn/hive/main.py +9 -5
- crypticorn/klines/client/models/api_error_identifier.py +1 -1
- crypticorn/klines/main.py +7 -0
- crypticorn/metrics/client/api/exchanges_api.py +343 -0
- crypticorn/metrics/client/configuration.py +4 -2
- crypticorn/metrics/client/models/api_error_identifier.py +9 -3
- crypticorn/metrics/main.py +8 -3
- crypticorn/pay/client/api/products_api.py +228 -1
- crypticorn/pay/client/configuration.py +2 -2
- crypticorn/pay/client/models/api_error_identifier.py +7 -3
- crypticorn/pay/main.py +7 -0
- crypticorn/trade/client/__init__.py +1 -0
- crypticorn/trade/client/api/strategies_api.py +296 -26
- crypticorn/trade/client/api/trading_actions_api.py +4 -4
- crypticorn/trade/client/models/__init__.py +1 -0
- crypticorn/trade/client/models/api_error_identifier.py +6 -2
- crypticorn/trade/client/models/futures_trading_action.py +23 -37
- crypticorn/trade/client/models/futures_trading_action_create.py +28 -42
- crypticorn/trade/client/models/order.py +40 -34
- crypticorn/trade/client/models/spot_trading_action_create.py +10 -25
- crypticorn/trade/client/models/strategy_exchange_info.py +3 -3
- crypticorn/trade/client/models/tpsl.py +7 -16
- crypticorn/trade/client/models/tpsl_create.py +103 -0
- crypticorn/trade/main.py +8 -2
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/METADATA +30 -3
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/RECORD +37 -36
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/WHEEL +0 -0
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.12.1.dist-info → crypticorn-2.13.1.dist-info}/top_level.txt +0 -0
@@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
17
|
from typing_extensions import Annotated
|
18
18
|
|
19
19
|
from pydantic import Field, StrictInt, StrictStr
|
20
|
-
from typing import List, Optional
|
20
|
+
from typing import Any, List, Optional
|
21
21
|
from typing_extensions import Annotated
|
22
22
|
from crypticorn.pay.client.models.product import Product
|
23
23
|
from crypticorn.pay.client.models.product_create import ProductCreate
|
@@ -292,6 +292,233 @@ class ProductsApi:
|
|
292
292
|
_request_auth=_request_auth,
|
293
293
|
)
|
294
294
|
|
295
|
+
@validate_call
|
296
|
+
async def get_product_usage(
|
297
|
+
self,
|
298
|
+
_request_timeout: Union[
|
299
|
+
None,
|
300
|
+
Annotated[StrictFloat, Field(gt=0)],
|
301
|
+
Tuple[
|
302
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
303
|
+
],
|
304
|
+
] = None,
|
305
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
306
|
+
_content_type: Optional[StrictStr] = None,
|
307
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
308
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
309
|
+
) -> List[List[object]]:
|
310
|
+
"""Get Product Usage
|
311
|
+
|
312
|
+
Get the usage count of each product.
|
313
|
+
|
314
|
+
:param _request_timeout: timeout setting for this request. If one
|
315
|
+
number provided, it will be total request
|
316
|
+
timeout. It can also be a pair (tuple) of
|
317
|
+
(connection, read) timeouts.
|
318
|
+
:type _request_timeout: int, tuple(int, int), optional
|
319
|
+
:param _request_auth: set to override the auth_settings for an a single
|
320
|
+
request; this effectively ignores the
|
321
|
+
authentication in the spec for a single request.
|
322
|
+
:type _request_auth: dict, optional
|
323
|
+
:param _content_type: force content-type for the request.
|
324
|
+
:type _content_type: str, Optional
|
325
|
+
:param _headers: set to override the headers for a single
|
326
|
+
request; this effectively ignores the headers
|
327
|
+
in the spec for a single request.
|
328
|
+
:type _headers: dict, optional
|
329
|
+
:param _host_index: set to override the host_index for a single
|
330
|
+
request; this effectively ignores the host_index
|
331
|
+
in the spec for a single request.
|
332
|
+
:type _host_index: int, optional
|
333
|
+
:return: Returns the result object.
|
334
|
+
""" # noqa: E501
|
335
|
+
|
336
|
+
_param = self._get_product_usage_serialize(
|
337
|
+
_request_auth=_request_auth,
|
338
|
+
_content_type=_content_type,
|
339
|
+
_headers=_headers,
|
340
|
+
_host_index=_host_index,
|
341
|
+
)
|
342
|
+
|
343
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
344
|
+
"200": "List[List[object]]",
|
345
|
+
}
|
346
|
+
response_data = await self.api_client.call_api(
|
347
|
+
*_param, _request_timeout=_request_timeout
|
348
|
+
)
|
349
|
+
await response_data.read()
|
350
|
+
return self.api_client.response_deserialize(
|
351
|
+
response_data=response_data,
|
352
|
+
response_types_map=_response_types_map,
|
353
|
+
).data
|
354
|
+
|
355
|
+
@validate_call
|
356
|
+
async def get_product_usage_with_http_info(
|
357
|
+
self,
|
358
|
+
_request_timeout: Union[
|
359
|
+
None,
|
360
|
+
Annotated[StrictFloat, Field(gt=0)],
|
361
|
+
Tuple[
|
362
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
363
|
+
],
|
364
|
+
] = None,
|
365
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
366
|
+
_content_type: Optional[StrictStr] = None,
|
367
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
368
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
369
|
+
) -> ApiResponse[List[List[object]]]:
|
370
|
+
"""Get Product Usage
|
371
|
+
|
372
|
+
Get the usage count of each product.
|
373
|
+
|
374
|
+
:param _request_timeout: timeout setting for this request. If one
|
375
|
+
number provided, it will be total request
|
376
|
+
timeout. It can also be a pair (tuple) of
|
377
|
+
(connection, read) timeouts.
|
378
|
+
:type _request_timeout: int, tuple(int, int), optional
|
379
|
+
:param _request_auth: set to override the auth_settings for an a single
|
380
|
+
request; this effectively ignores the
|
381
|
+
authentication in the spec for a single request.
|
382
|
+
:type _request_auth: dict, optional
|
383
|
+
:param _content_type: force content-type for the request.
|
384
|
+
:type _content_type: str, Optional
|
385
|
+
:param _headers: set to override the headers for a single
|
386
|
+
request; this effectively ignores the headers
|
387
|
+
in the spec for a single request.
|
388
|
+
:type _headers: dict, optional
|
389
|
+
:param _host_index: set to override the host_index for a single
|
390
|
+
request; this effectively ignores the host_index
|
391
|
+
in the spec for a single request.
|
392
|
+
:type _host_index: int, optional
|
393
|
+
:return: Returns the result object.
|
394
|
+
""" # noqa: E501
|
395
|
+
|
396
|
+
_param = self._get_product_usage_serialize(
|
397
|
+
_request_auth=_request_auth,
|
398
|
+
_content_type=_content_type,
|
399
|
+
_headers=_headers,
|
400
|
+
_host_index=_host_index,
|
401
|
+
)
|
402
|
+
|
403
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
404
|
+
"200": "List[List[object]]",
|
405
|
+
}
|
406
|
+
response_data = await self.api_client.call_api(
|
407
|
+
*_param, _request_timeout=_request_timeout
|
408
|
+
)
|
409
|
+
await response_data.read()
|
410
|
+
return self.api_client.response_deserialize(
|
411
|
+
response_data=response_data,
|
412
|
+
response_types_map=_response_types_map,
|
413
|
+
)
|
414
|
+
|
415
|
+
@validate_call
|
416
|
+
async def get_product_usage_without_preload_content(
|
417
|
+
self,
|
418
|
+
_request_timeout: Union[
|
419
|
+
None,
|
420
|
+
Annotated[StrictFloat, Field(gt=0)],
|
421
|
+
Tuple[
|
422
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
423
|
+
],
|
424
|
+
] = None,
|
425
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
426
|
+
_content_type: Optional[StrictStr] = None,
|
427
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
428
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
429
|
+
) -> RESTResponseType:
|
430
|
+
"""Get Product Usage
|
431
|
+
|
432
|
+
Get the usage count of each product.
|
433
|
+
|
434
|
+
:param _request_timeout: timeout setting for this request. If one
|
435
|
+
number provided, it will be total request
|
436
|
+
timeout. It can also be a pair (tuple) of
|
437
|
+
(connection, read) timeouts.
|
438
|
+
:type _request_timeout: int, tuple(int, int), optional
|
439
|
+
:param _request_auth: set to override the auth_settings for an a single
|
440
|
+
request; this effectively ignores the
|
441
|
+
authentication in the spec for a single request.
|
442
|
+
:type _request_auth: dict, optional
|
443
|
+
:param _content_type: force content-type for the request.
|
444
|
+
:type _content_type: str, Optional
|
445
|
+
:param _headers: set to override the headers for a single
|
446
|
+
request; this effectively ignores the headers
|
447
|
+
in the spec for a single request.
|
448
|
+
:type _headers: dict, optional
|
449
|
+
:param _host_index: set to override the host_index for a single
|
450
|
+
request; this effectively ignores the host_index
|
451
|
+
in the spec for a single request.
|
452
|
+
:type _host_index: int, optional
|
453
|
+
:return: Returns the result object.
|
454
|
+
""" # noqa: E501
|
455
|
+
|
456
|
+
_param = self._get_product_usage_serialize(
|
457
|
+
_request_auth=_request_auth,
|
458
|
+
_content_type=_content_type,
|
459
|
+
_headers=_headers,
|
460
|
+
_host_index=_host_index,
|
461
|
+
)
|
462
|
+
|
463
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
464
|
+
"200": "List[List[object]]",
|
465
|
+
}
|
466
|
+
response_data = await self.api_client.call_api(
|
467
|
+
*_param, _request_timeout=_request_timeout
|
468
|
+
)
|
469
|
+
return response_data.response
|
470
|
+
|
471
|
+
def _get_product_usage_serialize(
|
472
|
+
self,
|
473
|
+
_request_auth,
|
474
|
+
_content_type,
|
475
|
+
_headers,
|
476
|
+
_host_index,
|
477
|
+
) -> RequestSerialized:
|
478
|
+
|
479
|
+
_host = None
|
480
|
+
|
481
|
+
_collection_formats: Dict[str, str] = {}
|
482
|
+
|
483
|
+
_path_params: Dict[str, str] = {}
|
484
|
+
_query_params: List[Tuple[str, str]] = []
|
485
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
486
|
+
_form_params: List[Tuple[str, str]] = []
|
487
|
+
_files: Dict[
|
488
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
489
|
+
] = {}
|
490
|
+
_body_params: Optional[bytes] = None
|
491
|
+
|
492
|
+
# process the path parameters
|
493
|
+
# process the query parameters
|
494
|
+
# process the header parameters
|
495
|
+
# process the form parameters
|
496
|
+
# process the body parameter
|
497
|
+
|
498
|
+
# set the HTTP header `Accept`
|
499
|
+
if "Accept" not in _header_params:
|
500
|
+
_header_params["Accept"] = self.api_client.select_header_accept(
|
501
|
+
["application/json"]
|
502
|
+
)
|
503
|
+
|
504
|
+
# authentication setting
|
505
|
+
_auth_settings: List[str] = ["APIKeyHeader", "HTTPBearer"]
|
506
|
+
|
507
|
+
return self.api_client.param_serialize(
|
508
|
+
method="GET",
|
509
|
+
resource_path="/products/usage",
|
510
|
+
path_params=_path_params,
|
511
|
+
query_params=_query_params,
|
512
|
+
header_params=_header_params,
|
513
|
+
body=_body_params,
|
514
|
+
post_params=_form_params,
|
515
|
+
files=_files,
|
516
|
+
auth_settings=_auth_settings,
|
517
|
+
collection_formats=_collection_formats,
|
518
|
+
_host=_host,
|
519
|
+
_request_auth=_request_auth,
|
520
|
+
)
|
521
|
+
|
295
522
|
@validate_call
|
296
523
|
async def get_products(
|
297
524
|
self,
|
@@ -215,7 +215,7 @@ class Configuration:
|
|
215
215
|
debug: Optional[bool] = None,
|
216
216
|
) -> None:
|
217
217
|
"""Constructor"""
|
218
|
-
self._base_path = "
|
218
|
+
self._base_path = "https://api.crypticorn.dev/v1/pay" if host is None else host
|
219
219
|
"""Default Base url
|
220
220
|
"""
|
221
221
|
self.server_index = 0 if server_index is None and host is None else server_index
|
@@ -557,7 +557,7 @@ class Configuration:
|
|
557
557
|
"""
|
558
558
|
return [
|
559
559
|
{
|
560
|
-
"url": "
|
560
|
+
"url": "https://api.crypticorn.dev/v1/pay",
|
561
561
|
"description": "No description provided",
|
562
562
|
}
|
563
563
|
]
|
@@ -33,6 +33,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
33
33
|
BOT_DISABLED = "bot_disabled"
|
34
34
|
BOT_STOPPING_COMPLETED = "bot_stopping_completed"
|
35
35
|
BOT_STOPPING_STARTED = "bot_stopping_started"
|
36
|
+
CANCELLED_OPEN_ORDER = "cancelled_open_order"
|
36
37
|
CLIENT_ORDER_ID_ALREADY_EXISTS = "client_order_id_already_exists"
|
37
38
|
INVALID_CONTENT_TYPE = "invalid_content_type"
|
38
39
|
DELETE_BOT_ERROR = "delete_bot_error"
|
@@ -55,6 +56,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
55
56
|
EXCHANGE_USER_ACCOUNT_IS_FROZEN = "exchange_user_account_is_frozen"
|
56
57
|
API_KEY_EXPIRED = "api_key_expired"
|
57
58
|
BEARER_TOKEN_EXPIRED = "bearer_token_expired"
|
59
|
+
OPEN_ORDER_EXPIRED = "open_order_expired"
|
58
60
|
FORBIDDEN = "forbidden"
|
59
61
|
HEDGE_MODE_NOT_ACTIVE = "hedge_mode_not_active"
|
60
62
|
HTTP_REQUEST_ERROR = "http_request_error"
|
@@ -68,13 +70,13 @@ class ApiErrorIdentifier(str, Enum):
|
|
68
70
|
INVALID_EXCHANGE_KEY = "invalid_exchange_key"
|
69
71
|
INVALID_MARGIN_MODE = "invalid_margin_mode"
|
70
72
|
INVALID_MODEL_NAME = "invalid_model_name"
|
71
|
-
INVALID_PARAMETER_PROVIDED = "
|
73
|
+
INVALID_PARAMETER_PROVIDED = "exchange_invalid_parameter"
|
72
74
|
LEVERAGE_LIMIT_EXCEEDED = "leverage_limit_exceeded"
|
73
75
|
ORDER_VIOLATES_LIQUIDATION_PRICE_CONSTRAINTS = (
|
74
76
|
"order_violates_liquidation_price_constraints"
|
75
77
|
)
|
76
78
|
MARGIN_MODE_CLASH = "margin_mode_clash"
|
77
|
-
|
79
|
+
NAME_NOT_UNIQUE = "name_not_unique"
|
78
80
|
NO_CREDENTIALS = "no_credentials"
|
79
81
|
NOW_API_DOWN = "now_api_down"
|
80
82
|
OBJECT_ALREADY_EXISTS = "object_already_exists"
|
@@ -90,6 +92,8 @@ class ApiErrorIdentifier(str, Enum):
|
|
90
92
|
ORDER_PRICE_IS_INVALID = "order_price_is_invalid"
|
91
93
|
ORDER_SIZE_TOO_LARGE = "order_size_too_large"
|
92
94
|
ORDER_SIZE_TOO_SMALL = "order_size_too_small"
|
95
|
+
ORPHAN_OPEN_ORDER = "orphan_open_order"
|
96
|
+
ORPHAN_CLOSE_ORDER = "orphan_close_order"
|
93
97
|
POSITION_LIMIT_EXCEEDED = "position_limit_exceeded"
|
94
98
|
POSITION_DOES_NOT_EXIST = "position_does_not_exist"
|
95
99
|
POSITION_OPENING_TEMPORARILY_SUSPENDED = "position_opening_temporarily_suspended"
|
@@ -105,7 +109,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
105
109
|
SUCCESS = "success"
|
106
110
|
SYMBOL_DOES_NOT_EXIST = "symbol_does_not_exist"
|
107
111
|
TRADING_ACTION_EXPIRED = "trading_action_expired"
|
108
|
-
|
112
|
+
TRADING_ACTION_SKIPPED_BOT_STOPPING = "TRADING_ACTION_SKIPPED_BOT_STOPPING"
|
109
113
|
TRADING_HAS_BEEN_LOCKED = "trading_has_been_locked"
|
110
114
|
TRADING_IS_SUSPENDED = "trading_is_suspended"
|
111
115
|
UNKNOWN_ERROR_OCCURRED = "unknown_error_occurred"
|
crypticorn/pay/main.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import TYPE_CHECKING, Optional
|
1
3
|
from crypticorn.pay import (
|
2
4
|
ApiClient,
|
3
5
|
Configuration,
|
@@ -8,6 +10,9 @@ from crypticorn.pay import (
|
|
8
10
|
AdminApi,
|
9
11
|
)
|
10
12
|
|
13
|
+
if TYPE_CHECKING:
|
14
|
+
from aiohttp import ClientSession
|
15
|
+
|
11
16
|
|
12
17
|
class PayClient:
|
13
18
|
"""
|
@@ -19,9 +24,11 @@ class PayClient:
|
|
19
24
|
def __init__(
|
20
25
|
self,
|
21
26
|
config: Configuration,
|
27
|
+
http_client: Optional[ClientSession] = None,
|
22
28
|
):
|
23
29
|
self.config = config
|
24
30
|
self.base_client = ApiClient(configuration=self.config)
|
31
|
+
self.base_client.rest_client.pool_manager = http_client
|
25
32
|
self.now = NOWPaymentsApi(self.base_client)
|
26
33
|
self.status = StatusApi(self.base_client)
|
27
34
|
self.payments = PaymentsApi(self.base_client)
|
@@ -75,4 +75,5 @@ from crypticorn.trade.client.models.strategy_create import StrategyCreate
|
|
75
75
|
from crypticorn.trade.client.models.strategy_exchange_info import StrategyExchangeInfo
|
76
76
|
from crypticorn.trade.client.models.strategy_update import StrategyUpdate
|
77
77
|
from crypticorn.trade.client.models.tpsl import TPSL
|
78
|
+
from crypticorn.trade.client.models.tpsl_create import TPSLCreate
|
78
79
|
from crypticorn.trade.client.models.trading_action_type import TradingActionType
|