crypticorn 2.16.0__py3-none-any.whl → 2.17.0rc2__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 +1 -0
- crypticorn/common/metrics.py +18 -0
- crypticorn/common/middleware.py +46 -0
- crypticorn/common/pagination.py +137 -18
- crypticorn/common/router/admin_router.py +12 -2
- crypticorn/common/utils.py +2 -1
- crypticorn/common/warnings.py +7 -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.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/METADATA +65 -20
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/RECORD +85 -83
- crypticorn/trade/client/api/futures_trading_panel_api.py +0 -1285
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/WHEEL +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/top_level.txt +0 -0
@@ -23,6 +23,24 @@ from crypticorn.hive.client.api_client import ApiClient, RequestSerialized
|
|
23
23
|
from crypticorn.hive.client.api_response import ApiResponse
|
24
24
|
from crypticorn.hive.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,
|
@@ -68,7 +68,7 @@ class ApiErrorIdentifier(str, Enum):
|
|
68
68
|
INVALID_EXCHANGE_KEY = "invalid_exchange_key"
|
69
69
|
INVALID_MARGIN_MODE = "invalid_margin_mode"
|
70
70
|
INVALID_MODEL_NAME = "invalid_model_name"
|
71
|
-
INVALID_PARAMETER_PROVIDED = "
|
71
|
+
INVALID_PARAMETER_PROVIDED = "invalid_parameter_provided"
|
72
72
|
LEVERAGE_LIMIT_EXCEEDED = "leverage_limit_exceeded"
|
73
73
|
ORDER_VIOLATES_LIQUIDATION_PRICE_CONSTRAINTS = (
|
74
74
|
"order_violates_liquidation_price_constraints"
|
crypticorn/hive/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
|