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.
Files changed (86) hide show
  1. crypticorn/__init__.py +2 -2
  2. crypticorn/auth/client/api/admin_api.py +415 -13
  3. crypticorn/auth/client/api/auth_api.py +2622 -113
  4. crypticorn/auth/client/api/service_api.py +258 -7
  5. crypticorn/auth/client/api/user_api.py +2485 -270
  6. crypticorn/auth/client/api/wallet_api.py +1518 -77
  7. crypticorn/auth/client/models/create_api_key_request.py +2 -1
  8. crypticorn/auth/client/models/get_api_keys200_response_inner.py +2 -1
  9. crypticorn/auth/client/rest.py +23 -4
  10. crypticorn/auth/main.py +8 -5
  11. crypticorn/client.py +227 -59
  12. crypticorn/common/__init__.py +1 -0
  13. crypticorn/common/metrics.py +18 -0
  14. crypticorn/common/middleware.py +46 -0
  15. crypticorn/common/pagination.py +137 -18
  16. crypticorn/common/router/admin_router.py +12 -2
  17. crypticorn/common/utils.py +2 -1
  18. crypticorn/common/warnings.py +7 -0
  19. crypticorn/hive/client/api/admin_api.py +1234 -51
  20. crypticorn/hive/client/api/data_api.py +517 -13
  21. crypticorn/hive/client/api/models_api.py +1657 -83
  22. crypticorn/hive/client/api/status_api.py +415 -13
  23. crypticorn/hive/client/models/api_error_identifier.py +1 -1
  24. crypticorn/hive/client/rest.py +23 -4
  25. crypticorn/hive/main.py +99 -25
  26. crypticorn/klines/client/api/admin_api.py +1234 -51
  27. crypticorn/klines/client/api/change_in_timeframe_api.py +278 -7
  28. crypticorn/klines/client/api/funding_rates_api.py +324 -7
  29. crypticorn/klines/client/api/ohlcv_data_api.py +399 -7
  30. crypticorn/klines/client/api/status_api.py +415 -13
  31. crypticorn/klines/client/api/symbols_api.py +225 -7
  32. crypticorn/klines/client/api/udf_api.py +1393 -120
  33. crypticorn/klines/client/models/api_error_identifier.py +3 -1
  34. crypticorn/klines/client/rest.py +23 -4
  35. crypticorn/klines/main.py +89 -12
  36. crypticorn/metrics/client/api/admin_api.py +1234 -51
  37. crypticorn/metrics/client/api/exchanges_api.py +1405 -140
  38. crypticorn/metrics/client/api/indicators_api.py +640 -13
  39. crypticorn/metrics/client/api/logs_api.py +305 -7
  40. crypticorn/metrics/client/api/marketcap_api.py +1240 -60
  41. crypticorn/metrics/client/api/markets_api.py +352 -7
  42. crypticorn/metrics/client/api/quote_currencies_api.py +237 -7
  43. crypticorn/metrics/client/api/status_api.py +415 -13
  44. crypticorn/metrics/client/api/tokens_api.py +400 -13
  45. crypticorn/metrics/client/configuration.py +4 -2
  46. crypticorn/metrics/client/rest.py +23 -4
  47. crypticorn/metrics/main.py +113 -19
  48. crypticorn/pay/client/api/admin_api.py +1720 -126
  49. crypticorn/pay/client/api/now_payments_api.py +1013 -42
  50. crypticorn/pay/client/api/payments_api.py +580 -13
  51. crypticorn/pay/client/api/products_api.py +915 -25
  52. crypticorn/pay/client/api/status_api.py +415 -13
  53. crypticorn/pay/client/configuration.py +2 -2
  54. crypticorn/pay/client/models/api_error_identifier.py +7 -7
  55. crypticorn/pay/client/models/scope.py +1 -0
  56. crypticorn/pay/client/rest.py +23 -4
  57. crypticorn/pay/main.py +10 -6
  58. crypticorn/trade/client/__init__.py +2 -1
  59. crypticorn/trade/client/api/__init__.py +0 -1
  60. crypticorn/trade/client/api/admin_api.py +1718 -123
  61. crypticorn/trade/client/api/api_keys_api.py +1596 -103
  62. crypticorn/trade/client/api/bots_api.py +1106 -47
  63. crypticorn/trade/client/api/exchanges_api.py +592 -19
  64. crypticorn/trade/client/api/notifications_api.py +1340 -112
  65. crypticorn/trade/client/api/orders_api.py +240 -7
  66. crypticorn/trade/client/api/status_api.py +415 -13
  67. crypticorn/trade/client/api/strategies_api.py +1170 -69
  68. crypticorn/trade/client/api/trading_actions_api.py +650 -19
  69. crypticorn/trade/client/models/__init__.py +2 -0
  70. crypticorn/trade/client/models/exchange.py +6 -1
  71. crypticorn/trade/client/models/exchange_key_balance.py +111 -0
  72. crypticorn/trade/client/models/futures_balance.py +27 -25
  73. crypticorn/trade/client/models/spot_balance.py +110 -0
  74. crypticorn/trade/client/models/strategy.py +5 -3
  75. crypticorn/trade/client/models/strategy_create.py +6 -4
  76. crypticorn/trade/client/models/strategy_exchange_info.py +16 -4
  77. crypticorn/trade/client/models/strategy_update.py +2 -2
  78. crypticorn/trade/client/rest.py +23 -4
  79. crypticorn/trade/main.py +15 -12
  80. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/METADATA +65 -20
  81. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/RECORD +85 -83
  82. crypticorn/trade/client/api/futures_trading_panel_api.py +0 -1285
  83. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/WHEEL +0 -0
  84. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/entry_points.txt +0 -0
  85. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/licenses/LICENSE +0 -0
  86. {crypticorn-2.16.0.dist-info → crypticorn-2.17.0rc2.dist-info}/top_level.txt +0 -0
@@ -28,6 +28,24 @@ from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
28
28
  from crypticorn.klines.client.api_response import ApiResponse
29
29
  from crypticorn.klines.client.rest import RESTResponseType
30
30
 
31
+ # Import async_to_sync for sync methods
32
+ try:
33
+ from asgiref.sync import async_to_sync
34
+
35
+ _HAS_ASGIREF = True
36
+ except ImportError:
37
+ _HAS_ASGIREF = False
38
+
39
+ def async_to_sync(async_func):
40
+ """Fallback decorator that raises an error if asgiref is not available."""
41
+
42
+ def wrapper(*args, **kwargs):
43
+ raise ImportError(
44
+ "asgiref is required for sync methods. Install with: pip install asgiref"
45
+ )
46
+
47
+ return wrapper
48
+
31
49
 
32
50
  class OHLCVDataApi:
33
51
  """NOTE: This class is auto generated by OpenAPI Generator
@@ -36,13 +54,231 @@ class OHLCVDataApi:
36
54
  Do not edit the class manually.
37
55
  """
38
56
 
39
- def __init__(self, api_client=None) -> None:
57
+ def __init__(self, api_client=None, is_sync: bool = False) -> None:
40
58
  if api_client is None:
41
59
  api_client = ApiClient.get_default()
42
60
  self.api_client = api_client
61
+ self.is_sync = is_sync
62
+
63
+ @validate_call
64
+ def get_ohlcv(
65
+ self,
66
+ market: Annotated[MarketType, Field(description="Market type")],
67
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
68
+ symbol: Annotated[
69
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
70
+ ],
71
+ start: Annotated[
72
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
73
+ ] = None,
74
+ end: Annotated[
75
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
76
+ ] = None,
77
+ limit: Annotated[
78
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
79
+ Field(description="Number of candles to return"),
80
+ ] = None,
81
+ sort_direction: Annotated[
82
+ Optional[SortDirection],
83
+ Field(
84
+ description="Sort by timestamp in ascending or descending order. Default is descending."
85
+ ),
86
+ ] = None,
87
+ _request_timeout: Union[
88
+ None,
89
+ Annotated[StrictFloat, Field(gt=0)],
90
+ Tuple[
91
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
92
+ ],
93
+ ] = None,
94
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
95
+ _content_type: Optional[StrictStr] = None,
96
+ _headers: Optional[Dict[StrictStr, Any]] = None,
97
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
98
+ ) -> List[OHLCV]:
99
+ """Get Ohlcv
100
+
101
+ This method can work in both sync and async modes based on the is_sync flag.
102
+ """
103
+ if self.is_sync:
104
+ return self._get_ohlcv_sync(
105
+ market=market,
106
+ timeframe=timeframe,
107
+ symbol=symbol,
108
+ start=start,
109
+ end=end,
110
+ limit=limit,
111
+ sort_direction=sort_direction,
112
+ _request_timeout=_request_timeout,
113
+ _request_auth=_request_auth,
114
+ _content_type=_content_type,
115
+ _headers=_headers,
116
+ _host_index=_host_index,
117
+ )
118
+
119
+ else:
120
+ return self._get_ohlcv_async(
121
+ market=market,
122
+ timeframe=timeframe,
123
+ symbol=symbol,
124
+ start=start,
125
+ end=end,
126
+ limit=limit,
127
+ sort_direction=sort_direction,
128
+ _request_timeout=_request_timeout,
129
+ _request_auth=_request_auth,
130
+ _content_type=_content_type,
131
+ _headers=_headers,
132
+ _host_index=_host_index,
133
+ )
134
+
135
+ @validate_call
136
+ def get_ohlcv_with_http_info(
137
+ self,
138
+ market: Annotated[MarketType, Field(description="Market type")],
139
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
140
+ symbol: Annotated[
141
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
142
+ ],
143
+ start: Annotated[
144
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
145
+ ] = None,
146
+ end: Annotated[
147
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
148
+ ] = None,
149
+ limit: Annotated[
150
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
151
+ Field(description="Number of candles to return"),
152
+ ] = None,
153
+ sort_direction: Annotated[
154
+ Optional[SortDirection],
155
+ Field(
156
+ description="Sort by timestamp in ascending or descending order. Default is descending."
157
+ ),
158
+ ] = None,
159
+ _request_timeout: Union[
160
+ None,
161
+ Annotated[StrictFloat, Field(gt=0)],
162
+ Tuple[
163
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
164
+ ],
165
+ ] = None,
166
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
167
+ _content_type: Optional[StrictStr] = None,
168
+ _headers: Optional[Dict[StrictStr, Any]] = None,
169
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
170
+ ) -> ApiResponse[List[OHLCV]]:
171
+ """Get Ohlcv with HTTP info
172
+
173
+ This method can work in both sync and async modes based on the is_sync flag.
174
+ """
175
+ if self.is_sync:
176
+ return self._get_ohlcv_sync_with_http_info(
177
+ market=market,
178
+ timeframe=timeframe,
179
+ symbol=symbol,
180
+ start=start,
181
+ end=end,
182
+ limit=limit,
183
+ sort_direction=sort_direction,
184
+ _request_timeout=_request_timeout,
185
+ _request_auth=_request_auth,
186
+ _content_type=_content_type,
187
+ _headers=_headers,
188
+ _host_index=_host_index,
189
+ )
190
+
191
+ else:
192
+ return self._get_ohlcv_async_with_http_info(
193
+ market=market,
194
+ timeframe=timeframe,
195
+ symbol=symbol,
196
+ start=start,
197
+ end=end,
198
+ limit=limit,
199
+ sort_direction=sort_direction,
200
+ _request_timeout=_request_timeout,
201
+ _request_auth=_request_auth,
202
+ _content_type=_content_type,
203
+ _headers=_headers,
204
+ _host_index=_host_index,
205
+ )
206
+
207
+ @validate_call
208
+ def get_ohlcv_without_preload_content(
209
+ self,
210
+ market: Annotated[MarketType, Field(description="Market type")],
211
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
212
+ symbol: Annotated[
213
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
214
+ ],
215
+ start: Annotated[
216
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
217
+ ] = None,
218
+ end: Annotated[
219
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
220
+ ] = None,
221
+ limit: Annotated[
222
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
223
+ Field(description="Number of candles to return"),
224
+ ] = None,
225
+ sort_direction: Annotated[
226
+ Optional[SortDirection],
227
+ Field(
228
+ description="Sort by timestamp in ascending or descending order. Default is descending."
229
+ ),
230
+ ] = None,
231
+ _request_timeout: Union[
232
+ None,
233
+ Annotated[StrictFloat, Field(gt=0)],
234
+ Tuple[
235
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
236
+ ],
237
+ ] = None,
238
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
239
+ _content_type: Optional[StrictStr] = None,
240
+ _headers: Optional[Dict[StrictStr, Any]] = None,
241
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
242
+ ) -> RESTResponseType:
243
+ """Get Ohlcv without preloading content
244
+
245
+ This method can work in both sync and async modes based on the is_sync flag.
246
+ """
247
+ if self.is_sync:
248
+ return self._get_ohlcv_sync_without_preload_content(
249
+ market=market,
250
+ timeframe=timeframe,
251
+ symbol=symbol,
252
+ start=start,
253
+ end=end,
254
+ limit=limit,
255
+ sort_direction=sort_direction,
256
+ _request_timeout=_request_timeout,
257
+ _request_auth=_request_auth,
258
+ _content_type=_content_type,
259
+ _headers=_headers,
260
+ _host_index=_host_index,
261
+ )
43
262
 
263
+ else:
264
+ return self._get_ohlcv_async_without_preload_content(
265
+ market=market,
266
+ timeframe=timeframe,
267
+ symbol=symbol,
268
+ start=start,
269
+ end=end,
270
+ limit=limit,
271
+ sort_direction=sort_direction,
272
+ _request_timeout=_request_timeout,
273
+ _request_auth=_request_auth,
274
+ _content_type=_content_type,
275
+ _headers=_headers,
276
+ _host_index=_host_index,
277
+ )
278
+
279
+ # Private async implementation methods
44
280
  @validate_call
45
- async def get_ohlcv(
281
+ async def _get_ohlcv_async(
46
282
  self,
47
283
  market: Annotated[MarketType, Field(description="Market type")],
48
284
  timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
@@ -144,7 +380,7 @@ class OHLCVDataApi:
144
380
  ).data
145
381
 
146
382
  @validate_call
147
- async def get_ohlcv_with_http_info(
383
+ async def _get_ohlcv_async_with_http_info(
148
384
  self,
149
385
  market: Annotated[MarketType, Field(description="Market type")],
150
386
  timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
@@ -241,12 +477,11 @@ class OHLCVDataApi:
241
477
  )
242
478
  await response_data.read()
243
479
  return self.api_client.response_deserialize(
244
- response_data=response_data,
245
- response_types_map=_response_types_map,
480
+ response_data=response_data, response_types_map=_response_types_map
246
481
  )
247
482
 
248
483
  @validate_call
249
- async def get_ohlcv_without_preload_content(
484
+ async def _get_ohlcv_async_without_preload_content(
250
485
  self,
251
486
  market: Annotated[MarketType, Field(description="Market type")],
252
487
  timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
@@ -341,7 +576,164 @@ class OHLCVDataApi:
341
576
  response_data = await self.api_client.call_api(
342
577
  *_param, _request_timeout=_request_timeout
343
578
  )
344
- return response_data.response
579
+ return response_data
580
+
581
+ # Private sync implementation methods
582
+ @validate_call
583
+ def _get_ohlcv_sync(
584
+ self,
585
+ market: Annotated[MarketType, Field(description="Market type")],
586
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
587
+ symbol: Annotated[
588
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
589
+ ],
590
+ start: Annotated[
591
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
592
+ ] = None,
593
+ end: Annotated[
594
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
595
+ ] = None,
596
+ limit: Annotated[
597
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
598
+ Field(description="Number of candles to return"),
599
+ ] = None,
600
+ sort_direction: Annotated[
601
+ Optional[SortDirection],
602
+ Field(
603
+ description="Sort by timestamp in ascending or descending order. Default is descending."
604
+ ),
605
+ ] = None,
606
+ _request_timeout: Union[
607
+ None,
608
+ Annotated[StrictFloat, Field(gt=0)],
609
+ Tuple[
610
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
611
+ ],
612
+ ] = None,
613
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
614
+ _content_type: Optional[StrictStr] = None,
615
+ _headers: Optional[Dict[StrictStr, Any]] = None,
616
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
617
+ ) -> List[OHLCV]:
618
+ """Synchronous version of get_ohlcv"""
619
+ return async_to_sync(self._get_ohlcv_async)(
620
+ market=market,
621
+ timeframe=timeframe,
622
+ symbol=symbol,
623
+ start=start,
624
+ end=end,
625
+ limit=limit,
626
+ sort_direction=sort_direction,
627
+ _request_timeout=_request_timeout,
628
+ _request_auth=_request_auth,
629
+ _content_type=_content_type,
630
+ _headers=_headers,
631
+ _host_index=_host_index,
632
+ )
633
+
634
+ @validate_call
635
+ def _get_ohlcv_sync_with_http_info(
636
+ self,
637
+ market: Annotated[MarketType, Field(description="Market type")],
638
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
639
+ symbol: Annotated[
640
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
641
+ ],
642
+ start: Annotated[
643
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
644
+ ] = None,
645
+ end: Annotated[
646
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
647
+ ] = None,
648
+ limit: Annotated[
649
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
650
+ Field(description="Number of candles to return"),
651
+ ] = None,
652
+ sort_direction: Annotated[
653
+ Optional[SortDirection],
654
+ Field(
655
+ description="Sort by timestamp in ascending or descending order. Default is descending."
656
+ ),
657
+ ] = None,
658
+ _request_timeout: Union[
659
+ None,
660
+ Annotated[StrictFloat, Field(gt=0)],
661
+ Tuple[
662
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
663
+ ],
664
+ ] = None,
665
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
666
+ _content_type: Optional[StrictStr] = None,
667
+ _headers: Optional[Dict[StrictStr, Any]] = None,
668
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
669
+ ) -> ApiResponse[List[OHLCV]]:
670
+ """Synchronous version of get_ohlcv_with_http_info"""
671
+ return async_to_sync(self._get_ohlcv_async_with_http_info)(
672
+ market=market,
673
+ timeframe=timeframe,
674
+ symbol=symbol,
675
+ start=start,
676
+ end=end,
677
+ limit=limit,
678
+ sort_direction=sort_direction,
679
+ _request_timeout=_request_timeout,
680
+ _request_auth=_request_auth,
681
+ _content_type=_content_type,
682
+ _headers=_headers,
683
+ _host_index=_host_index,
684
+ )
685
+
686
+ @validate_call
687
+ def _get_ohlcv_sync_without_preload_content(
688
+ self,
689
+ market: Annotated[MarketType, Field(description="Market type")],
690
+ timeframe: Annotated[Timeframe, Field(description="Timeframe for the candles")],
691
+ symbol: Annotated[
692
+ StrictStr, Field(description="Trading pair symbol (e.g., BTCUSDT)")
693
+ ],
694
+ start: Annotated[
695
+ Optional[StrictInt], Field(description="Start timestamp in milliseconds")
696
+ ] = None,
697
+ end: Annotated[
698
+ Optional[StrictInt], Field(description="End timestamp in milliseconds")
699
+ ] = None,
700
+ limit: Annotated[
701
+ Optional[Annotated[int, Field(strict=True, ge=1)]],
702
+ Field(description="Number of candles to return"),
703
+ ] = None,
704
+ sort_direction: Annotated[
705
+ Optional[SortDirection],
706
+ Field(
707
+ description="Sort by timestamp in ascending or descending order. Default is descending."
708
+ ),
709
+ ] = None,
710
+ _request_timeout: Union[
711
+ None,
712
+ Annotated[StrictFloat, Field(gt=0)],
713
+ Tuple[
714
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
715
+ ],
716
+ ] = None,
717
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
718
+ _content_type: Optional[StrictStr] = None,
719
+ _headers: Optional[Dict[StrictStr, Any]] = None,
720
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
721
+ ) -> RESTResponseType:
722
+ """Synchronous version of get_ohlcv_without_preload_content"""
723
+ return async_to_sync(self._get_ohlcv_async_without_preload_content)(
724
+ market=market,
725
+ timeframe=timeframe,
726
+ symbol=symbol,
727
+ start=start,
728
+ end=end,
729
+ limit=limit,
730
+ sort_direction=sort_direction,
731
+ _request_timeout=_request_timeout,
732
+ _request_auth=_request_auth,
733
+ _content_type=_content_type,
734
+ _headers=_headers,
735
+ _host_index=_host_index,
736
+ )
345
737
 
346
738
  def _get_ohlcv_serialize(
347
739
  self,