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
crypticorn/metrics/main.py
CHANGED
@@ -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,
|
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
|
-
|
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 =
|
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
|
-
|
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.
|
125
|
+
response = await self._get_stable_tokens_async(*args, **kwargs)
|
79
126
|
return pd.DataFrame(response)
|
80
127
|
|
81
|
-
|
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 =
|
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
|
-
|
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.
|
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 = []
|