crypticorn 2.15.0__py3-none-any.whl → 2.17.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. crypticorn/__init__.py +2 -2
  2. crypticorn/auth/client/api/admin_api.py +397 -13
  3. crypticorn/auth/client/api/auth_api.py +3610 -341
  4. crypticorn/auth/client/api/service_api.py +249 -7
  5. crypticorn/auth/client/api/user_api.py +2295 -179
  6. crypticorn/auth/client/api/wallet_api.py +1468 -81
  7. crypticorn/auth/client/configuration.py +2 -2
  8. crypticorn/auth/client/models/create_api_key_request.py +2 -1
  9. crypticorn/auth/client/models/get_api_keys200_response_inner.py +2 -1
  10. crypticorn/auth/client/rest.py +23 -4
  11. crypticorn/auth/main.py +8 -5
  12. crypticorn/cli/init.py +1 -1
  13. crypticorn/cli/templates/.env.docker.temp +3 -0
  14. crypticorn/cli/templates/.env.example.temp +4 -0
  15. crypticorn/cli/templates/Dockerfile +5 -2
  16. crypticorn/client.py +226 -59
  17. crypticorn/common/__init__.py +1 -0
  18. crypticorn/common/auth.py +45 -14
  19. crypticorn/common/decorators.py +1 -2
  20. crypticorn/common/enums.py +0 -2
  21. crypticorn/common/errors.py +10 -0
  22. crypticorn/common/metrics.py +30 -0
  23. crypticorn/common/middleware.py +94 -1
  24. crypticorn/common/pagination.py +252 -18
  25. crypticorn/common/router/admin_router.py +2 -2
  26. crypticorn/common/router/status_router.py +40 -2
  27. crypticorn/common/scopes.py +2 -0
  28. crypticorn/common/warnings.py +8 -0
  29. crypticorn/dex/__init__.py +6 -0
  30. crypticorn/dex/client/__init__.py +49 -0
  31. crypticorn/dex/client/api/__init__.py +6 -0
  32. crypticorn/dex/client/api/admin_api.py +2986 -0
  33. crypticorn/dex/client/api/signals_api.py +1798 -0
  34. crypticorn/dex/client/api/status_api.py +892 -0
  35. crypticorn/dex/client/api_client.py +758 -0
  36. crypticorn/dex/client/api_response.py +20 -0
  37. crypticorn/dex/client/configuration.py +620 -0
  38. crypticorn/dex/client/exceptions.py +220 -0
  39. crypticorn/dex/client/models/__init__.py +30 -0
  40. crypticorn/dex/client/models/api_error_identifier.py +121 -0
  41. crypticorn/dex/client/models/api_error_level.py +37 -0
  42. crypticorn/dex/client/models/api_error_type.py +37 -0
  43. crypticorn/dex/client/models/exception_detail.py +117 -0
  44. crypticorn/dex/client/models/log_level.py +38 -0
  45. crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
  46. crypticorn/dex/client/models/risk.py +86 -0
  47. crypticorn/dex/client/models/signal_overview_stats.py +158 -0
  48. crypticorn/dex/client/models/signal_volume.py +84 -0
  49. crypticorn/dex/client/models/signal_with_token.py +163 -0
  50. crypticorn/dex/client/models/token_data.py +127 -0
  51. crypticorn/dex/client/models/token_detail.py +116 -0
  52. crypticorn/dex/client/py.typed +0 -0
  53. crypticorn/dex/client/rest.py +217 -0
  54. crypticorn/dex/main.py +1 -0
  55. crypticorn/hive/client/api/admin_api.py +1173 -47
  56. crypticorn/hive/client/api/data_api.py +499 -17
  57. crypticorn/hive/client/api/models_api.py +1595 -87
  58. crypticorn/hive/client/api/status_api.py +397 -16
  59. crypticorn/hive/client/api_client.py +0 -5
  60. crypticorn/hive/client/models/api_error_identifier.py +1 -1
  61. crypticorn/hive/client/models/coin_info.py +1 -1
  62. crypticorn/hive/client/models/exception_detail.py +1 -1
  63. crypticorn/hive/client/models/target_info.py +1 -1
  64. crypticorn/hive/client/rest.py +23 -4
  65. crypticorn/hive/main.py +99 -25
  66. crypticorn/hive/utils.py +2 -2
  67. crypticorn/klines/client/api/admin_api.py +1173 -47
  68. crypticorn/klines/client/api/change_in_timeframe_api.py +269 -11
  69. crypticorn/klines/client/api/funding_rates_api.py +315 -11
  70. crypticorn/klines/client/api/ohlcv_data_api.py +390 -11
  71. crypticorn/klines/client/api/status_api.py +397 -16
  72. crypticorn/klines/client/api/symbols_api.py +216 -11
  73. crypticorn/klines/client/api/udf_api.py +1268 -51
  74. crypticorn/klines/client/api_client.py +0 -5
  75. crypticorn/klines/client/models/api_error_identifier.py +3 -1
  76. crypticorn/klines/client/models/exception_detail.py +1 -1
  77. crypticorn/klines/client/models/ohlcv.py +1 -1
  78. crypticorn/klines/client/models/symbol_group.py +1 -1
  79. crypticorn/klines/client/models/udf_config.py +1 -1
  80. crypticorn/klines/client/rest.py +23 -4
  81. crypticorn/klines/main.py +89 -12
  82. crypticorn/metrics/client/api/admin_api.py +1173 -47
  83. crypticorn/metrics/client/api/exchanges_api.py +1370 -145
  84. crypticorn/metrics/client/api/indicators_api.py +622 -17
  85. crypticorn/metrics/client/api/logs_api.py +296 -11
  86. crypticorn/metrics/client/api/marketcap_api.py +1207 -67
  87. crypticorn/metrics/client/api/markets_api.py +343 -11
  88. crypticorn/metrics/client/api/quote_currencies_api.py +228 -11
  89. crypticorn/metrics/client/api/status_api.py +397 -16
  90. crypticorn/metrics/client/api/tokens_api.py +382 -15
  91. crypticorn/metrics/client/api_client.py +0 -5
  92. crypticorn/metrics/client/configuration.py +4 -2
  93. crypticorn/metrics/client/models/exception_detail.py +1 -1
  94. crypticorn/metrics/client/models/exchange_mapping.py +1 -1
  95. crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
  96. crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
  97. crypticorn/metrics/client/models/ohlcv.py +1 -1
  98. crypticorn/metrics/client/rest.py +23 -4
  99. crypticorn/metrics/main.py +113 -19
  100. crypticorn/pay/client/api/admin_api.py +1585 -57
  101. crypticorn/pay/client/api/now_payments_api.py +961 -39
  102. crypticorn/pay/client/api/payments_api.py +562 -17
  103. crypticorn/pay/client/api/products_api.py +880 -30
  104. crypticorn/pay/client/api/status_api.py +397 -16
  105. crypticorn/pay/client/api_client.py +0 -5
  106. crypticorn/pay/client/configuration.py +2 -2
  107. crypticorn/pay/client/models/api_error_identifier.py +7 -7
  108. crypticorn/pay/client/models/exception_detail.py +1 -1
  109. crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
  110. crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
  111. crypticorn/pay/client/models/product.py +1 -1
  112. crypticorn/pay/client/models/product_create.py +1 -1
  113. crypticorn/pay/client/models/product_update.py +1 -1
  114. crypticorn/pay/client/models/scope.py +1 -0
  115. crypticorn/pay/client/rest.py +23 -4
  116. crypticorn/pay/main.py +10 -6
  117. crypticorn/trade/client/__init__.py +11 -1
  118. crypticorn/trade/client/api/__init__.py +0 -1
  119. crypticorn/trade/client/api/admin_api.py +1184 -55
  120. crypticorn/trade/client/api/api_keys_api.py +1678 -162
  121. crypticorn/trade/client/api/bots_api.py +7563 -187
  122. crypticorn/trade/client/api/exchanges_api.py +565 -19
  123. crypticorn/trade/client/api/notifications_api.py +1290 -116
  124. crypticorn/trade/client/api/orders_api.py +393 -55
  125. crypticorn/trade/client/api/status_api.py +397 -13
  126. crypticorn/trade/client/api/strategies_api.py +1133 -77
  127. crypticorn/trade/client/api/trading_actions_api.py +786 -65
  128. crypticorn/trade/client/models/__init__.py +11 -0
  129. crypticorn/trade/client/models/actions_count.py +88 -0
  130. crypticorn/trade/client/models/api_error_identifier.py +8 -7
  131. crypticorn/trade/client/models/bot.py +7 -18
  132. crypticorn/trade/client/models/bot_create.py +17 -1
  133. crypticorn/trade/client/models/bot_update.py +17 -1
  134. crypticorn/trade/client/models/exchange.py +6 -1
  135. crypticorn/trade/client/models/exchange_key.py +1 -1
  136. crypticorn/trade/client/models/exchange_key_balance.py +111 -0
  137. crypticorn/trade/client/models/exchange_key_create.py +17 -1
  138. crypticorn/trade/client/models/exchange_key_update.py +17 -1
  139. crypticorn/trade/client/models/execution_ids.py +1 -1
  140. crypticorn/trade/client/models/futures_balance.py +27 -25
  141. crypticorn/trade/client/models/futures_trading_action.py +6 -28
  142. crypticorn/trade/client/models/futures_trading_action_create.py +10 -13
  143. crypticorn/trade/client/models/notification.py +17 -1
  144. crypticorn/trade/client/models/notification_create.py +18 -2
  145. crypticorn/trade/client/models/notification_update.py +17 -1
  146. crypticorn/trade/client/models/order.py +2 -14
  147. crypticorn/trade/client/models/orders_count.py +88 -0
  148. crypticorn/trade/client/models/paginated_response_futures_trading_action.py +134 -0
  149. crypticorn/trade/client/models/paginated_response_order.py +134 -0
  150. crypticorn/trade/client/models/pn_l.py +95 -0
  151. crypticorn/trade/client/models/post_futures_action.py +1 -1
  152. crypticorn/trade/client/models/spot_balance.py +109 -0
  153. crypticorn/trade/client/models/spot_trading_action_create.py +4 -1
  154. crypticorn/trade/client/models/strategy.py +22 -4
  155. crypticorn/trade/client/models/strategy_create.py +23 -5
  156. crypticorn/trade/client/models/strategy_exchange_info.py +16 -4
  157. crypticorn/trade/client/models/strategy_update.py +19 -3
  158. crypticorn/trade/client/models/tpsl.py +4 -27
  159. crypticorn/trade/client/models/tpsl_create.py +6 -19
  160. crypticorn/trade/client/rest.py +23 -4
  161. crypticorn/trade/main.py +15 -12
  162. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/METADATA +65 -20
  163. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/RECORD +167 -132
  164. crypticorn/trade/client/api/futures_trading_panel_api.py +0 -1285
  165. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/WHEEL +0 -0
  166. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/entry_points.txt +0 -0
  167. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/licenses/LICENSE +0 -0
  168. {crypticorn-2.15.0.dist-info → crypticorn-2.17.0.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
1
1
  from __future__ import annotations
2
- from typing import TYPE_CHECKING, Optional
2
+ from typing import TYPE_CHECKING, Optional, Union, Coroutine, Any
3
3
  from crypticorn.common import optional_import
4
4
  from crypticorn.metrics import (
5
5
  ApiClient,
@@ -27,22 +27,27 @@ class MetricsClient:
27
27
  config_class = Configuration
28
28
 
29
29
  def __init__(
30
- self, config: Configuration, http_client: Optional[ClientSession] = None
30
+ self,
31
+ config: Configuration,
32
+ http_client: Optional[ClientSession] = None,
33
+ is_sync: bool = False,
31
34
  ):
32
35
  self.config = config
33
36
  self.base_client = ApiClient(configuration=self.config)
34
37
  if http_client is not None:
35
38
  self.base_client.rest_client.pool_manager = http_client
39
+ # Pass sync context to REST client for proper session management
40
+ self.base_client.rest_client.is_sync = is_sync
36
41
  # Instantiate all the endpoint clients
37
- self.status = StatusApi(self.base_client)
38
- self.indicators = IndicatorsApi(self.base_client)
39
- self.logs = LogsApi(self.base_client)
40
- self.marketcap = MarketcapApiWrapper(self.base_client)
41
- self.markets = MarketsApi(self.base_client)
42
- self.tokens = TokensApiWrapper(self.base_client)
43
- self.exchanges = ExchangesApiWrapper(self.base_client)
44
- self.quote_currencies = QuoteCurrenciesApi(self.base_client)
45
- self.admin = AdminApi(self.base_client)
42
+ self.status = StatusApi(self.base_client, is_sync=is_sync)
43
+ self.indicators = IndicatorsApi(self.base_client, is_sync=is_sync)
44
+ self.logs = LogsApi(self.base_client, is_sync=is_sync)
45
+ self.marketcap = MarketcapApiWrapper(self.base_client, is_sync=is_sync)
46
+ self.markets = MarketsApi(self.base_client, is_sync=is_sync)
47
+ self.tokens = TokensApiWrapper(self.base_client, is_sync=is_sync)
48
+ self.exchanges = ExchangesApiWrapper(self.base_client, is_sync=is_sync)
49
+ self.quote_currencies = QuoteCurrenciesApi(self.base_client, is_sync=is_sync)
50
+ self.admin = AdminApi(self.base_client, is_sync=is_sync)
46
51
 
47
52
 
48
53
  class MarketcapApiWrapper(MarketcapApi):
@@ -50,12 +55,36 @@ class MarketcapApiWrapper(MarketcapApi):
50
55
  A wrapper for the MarketcapApi class.
51
56
  """
52
57
 
53
- async def get_marketcap_symbols_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
58
+ def get_marketcap_symbols_fmt(self, *args, **kwargs) -> Union[pd.DataFrame, Coroutine[Any, Any, pd.DataFrame]]: # type: ignore
54
59
  """
55
60
  Get the marketcap symbols in a pandas dataframe
61
+ Works in both sync and async contexts.
62
+ """
63
+ if self.is_sync:
64
+ return self._get_marketcap_symbols_fmt_sync(*args, **kwargs)
65
+ else:
66
+ return self._get_marketcap_symbols_fmt_async(*args, **kwargs)
67
+
68
+ def _get_marketcap_symbols_fmt_sync(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
69
+ """
70
+ Get the marketcap symbols in a pandas dataframe (sync version)
56
71
  """
57
72
  pd = optional_import("pandas", "extra")
58
- response = await self.get_marketcap_symbols(*args, **kwargs)
73
+ response = self._get_marketcap_symbols_sync(*args, **kwargs)
74
+ rows = []
75
+ for item in response:
76
+ row = {"timestamp": item.timestamp}
77
+ row.update({i + 1: sym for i, sym in enumerate(item.symbols)})
78
+ rows.append(row)
79
+ df = pd.DataFrame(rows)
80
+ return df
81
+
82
+ async def _get_marketcap_symbols_fmt_async(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
83
+ """
84
+ Get the marketcap symbols in a pandas dataframe (async version)
85
+ """
86
+ pd = optional_import("pandas", "extra")
87
+ response = await self._get_marketcap_symbols_async(*args, **kwargs)
59
88
  rows = []
60
89
  for item in response:
61
90
  row = {"timestamp": item.timestamp}
@@ -70,20 +99,56 @@ class TokensApiWrapper(TokensApi):
70
99
  A wrapper for the TokensApi class.
71
100
  """
72
101
 
73
- async def get_stable_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
102
+ def get_stable_tokens_fmt(self, *args, **kwargs) -> Union[pd.DataFrame, Coroutine[Any, Any, pd.DataFrame]]: # type: ignore
74
103
  """
75
104
  Get the tokens in a pandas dataframe
105
+ Works in both sync and async contexts.
106
+ """
107
+ if self.is_sync:
108
+ return self._get_stable_tokens_fmt_sync(*args, **kwargs)
109
+ else:
110
+ return self._get_stable_tokens_fmt_async(*args, **kwargs)
111
+
112
+ def _get_stable_tokens_fmt_sync(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
113
+ """
114
+ Get the tokens in a pandas dataframe (sync version)
115
+ """
116
+ pd = optional_import("pandas", "extra")
117
+ response = self._get_stable_tokens_sync(*args, **kwargs)
118
+ return pd.DataFrame(response)
119
+
120
+ async def _get_stable_tokens_fmt_async(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
121
+ """
122
+ Get the tokens in a pandas dataframe (async version)
76
123
  """
77
124
  pd = optional_import("pandas", "extra")
78
- response = await self.get_stable_tokens(*args, **kwargs)
125
+ response = await self._get_stable_tokens_async(*args, **kwargs)
79
126
  return pd.DataFrame(response)
80
127
 
81
- async def get_wrapped_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
128
+ def get_wrapped_tokens_fmt(self, *args, **kwargs) -> Union[pd.DataFrame, Coroutine[Any, Any, pd.DataFrame]]: # type: ignore
82
129
  """
83
130
  Get the wrapped tokens in a pandas dataframe
131
+ Works in both sync and async contexts.
132
+ """
133
+ if self.is_sync:
134
+ return self._get_wrapped_tokens_fmt_sync(*args, **kwargs)
135
+ else:
136
+ return self._get_wrapped_tokens_fmt_async(*args, **kwargs)
137
+
138
+ def _get_wrapped_tokens_fmt_sync(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
139
+ """
140
+ Get the wrapped tokens in a pandas dataframe (sync version)
84
141
  """
85
142
  pd = optional_import("pandas", "extra")
86
- response = await self.get_wrapped_tokens(*args, **kwargs)
143
+ response = self._get_wrapped_tokens_sync(*args, **kwargs)
144
+ return pd.DataFrame(response)
145
+
146
+ async def _get_wrapped_tokens_fmt_async(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
147
+ """
148
+ Get the wrapped tokens in a pandas dataframe (async version)
149
+ """
150
+ pd = optional_import("pandas", "extra")
151
+ response = await self._get_wrapped_tokens_async(*args, **kwargs)
87
152
  return pd.DataFrame(response)
88
153
 
89
154
 
@@ -92,12 +157,41 @@ class ExchangesApiWrapper(ExchangesApi):
92
157
  A wrapper for the ExchangesApi class.
93
158
  """
94
159
 
95
- async def get_available_exchanges_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
160
+ def get_available_exchanges_fmt(self, *args, **kwargs) -> Union[pd.DataFrame, Coroutine[Any, Any, pd.DataFrame]]: # type: ignore
96
161
  """
97
162
  Get the exchanges in a pandas dataframe
163
+ Works in both sync and async contexts.
164
+ """
165
+ if self.is_sync:
166
+ return self._get_available_exchanges_fmt_sync(*args, **kwargs)
167
+ else:
168
+ return self._get_available_exchanges_fmt_async(*args, **kwargs)
169
+
170
+ def _get_available_exchanges_fmt_sync(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
171
+ """
172
+ Get the exchanges in a pandas dataframe (sync version)
173
+ """
174
+ pd = optional_import("pandas", "extra")
175
+ response = self._get_available_exchanges_sync(*args, **kwargs)
176
+
177
+ # Create list of dictionaries with timestamp and flattened exchange data
178
+ rows = []
179
+ for item in response:
180
+ row = {"timestamp": item.timestamp}
181
+ row.update(
182
+ item.exchanges
183
+ ) # This spreads the exchanges dict into individual columns
184
+ rows.append(row)
185
+
186
+ df = pd.DataFrame(rows)
187
+ return df
188
+
189
+ async def _get_available_exchanges_fmt_async(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
190
+ """
191
+ Get the exchanges in a pandas dataframe (async version)
98
192
  """
99
193
  pd = optional_import("pandas", "extra")
100
- response = await self.get_available_exchanges(*args, **kwargs)
194
+ response = await self._get_available_exchanges_async(*args, **kwargs)
101
195
 
102
196
  # Create list of dictionaries with timestamp and flattened exchange data
103
197
  rows = []