crypticorn 2.17.0rc1__py3-none-any.whl → 2.17.0rc3__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 +2 -2
- crypticorn/auth/client/api/admin_api.py +415 -13
- crypticorn/auth/client/api/auth_api.py +2622 -113
- crypticorn/auth/client/api/service_api.py +258 -7
- crypticorn/auth/client/api/user_api.py +2485 -270
- crypticorn/auth/client/api/wallet_api.py +1518 -77
- crypticorn/auth/client/models/create_api_key_request.py +2 -1
- crypticorn/auth/client/models/get_api_keys200_response_inner.py +2 -1
- crypticorn/auth/client/rest.py +23 -4
- crypticorn/auth/main.py +8 -5
- crypticorn/client.py +227 -59
- crypticorn/common/__init__.py +0 -1
- crypticorn/common/auth.py +2 -1
- crypticorn/common/metrics.py +4 -6
- crypticorn/common/middleware.py +10 -5
- crypticorn/common/pagination.py +137 -18
- crypticorn/common/router/admin_router.py +1 -1
- crypticorn/common/utils.py +2 -1
- crypticorn/common/warnings.py +1 -0
- crypticorn/hive/client/api/admin_api.py +1234 -51
- crypticorn/hive/client/api/data_api.py +517 -13
- crypticorn/hive/client/api/models_api.py +1657 -83
- crypticorn/hive/client/api/status_api.py +415 -13
- crypticorn/hive/client/models/api_error_identifier.py +1 -1
- crypticorn/hive/client/rest.py +23 -4
- crypticorn/hive/main.py +99 -25
- crypticorn/klines/client/api/admin_api.py +1234 -51
- crypticorn/klines/client/api/change_in_timeframe_api.py +278 -7
- crypticorn/klines/client/api/funding_rates_api.py +324 -7
- crypticorn/klines/client/api/ohlcv_data_api.py +399 -7
- crypticorn/klines/client/api/status_api.py +415 -13
- crypticorn/klines/client/api/symbols_api.py +225 -7
- crypticorn/klines/client/api/udf_api.py +1393 -120
- crypticorn/klines/client/models/api_error_identifier.py +3 -1
- crypticorn/klines/client/rest.py +23 -4
- crypticorn/klines/main.py +89 -12
- crypticorn/metrics/client/api/admin_api.py +1234 -51
- crypticorn/metrics/client/api/exchanges_api.py +1405 -140
- crypticorn/metrics/client/api/indicators_api.py +640 -13
- crypticorn/metrics/client/api/logs_api.py +305 -7
- crypticorn/metrics/client/api/marketcap_api.py +1240 -60
- crypticorn/metrics/client/api/markets_api.py +352 -7
- crypticorn/metrics/client/api/quote_currencies_api.py +237 -7
- crypticorn/metrics/client/api/status_api.py +415 -13
- crypticorn/metrics/client/api/tokens_api.py +400 -13
- crypticorn/metrics/client/configuration.py +4 -2
- crypticorn/metrics/client/rest.py +23 -4
- crypticorn/metrics/main.py +113 -19
- crypticorn/pay/client/api/admin_api.py +1720 -126
- crypticorn/pay/client/api/now_payments_api.py +1013 -42
- crypticorn/pay/client/api/payments_api.py +580 -13
- crypticorn/pay/client/api/products_api.py +915 -25
- crypticorn/pay/client/api/status_api.py +415 -13
- crypticorn/pay/client/configuration.py +2 -2
- crypticorn/pay/client/models/api_error_identifier.py +7 -7
- crypticorn/pay/client/models/scope.py +1 -0
- crypticorn/pay/client/rest.py +23 -4
- crypticorn/pay/main.py +10 -6
- crypticorn/trade/client/__init__.py +2 -1
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/admin_api.py +1718 -123
- crypticorn/trade/client/api/api_keys_api.py +1596 -103
- crypticorn/trade/client/api/bots_api.py +1106 -47
- crypticorn/trade/client/api/exchanges_api.py +592 -19
- crypticorn/trade/client/api/notifications_api.py +1340 -112
- crypticorn/trade/client/api/orders_api.py +240 -7
- crypticorn/trade/client/api/status_api.py +415 -13
- crypticorn/trade/client/api/strategies_api.py +1170 -69
- crypticorn/trade/client/api/trading_actions_api.py +650 -19
- crypticorn/trade/client/models/__init__.py +2 -0
- crypticorn/trade/client/models/exchange.py +6 -1
- crypticorn/trade/client/models/exchange_key_balance.py +111 -0
- crypticorn/trade/client/models/futures_balance.py +27 -25
- crypticorn/trade/client/models/spot_balance.py +110 -0
- crypticorn/trade/client/models/strategy.py +5 -3
- crypticorn/trade/client/models/strategy_create.py +6 -4
- crypticorn/trade/client/models/strategy_exchange_info.py +16 -4
- crypticorn/trade/client/models/strategy_update.py +2 -2
- crypticorn/trade/client/rest.py +23 -4
- crypticorn/trade/main.py +15 -12
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/METADATA +64 -20
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/RECORD +86 -85
- crypticorn/trade/client/api/futures_trading_panel_api.py +0 -1285
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/WHEEL +0 -0
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.17.0rc1.dist-info → crypticorn-2.17.0rc3.dist-info}/top_level.txt +0 -0
@@ -23,6 +23,24 @@ from crypticorn.pay.client.api_client import ApiClient, RequestSerialized
|
|
23
23
|
from crypticorn.pay.client.api_response import ApiResponse
|
24
24
|
from crypticorn.pay.client.rest import RESTResponseType
|
25
25
|
|
26
|
+
# Import async_to_sync for sync methods
|
27
|
+
try:
|
28
|
+
from asgiref.sync import async_to_sync
|
29
|
+
|
30
|
+
_HAS_ASGIREF = True
|
31
|
+
except ImportError:
|
32
|
+
_HAS_ASGIREF = False
|
33
|
+
|
34
|
+
def async_to_sync(async_func):
|
35
|
+
"""Fallback decorator that raises an error if asgiref is not available."""
|
36
|
+
|
37
|
+
def wrapper(*args, **kwargs):
|
38
|
+
raise ImportError(
|
39
|
+
"asgiref is required for sync methods. Install with: pip install asgiref"
|
40
|
+
)
|
41
|
+
|
42
|
+
return wrapper
|
43
|
+
|
26
44
|
|
27
45
|
class StatusApi:
|
28
46
|
"""NOTE: This class is auto generated by OpenAPI Generator
|
@@ -31,13 +49,135 @@ class StatusApi:
|
|
31
49
|
Do not edit the class manually.
|
32
50
|
"""
|
33
51
|
|
34
|
-
def __init__(self, api_client=None) -> None:
|
52
|
+
def __init__(self, api_client=None, is_sync: bool = False) -> None:
|
35
53
|
if api_client is None:
|
36
54
|
api_client = ApiClient.get_default()
|
37
55
|
self.api_client = api_client
|
56
|
+
self.is_sync = is_sync
|
57
|
+
|
58
|
+
@validate_call
|
59
|
+
def get_time(
|
60
|
+
self,
|
61
|
+
type: Optional[StrictStr] = None,
|
62
|
+
_request_timeout: Union[
|
63
|
+
None,
|
64
|
+
Annotated[StrictFloat, Field(gt=0)],
|
65
|
+
Tuple[
|
66
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
67
|
+
],
|
68
|
+
] = None,
|
69
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
70
|
+
_content_type: Optional[StrictStr] = None,
|
71
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
72
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
73
|
+
) -> str:
|
74
|
+
"""Time
|
75
|
+
|
76
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
77
|
+
"""
|
78
|
+
if self.is_sync:
|
79
|
+
return self._get_time_sync(
|
80
|
+
type=type,
|
81
|
+
_request_timeout=_request_timeout,
|
82
|
+
_request_auth=_request_auth,
|
83
|
+
_content_type=_content_type,
|
84
|
+
_headers=_headers,
|
85
|
+
_host_index=_host_index,
|
86
|
+
)
|
87
|
+
|
88
|
+
else:
|
89
|
+
return self._get_time_async(
|
90
|
+
type=type,
|
91
|
+
_request_timeout=_request_timeout,
|
92
|
+
_request_auth=_request_auth,
|
93
|
+
_content_type=_content_type,
|
94
|
+
_headers=_headers,
|
95
|
+
_host_index=_host_index,
|
96
|
+
)
|
97
|
+
|
98
|
+
@validate_call
|
99
|
+
def get_time_with_http_info(
|
100
|
+
self,
|
101
|
+
type: Optional[StrictStr] = None,
|
102
|
+
_request_timeout: Union[
|
103
|
+
None,
|
104
|
+
Annotated[StrictFloat, Field(gt=0)],
|
105
|
+
Tuple[
|
106
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
107
|
+
],
|
108
|
+
] = None,
|
109
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
110
|
+
_content_type: Optional[StrictStr] = None,
|
111
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
112
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
113
|
+
) -> ApiResponse[str]:
|
114
|
+
"""Time with HTTP info
|
115
|
+
|
116
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
117
|
+
"""
|
118
|
+
if self.is_sync:
|
119
|
+
return self._get_time_sync_with_http_info(
|
120
|
+
type=type,
|
121
|
+
_request_timeout=_request_timeout,
|
122
|
+
_request_auth=_request_auth,
|
123
|
+
_content_type=_content_type,
|
124
|
+
_headers=_headers,
|
125
|
+
_host_index=_host_index,
|
126
|
+
)
|
127
|
+
|
128
|
+
else:
|
129
|
+
return self._get_time_async_with_http_info(
|
130
|
+
type=type,
|
131
|
+
_request_timeout=_request_timeout,
|
132
|
+
_request_auth=_request_auth,
|
133
|
+
_content_type=_content_type,
|
134
|
+
_headers=_headers,
|
135
|
+
_host_index=_host_index,
|
136
|
+
)
|
137
|
+
|
138
|
+
@validate_call
|
139
|
+
def get_time_without_preload_content(
|
140
|
+
self,
|
141
|
+
type: Optional[StrictStr] = None,
|
142
|
+
_request_timeout: Union[
|
143
|
+
None,
|
144
|
+
Annotated[StrictFloat, Field(gt=0)],
|
145
|
+
Tuple[
|
146
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
147
|
+
],
|
148
|
+
] = None,
|
149
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
150
|
+
_content_type: Optional[StrictStr] = None,
|
151
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
152
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
153
|
+
) -> RESTResponseType:
|
154
|
+
"""Time without preloading content
|
155
|
+
|
156
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
157
|
+
"""
|
158
|
+
if self.is_sync:
|
159
|
+
return self._get_time_sync_without_preload_content(
|
160
|
+
type=type,
|
161
|
+
_request_timeout=_request_timeout,
|
162
|
+
_request_auth=_request_auth,
|
163
|
+
_content_type=_content_type,
|
164
|
+
_headers=_headers,
|
165
|
+
_host_index=_host_index,
|
166
|
+
)
|
38
167
|
|
168
|
+
else:
|
169
|
+
return self._get_time_async_without_preload_content(
|
170
|
+
type=type,
|
171
|
+
_request_timeout=_request_timeout,
|
172
|
+
_request_auth=_request_auth,
|
173
|
+
_content_type=_content_type,
|
174
|
+
_headers=_headers,
|
175
|
+
_host_index=_host_index,
|
176
|
+
)
|
177
|
+
|
178
|
+
# Private async implementation methods
|
39
179
|
@validate_call
|
40
|
-
async def
|
180
|
+
async def _get_time_async(
|
41
181
|
self,
|
42
182
|
type: Optional[StrictStr] = None,
|
43
183
|
_request_timeout: Union[
|
@@ -101,7 +241,7 @@ class StatusApi:
|
|
101
241
|
).data
|
102
242
|
|
103
243
|
@validate_call
|
104
|
-
async def
|
244
|
+
async def _get_time_async_with_http_info(
|
105
245
|
self,
|
106
246
|
type: Optional[StrictStr] = None,
|
107
247
|
_request_timeout: Union[
|
@@ -160,12 +300,11 @@ class StatusApi:
|
|
160
300
|
)
|
161
301
|
await response_data.read()
|
162
302
|
return self.api_client.response_deserialize(
|
163
|
-
response_data=response_data,
|
164
|
-
response_types_map=_response_types_map,
|
303
|
+
response_data=response_data, response_types_map=_response_types_map
|
165
304
|
)
|
166
305
|
|
167
306
|
@validate_call
|
168
|
-
async def
|
307
|
+
async def _get_time_async_without_preload_content(
|
169
308
|
self,
|
170
309
|
type: Optional[StrictStr] = None,
|
171
310
|
_request_timeout: Union[
|
@@ -222,7 +361,86 @@ class StatusApi:
|
|
222
361
|
response_data = await self.api_client.call_api(
|
223
362
|
*_param, _request_timeout=_request_timeout
|
224
363
|
)
|
225
|
-
return response_data
|
364
|
+
return response_data
|
365
|
+
|
366
|
+
# Private sync implementation methods
|
367
|
+
@validate_call
|
368
|
+
def _get_time_sync(
|
369
|
+
self,
|
370
|
+
type: Optional[StrictStr] = None,
|
371
|
+
_request_timeout: Union[
|
372
|
+
None,
|
373
|
+
Annotated[StrictFloat, Field(gt=0)],
|
374
|
+
Tuple[
|
375
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
376
|
+
],
|
377
|
+
] = None,
|
378
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
379
|
+
_content_type: Optional[StrictStr] = None,
|
380
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
381
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
382
|
+
) -> str:
|
383
|
+
"""Synchronous version of get_time"""
|
384
|
+
return async_to_sync(self._get_time_async)(
|
385
|
+
type=type,
|
386
|
+
_request_timeout=_request_timeout,
|
387
|
+
_request_auth=_request_auth,
|
388
|
+
_content_type=_content_type,
|
389
|
+
_headers=_headers,
|
390
|
+
_host_index=_host_index,
|
391
|
+
)
|
392
|
+
|
393
|
+
@validate_call
|
394
|
+
def _get_time_sync_with_http_info(
|
395
|
+
self,
|
396
|
+
type: Optional[StrictStr] = None,
|
397
|
+
_request_timeout: Union[
|
398
|
+
None,
|
399
|
+
Annotated[StrictFloat, Field(gt=0)],
|
400
|
+
Tuple[
|
401
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
402
|
+
],
|
403
|
+
] = None,
|
404
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
405
|
+
_content_type: Optional[StrictStr] = None,
|
406
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
407
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
408
|
+
) -> ApiResponse[str]:
|
409
|
+
"""Synchronous version of get_time_with_http_info"""
|
410
|
+
return async_to_sync(self._get_time_async_with_http_info)(
|
411
|
+
type=type,
|
412
|
+
_request_timeout=_request_timeout,
|
413
|
+
_request_auth=_request_auth,
|
414
|
+
_content_type=_content_type,
|
415
|
+
_headers=_headers,
|
416
|
+
_host_index=_host_index,
|
417
|
+
)
|
418
|
+
|
419
|
+
@validate_call
|
420
|
+
def _get_time_sync_without_preload_content(
|
421
|
+
self,
|
422
|
+
type: Optional[StrictStr] = None,
|
423
|
+
_request_timeout: Union[
|
424
|
+
None,
|
425
|
+
Annotated[StrictFloat, Field(gt=0)],
|
426
|
+
Tuple[
|
427
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
428
|
+
],
|
429
|
+
] = None,
|
430
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
431
|
+
_content_type: Optional[StrictStr] = None,
|
432
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
433
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
434
|
+
) -> RESTResponseType:
|
435
|
+
"""Synchronous version of get_time_without_preload_content"""
|
436
|
+
return async_to_sync(self._get_time_async_without_preload_content)(
|
437
|
+
type=type,
|
438
|
+
_request_timeout=_request_timeout,
|
439
|
+
_request_auth=_request_auth,
|
440
|
+
_content_type=_content_type,
|
441
|
+
_headers=_headers,
|
442
|
+
_host_index=_host_index,
|
443
|
+
)
|
226
444
|
|
227
445
|
def _get_time_serialize(
|
228
446
|
self,
|
@@ -281,7 +499,119 @@ class StatusApi:
|
|
281
499
|
)
|
282
500
|
|
283
501
|
@validate_call
|
284
|
-
|
502
|
+
def ping(
|
503
|
+
self,
|
504
|
+
_request_timeout: Union[
|
505
|
+
None,
|
506
|
+
Annotated[StrictFloat, Field(gt=0)],
|
507
|
+
Tuple[
|
508
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
509
|
+
],
|
510
|
+
] = None,
|
511
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
512
|
+
_content_type: Optional[StrictStr] = None,
|
513
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
514
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
515
|
+
) -> str:
|
516
|
+
"""Ping
|
517
|
+
|
518
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
519
|
+
"""
|
520
|
+
if self.is_sync:
|
521
|
+
return self._ping_sync(
|
522
|
+
_request_timeout=_request_timeout,
|
523
|
+
_request_auth=_request_auth,
|
524
|
+
_content_type=_content_type,
|
525
|
+
_headers=_headers,
|
526
|
+
_host_index=_host_index,
|
527
|
+
)
|
528
|
+
|
529
|
+
else:
|
530
|
+
return self._ping_async(
|
531
|
+
_request_timeout=_request_timeout,
|
532
|
+
_request_auth=_request_auth,
|
533
|
+
_content_type=_content_type,
|
534
|
+
_headers=_headers,
|
535
|
+
_host_index=_host_index,
|
536
|
+
)
|
537
|
+
|
538
|
+
@validate_call
|
539
|
+
def ping_with_http_info(
|
540
|
+
self,
|
541
|
+
_request_timeout: Union[
|
542
|
+
None,
|
543
|
+
Annotated[StrictFloat, Field(gt=0)],
|
544
|
+
Tuple[
|
545
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
546
|
+
],
|
547
|
+
] = None,
|
548
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
549
|
+
_content_type: Optional[StrictStr] = None,
|
550
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
551
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
552
|
+
) -> ApiResponse[str]:
|
553
|
+
"""Ping with HTTP info
|
554
|
+
|
555
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
556
|
+
"""
|
557
|
+
if self.is_sync:
|
558
|
+
return self._ping_sync_with_http_info(
|
559
|
+
_request_timeout=_request_timeout,
|
560
|
+
_request_auth=_request_auth,
|
561
|
+
_content_type=_content_type,
|
562
|
+
_headers=_headers,
|
563
|
+
_host_index=_host_index,
|
564
|
+
)
|
565
|
+
|
566
|
+
else:
|
567
|
+
return self._ping_async_with_http_info(
|
568
|
+
_request_timeout=_request_timeout,
|
569
|
+
_request_auth=_request_auth,
|
570
|
+
_content_type=_content_type,
|
571
|
+
_headers=_headers,
|
572
|
+
_host_index=_host_index,
|
573
|
+
)
|
574
|
+
|
575
|
+
@validate_call
|
576
|
+
def ping_without_preload_content(
|
577
|
+
self,
|
578
|
+
_request_timeout: Union[
|
579
|
+
None,
|
580
|
+
Annotated[StrictFloat, Field(gt=0)],
|
581
|
+
Tuple[
|
582
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
583
|
+
],
|
584
|
+
] = None,
|
585
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
586
|
+
_content_type: Optional[StrictStr] = None,
|
587
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
588
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
589
|
+
) -> RESTResponseType:
|
590
|
+
"""Ping without preloading content
|
591
|
+
|
592
|
+
This method can work in both sync and async modes based on the is_sync flag.
|
593
|
+
"""
|
594
|
+
if self.is_sync:
|
595
|
+
return self._ping_sync_without_preload_content(
|
596
|
+
_request_timeout=_request_timeout,
|
597
|
+
_request_auth=_request_auth,
|
598
|
+
_content_type=_content_type,
|
599
|
+
_headers=_headers,
|
600
|
+
_host_index=_host_index,
|
601
|
+
)
|
602
|
+
|
603
|
+
else:
|
604
|
+
return self._ping_async_without_preload_content(
|
605
|
+
_request_timeout=_request_timeout,
|
606
|
+
_request_auth=_request_auth,
|
607
|
+
_content_type=_content_type,
|
608
|
+
_headers=_headers,
|
609
|
+
_host_index=_host_index,
|
610
|
+
)
|
611
|
+
|
612
|
+
# Private async implementation methods
|
613
|
+
@validate_call
|
614
|
+
async def _ping_async(
|
285
615
|
self,
|
286
616
|
_request_timeout: Union[
|
287
617
|
None,
|
@@ -341,7 +671,7 @@ class StatusApi:
|
|
341
671
|
).data
|
342
672
|
|
343
673
|
@validate_call
|
344
|
-
async def
|
674
|
+
async def _ping_async_with_http_info(
|
345
675
|
self,
|
346
676
|
_request_timeout: Union[
|
347
677
|
None,
|
@@ -396,12 +726,11 @@ class StatusApi:
|
|
396
726
|
)
|
397
727
|
await response_data.read()
|
398
728
|
return self.api_client.response_deserialize(
|
399
|
-
response_data=response_data,
|
400
|
-
response_types_map=_response_types_map,
|
729
|
+
response_data=response_data, response_types_map=_response_types_map
|
401
730
|
)
|
402
731
|
|
403
732
|
@validate_call
|
404
|
-
async def
|
733
|
+
async def _ping_async_without_preload_content(
|
405
734
|
self,
|
406
735
|
_request_timeout: Union[
|
407
736
|
None,
|
@@ -454,7 +783,80 @@ class StatusApi:
|
|
454
783
|
response_data = await self.api_client.call_api(
|
455
784
|
*_param, _request_timeout=_request_timeout
|
456
785
|
)
|
457
|
-
return response_data
|
786
|
+
return response_data
|
787
|
+
|
788
|
+
# Private sync implementation methods
|
789
|
+
@validate_call
|
790
|
+
def _ping_sync(
|
791
|
+
self,
|
792
|
+
_request_timeout: Union[
|
793
|
+
None,
|
794
|
+
Annotated[StrictFloat, Field(gt=0)],
|
795
|
+
Tuple[
|
796
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
797
|
+
],
|
798
|
+
] = None,
|
799
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
800
|
+
_content_type: Optional[StrictStr] = None,
|
801
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
802
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
803
|
+
) -> str:
|
804
|
+
"""Synchronous version of ping"""
|
805
|
+
return async_to_sync(self._ping_async)(
|
806
|
+
_request_timeout=_request_timeout,
|
807
|
+
_request_auth=_request_auth,
|
808
|
+
_content_type=_content_type,
|
809
|
+
_headers=_headers,
|
810
|
+
_host_index=_host_index,
|
811
|
+
)
|
812
|
+
|
813
|
+
@validate_call
|
814
|
+
def _ping_sync_with_http_info(
|
815
|
+
self,
|
816
|
+
_request_timeout: Union[
|
817
|
+
None,
|
818
|
+
Annotated[StrictFloat, Field(gt=0)],
|
819
|
+
Tuple[
|
820
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
821
|
+
],
|
822
|
+
] = None,
|
823
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
824
|
+
_content_type: Optional[StrictStr] = None,
|
825
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
826
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
827
|
+
) -> ApiResponse[str]:
|
828
|
+
"""Synchronous version of ping_with_http_info"""
|
829
|
+
return async_to_sync(self._ping_async_with_http_info)(
|
830
|
+
_request_timeout=_request_timeout,
|
831
|
+
_request_auth=_request_auth,
|
832
|
+
_content_type=_content_type,
|
833
|
+
_headers=_headers,
|
834
|
+
_host_index=_host_index,
|
835
|
+
)
|
836
|
+
|
837
|
+
@validate_call
|
838
|
+
def _ping_sync_without_preload_content(
|
839
|
+
self,
|
840
|
+
_request_timeout: Union[
|
841
|
+
None,
|
842
|
+
Annotated[StrictFloat, Field(gt=0)],
|
843
|
+
Tuple[
|
844
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
845
|
+
],
|
846
|
+
] = None,
|
847
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
848
|
+
_content_type: Optional[StrictStr] = None,
|
849
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
850
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
851
|
+
) -> RESTResponseType:
|
852
|
+
"""Synchronous version of ping_without_preload_content"""
|
853
|
+
return async_to_sync(self._ping_async_without_preload_content)(
|
854
|
+
_request_timeout=_request_timeout,
|
855
|
+
_request_auth=_request_auth,
|
856
|
+
_content_type=_content_type,
|
857
|
+
_headers=_headers,
|
858
|
+
_host_index=_host_index,
|
859
|
+
)
|
458
860
|
|
459
861
|
def _ping_serialize(
|
460
862
|
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 = "http://localhost/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": "http://localhost/v1/pay",
|
561
561
|
"description": "No description provided",
|
562
562
|
}
|
563
563
|
]
|
@@ -28,15 +28,17 @@ class ApiErrorIdentifier(str, Enum):
|
|
28
28
|
"""
|
29
29
|
ALLOCATION_BELOW_CURRENT_EXPOSURE = "allocation_below_current_exposure"
|
30
30
|
ALLOCATION_BELOW_MIN_AMOUNT = "allocation_below_min_amount"
|
31
|
+
ALLOCATION_LIMIT_EXCEEDED = "allocation_limit_exceeded"
|
31
32
|
BLACK_SWAN = "black_swan"
|
32
33
|
BOT_ALREADY_DELETED = "bot_already_deleted"
|
33
|
-
BOT_DISABLED = "bot_disabled"
|
34
34
|
BOT_STOPPING_COMPLETED = "bot_stopping_completed"
|
35
35
|
BOT_STOPPING_STARTED = "bot_stopping_started"
|
36
36
|
CANCELLED_OPEN_ORDER = "cancelled_open_order"
|
37
37
|
CLIENT_ORDER_ID_ALREADY_EXISTS = "client_order_id_already_exists"
|
38
38
|
INVALID_CONTENT_TYPE = "invalid_content_type"
|
39
39
|
DELETE_BOT_ERROR = "delete_bot_error"
|
40
|
+
EXCHANGE_HTTP_REQUEST_ERROR = "exchange_http_request_error"
|
41
|
+
EXCHANGE_INVALID_PARAMETER = "exchange_invalid_parameter"
|
40
42
|
EXCHANGE_INVALID_SIGNATURE = "exchange_invalid_signature"
|
41
43
|
EXCHANGE_INVALID_TIMESTAMP = "exchange_invalid_timestamp"
|
42
44
|
EXCHANGE_IP_ADDRESS_IS_NOT_AUTHORIZED = "exchange_ip_address_is_not_authorized"
|
@@ -56,10 +58,9 @@ class ApiErrorIdentifier(str, Enum):
|
|
56
58
|
EXCHANGE_USER_ACCOUNT_IS_FROZEN = "exchange_user_account_is_frozen"
|
57
59
|
API_KEY_EXPIRED = "api_key_expired"
|
58
60
|
BEARER_TOKEN_EXPIRED = "bearer_token_expired"
|
59
|
-
|
61
|
+
FAILED_OPEN_ORDER = "failed_open_order"
|
60
62
|
FORBIDDEN = "forbidden"
|
61
63
|
HEDGE_MODE_NOT_ACTIVE = "hedge_mode_not_active"
|
62
|
-
HTTP_REQUEST_ERROR = "http_request_error"
|
63
64
|
INSUFFICIENT_BALANCE = "insufficient_balance"
|
64
65
|
INSUFFICIENT_MARGIN = "insufficient_margin"
|
65
66
|
INSUFFICIENT_SCOPES = "insufficient_scopes"
|
@@ -68,15 +69,15 @@ class ApiErrorIdentifier(str, Enum):
|
|
68
69
|
INVALID_DATA = "invalid_data"
|
69
70
|
INVALID_DATA_RESPONSE = "invalid_data_response"
|
70
71
|
INVALID_EXCHANGE_KEY = "invalid_exchange_key"
|
71
|
-
INVALID_MARGIN_MODE = "invalid_margin_mode"
|
72
72
|
INVALID_MODEL_NAME = "invalid_model_name"
|
73
|
-
INVALID_PARAMETER_PROVIDED = "exchange_invalid_parameter"
|
74
73
|
LEVERAGE_LIMIT_EXCEEDED = "leverage_limit_exceeded"
|
75
74
|
ORDER_VIOLATES_LIQUIDATION_PRICE_CONSTRAINTS = (
|
76
75
|
"order_violates_liquidation_price_constraints"
|
77
76
|
)
|
78
77
|
MARGIN_MODE_CLASH = "margin_mode_clash"
|
79
78
|
NAME_NOT_UNIQUE = "name_not_unique"
|
79
|
+
NO_API_KEY = "no_api_key"
|
80
|
+
NO_BEARER = "no_bearer"
|
80
81
|
NO_CREDENTIALS = "no_credentials"
|
81
82
|
NOW_API_DOWN = "now_api_down"
|
82
83
|
OBJECT_ALREADY_EXISTS = "object_already_exists"
|
@@ -102,14 +103,13 @@ class ApiErrorIdentifier(str, Enum):
|
|
102
103
|
RISK_LIMIT_EXCEEDED = "risk_limit_exceeded"
|
103
104
|
RPC_TIMEOUT = "rpc_timeout"
|
104
105
|
SYSTEM_SETTLEMENT_IN_PROCESS = "system_settlement_in_process"
|
105
|
-
STRATEGY_ALREADY_EXISTS = "strategy_already_exists"
|
106
106
|
STRATEGY_DISABLED = "strategy_disabled"
|
107
107
|
STRATEGY_LEVERAGE_MISMATCH = "strategy_leverage_mismatch"
|
108
108
|
STRATEGY_NOT_SUPPORTING_EXCHANGE = "strategy_not_supporting_exchange"
|
109
109
|
SUCCESS = "success"
|
110
110
|
SYMBOL_DOES_NOT_EXIST = "symbol_does_not_exist"
|
111
111
|
TRADING_ACTION_EXPIRED = "trading_action_expired"
|
112
|
-
TRADING_ACTION_SKIPPED_BOT_STOPPING = "
|
112
|
+
TRADING_ACTION_SKIPPED_BOT_STOPPING = "trading_action_skipped_bot_stopping"
|
113
113
|
TRADING_HAS_BEEN_LOCKED = "trading_has_been_locked"
|
114
114
|
TRADING_IS_SUSPENDED = "trading_is_suspended"
|
115
115
|
UNKNOWN_ERROR_OCCURRED = "unknown_error_occurred"
|
@@ -29,6 +29,7 @@ class Scope(str, Enum):
|
|
29
29
|
WRITE_COLON_ADMIN = "write:admin"
|
30
30
|
READ_COLON_ADMIN = "read:admin"
|
31
31
|
READ_COLON_PREDICTIONS = "read:predictions"
|
32
|
+
READ_COLON_DEXSIGNALS = "read:dexsignals"
|
32
33
|
READ_COLON_HIVE_COLON_MODEL = "read:hive:model"
|
33
34
|
READ_COLON_HIVE_COLON_DATA = "read:hive:data"
|
34
35
|
WRITE_COLON_HIVE_COLON_MODEL = "write:hive:model"
|
crypticorn/pay/client/rest.py
CHANGED
@@ -77,6 +77,7 @@ class RESTClientObject:
|
|
77
77
|
|
78
78
|
self.pool_manager: Optional[aiohttp.ClientSession] = None
|
79
79
|
self.retry_client: Optional[aiohttp_retry.RetryClient] = None
|
80
|
+
self.is_sync: bool = False # Track whether this is sync or async mode
|
80
81
|
|
81
82
|
async def close(self) -> None:
|
82
83
|
if self.pool_manager:
|
@@ -170,7 +171,9 @@ class RESTClientObject:
|
|
170
171
|
|
171
172
|
pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
|
172
173
|
|
173
|
-
#
|
174
|
+
# For sync operations, always use a fresh session
|
175
|
+
should_close_session = False
|
176
|
+
|
174
177
|
if self.pool_manager is None:
|
175
178
|
self.pool_manager = aiohttp.ClientSession(
|
176
179
|
connector=aiohttp.TCPConnector(
|
@@ -178,6 +181,9 @@ class RESTClientObject:
|
|
178
181
|
),
|
179
182
|
trust_env=True,
|
180
183
|
)
|
184
|
+
# Only close session automatically in sync mode
|
185
|
+
should_close_session = self.is_sync
|
186
|
+
|
181
187
|
pool_manager = self.pool_manager
|
182
188
|
|
183
189
|
if self.retries is not None and method in ALLOW_RETRY_METHODS:
|
@@ -193,6 +199,19 @@ class RESTClientObject:
|
|
193
199
|
)
|
194
200
|
pool_manager = self.retry_client
|
195
201
|
|
196
|
-
|
197
|
-
|
198
|
-
|
202
|
+
try:
|
203
|
+
r = await pool_manager.request(**args)
|
204
|
+
# For sessions we're about to close, read the data immediately
|
205
|
+
if should_close_session:
|
206
|
+
response = RESTResponse(r)
|
207
|
+
await response.read() # Read data before closing session
|
208
|
+
return response
|
209
|
+
else:
|
210
|
+
return RESTResponse(r)
|
211
|
+
finally:
|
212
|
+
if should_close_session:
|
213
|
+
if self.retry_client is not None:
|
214
|
+
await self.retry_client.close()
|
215
|
+
self.retry_client = None
|
216
|
+
await self.pool_manager.close()
|
217
|
+
self.pool_manager = None
|
crypticorn/pay/main.py
CHANGED
@@ -25,12 +25,16 @@ class PayClient:
|
|
25
25
|
self,
|
26
26
|
config: Configuration,
|
27
27
|
http_client: Optional[ClientSession] = None,
|
28
|
+
is_sync: bool = False,
|
28
29
|
):
|
29
30
|
self.config = config
|
30
31
|
self.base_client = ApiClient(configuration=self.config)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
self.
|
35
|
-
self.
|
36
|
-
self.
|
32
|
+
if http_client is not None:
|
33
|
+
self.base_client.rest_client.pool_manager = http_client
|
34
|
+
# Pass sync context to REST client for proper session management
|
35
|
+
self.base_client.rest_client.is_sync = is_sync
|
36
|
+
self.now = NOWPaymentsApi(self.base_client, is_sync=is_sync)
|
37
|
+
self.status = StatusApi(self.base_client, is_sync=is_sync)
|
38
|
+
self.payments = PaymentsApi(self.base_client, is_sync=is_sync)
|
39
|
+
self.products = ProductsApi(self.base_client, is_sync=is_sync)
|
40
|
+
self.admin = AdminApi(self.base_client, is_sync=is_sync)
|
@@ -21,7 +21,6 @@ from crypticorn.trade.client.api.api_keys_api import APIKeysApi
|
|
21
21
|
from crypticorn.trade.client.api.admin_api import AdminApi
|
22
22
|
from crypticorn.trade.client.api.bots_api import BotsApi
|
23
23
|
from crypticorn.trade.client.api.exchanges_api import ExchangesApi
|
24
|
-
from crypticorn.trade.client.api.futures_trading_panel_api import FuturesTradingPanelApi
|
25
24
|
from crypticorn.trade.client.api.notifications_api import NotificationsApi
|
26
25
|
from crypticorn.trade.client.api.orders_api import OrdersApi
|
27
26
|
from crypticorn.trade.client.api.status_api import StatusApi
|
@@ -50,6 +49,7 @@ from crypticorn.trade.client.models.bot_update import BotUpdate
|
|
50
49
|
from crypticorn.trade.client.models.exception_detail import ExceptionDetail
|
51
50
|
from crypticorn.trade.client.models.exchange import Exchange
|
52
51
|
from crypticorn.trade.client.models.exchange_key import ExchangeKey
|
52
|
+
from crypticorn.trade.client.models.exchange_key_balance import ExchangeKeyBalance
|
53
53
|
from crypticorn.trade.client.models.exchange_key_create import ExchangeKeyCreate
|
54
54
|
from crypticorn.trade.client.models.exchange_key_update import ExchangeKeyUpdate
|
55
55
|
from crypticorn.trade.client.models.execution_ids import ExecutionIds
|
@@ -67,6 +67,7 @@ from crypticorn.trade.client.models.notification_update import NotificationUpdat
|
|
67
67
|
from crypticorn.trade.client.models.order import Order
|
68
68
|
from crypticorn.trade.client.models.order_status import OrderStatus
|
69
69
|
from crypticorn.trade.client.models.post_futures_action import PostFuturesAction
|
70
|
+
from crypticorn.trade.client.models.spot_balance import SpotBalance
|
70
71
|
from crypticorn.trade.client.models.spot_trading_action_create import (
|
71
72
|
SpotTradingActionCreate,
|
72
73
|
)
|