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
crypticorn/hive/main.py
CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
import os
|
3
3
|
import asyncio
|
4
4
|
from pathlib import Path
|
5
|
-
from typing import TYPE_CHECKING, Optional
|
5
|
+
from typing import TYPE_CHECKING, Optional, Union, Coroutine, Any
|
6
6
|
from crypticorn.hive import (
|
7
7
|
ApiClient,
|
8
8
|
Configuration,
|
@@ -20,12 +20,38 @@ if TYPE_CHECKING:
|
|
20
20
|
from aiohttp import ClientSession
|
21
21
|
|
22
22
|
|
23
|
+
class HiveClient:
|
24
|
+
"""
|
25
|
+
A client for interacting with the Crypticorn Hive API.
|
26
|
+
"""
|
27
|
+
|
28
|
+
config_class = Configuration
|
29
|
+
|
30
|
+
def __init__(
|
31
|
+
self,
|
32
|
+
config: Configuration,
|
33
|
+
http_client: Optional[ClientSession] = None,
|
34
|
+
is_sync: bool = False,
|
35
|
+
):
|
36
|
+
self.config = config
|
37
|
+
self.base_client = ApiClient(configuration=self.config)
|
38
|
+
if http_client is not None:
|
39
|
+
self.base_client.rest_client.pool_manager = http_client
|
40
|
+
# Pass sync context to REST client for proper session management
|
41
|
+
self.base_client.rest_client.is_sync = is_sync
|
42
|
+
# Instantiate all the endpoint clients
|
43
|
+
self.models = ModelsApi(self.base_client, is_sync=is_sync)
|
44
|
+
self.data = DataApiWrapper(self.base_client, is_sync=is_sync)
|
45
|
+
self.status = StatusApi(self.base_client, is_sync=is_sync)
|
46
|
+
self.admin = AdminApi(self.base_client, is_sync=is_sync)
|
47
|
+
|
48
|
+
|
23
49
|
class DataApiWrapper(DataApi):
|
24
50
|
"""
|
25
51
|
A wrapper for the DataApi class.
|
26
52
|
"""
|
27
53
|
|
28
|
-
|
54
|
+
def download_data(
|
29
55
|
self,
|
30
56
|
model_id: StrictInt,
|
31
57
|
folder: Path = Path("data"),
|
@@ -33,17 +59,86 @@ class DataApiWrapper(DataApi):
|
|
33
59
|
feature_size: Optional[FeatureSize] = None,
|
34
60
|
*args,
|
35
61
|
**kwargs,
|
36
|
-
) -> list[Path]:
|
62
|
+
) -> Union[list[Path], Coroutine[Any, Any, list[Path]]]:
|
37
63
|
"""
|
38
64
|
Download data for model training. All three files (y_train, x_test, x_train) are downloaded and saved under e.g. FOLDER/v1/coin_1/*.feather.
|
39
65
|
The folder will be created if it doesn't exist.
|
66
|
+
Works in both sync and async contexts.
|
40
67
|
|
41
68
|
:param model_id: Model ID (required) (type: int)
|
42
69
|
:param version: Data version. Default is the latest public version. (optional) (type: DataVersion)
|
43
70
|
:param feature_size: The number of features in the data. Default is LARGE. (optional) (type: FeatureSize)
|
44
71
|
:return: A list of paths to the downloaded files.
|
45
72
|
"""
|
46
|
-
|
73
|
+
if self.is_sync:
|
74
|
+
return self._download_data_wrapper_sync(
|
75
|
+
model_id=model_id,
|
76
|
+
folder=folder,
|
77
|
+
version=version,
|
78
|
+
feature_size=feature_size,
|
79
|
+
*args,
|
80
|
+
**kwargs,
|
81
|
+
)
|
82
|
+
else:
|
83
|
+
return self._download_data_wrapper_async(
|
84
|
+
model_id=model_id,
|
85
|
+
folder=folder,
|
86
|
+
version=version,
|
87
|
+
feature_size=feature_size,
|
88
|
+
*args,
|
89
|
+
**kwargs,
|
90
|
+
)
|
91
|
+
|
92
|
+
def _download_data_wrapper_sync(
|
93
|
+
self,
|
94
|
+
model_id: StrictInt,
|
95
|
+
folder: Path = Path("data"),
|
96
|
+
version: Optional[DataVersion] = None,
|
97
|
+
feature_size: Optional[FeatureSize] = None,
|
98
|
+
*args,
|
99
|
+
**kwargs,
|
100
|
+
) -> list[Path]:
|
101
|
+
"""
|
102
|
+
Download data for model training (sync version).
|
103
|
+
"""
|
104
|
+
response = self._download_data_sync(
|
105
|
+
model_id=model_id,
|
106
|
+
version=version,
|
107
|
+
feature_size=feature_size,
|
108
|
+
*args,
|
109
|
+
**kwargs,
|
110
|
+
)
|
111
|
+
base_path = f"{folder}/v{response.version.value}/coin_{response.coin.value}/"
|
112
|
+
os.makedirs(base_path, exist_ok=True)
|
113
|
+
|
114
|
+
return [
|
115
|
+
download_file(
|
116
|
+
url=response.links.y_train,
|
117
|
+
dest_path=base_path + "y_train_" + response.target + ".feather",
|
118
|
+
),
|
119
|
+
download_file(
|
120
|
+
url=response.links.x_test,
|
121
|
+
dest_path=base_path + "x_test_" + response.feature_size + ".feather",
|
122
|
+
),
|
123
|
+
download_file(
|
124
|
+
url=response.links.x_train,
|
125
|
+
dest_path=base_path + "x_train_" + response.feature_size + ".feather",
|
126
|
+
),
|
127
|
+
]
|
128
|
+
|
129
|
+
async def _download_data_wrapper_async(
|
130
|
+
self,
|
131
|
+
model_id: StrictInt,
|
132
|
+
folder: Path = Path("data"),
|
133
|
+
version: Optional[DataVersion] = None,
|
134
|
+
feature_size: Optional[FeatureSize] = None,
|
135
|
+
*args,
|
136
|
+
**kwargs,
|
137
|
+
) -> list[Path]:
|
138
|
+
"""
|
139
|
+
Download data for model training (async version).
|
140
|
+
"""
|
141
|
+
response = await self._download_data_async(
|
47
142
|
model_id=model_id,
|
48
143
|
version=version,
|
49
144
|
feature_size=feature_size,
|
@@ -75,24 +170,3 @@ class DataApiWrapper(DataApi):
|
|
75
170
|
),
|
76
171
|
]
|
77
172
|
)
|
78
|
-
|
79
|
-
|
80
|
-
class HiveClient:
|
81
|
-
"""
|
82
|
-
A client for interacting with the Crypticorn Hive API.
|
83
|
-
"""
|
84
|
-
|
85
|
-
config_class = Configuration
|
86
|
-
|
87
|
-
def __init__(
|
88
|
-
self, config: Configuration, http_client: Optional[ClientSession] = None
|
89
|
-
):
|
90
|
-
self.config = config
|
91
|
-
self.base_client = ApiClient(configuration=self.config)
|
92
|
-
if http_client is not None:
|
93
|
-
self.base_client.rest_client.pool_manager = http_client
|
94
|
-
# Instantiate all the endpoint clients
|
95
|
-
self.models = ModelsApi(self.base_client)
|
96
|
-
self.data = DataApiWrapper(self.base_client)
|
97
|
-
self.status = StatusApi(self.base_client)
|
98
|
-
self.admin = AdminApi(self.base_client)
|