crypticorn 2.10.1__py3-none-any.whl → 2.10.3__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/common/decorators.py +2 -1
- crypticorn/common/utils.py +17 -0
- crypticorn/metrics/client/configuration.py +2 -4
- crypticorn/metrics/client/models/marketcap_ranking.py +2 -3
- crypticorn/metrics/client/models/ohlcv.py +1 -2
- crypticorn/metrics/main.py +6 -5
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/METADATA +1 -1
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/RECORD +12 -12
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/WHEEL +0 -0
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/licenses/LICENSE +0 -0
- {crypticorn-2.10.1.dist-info → crypticorn-2.10.3.dist-info}/top_level.txt +0 -0
crypticorn/common/decorators.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
from datetime import datetime
|
1
2
|
from typing import Optional, Type, Any, Tuple
|
2
3
|
from copy import deepcopy
|
3
4
|
|
4
|
-
from pydantic import BaseModel, create_model
|
5
|
+
from pydantic import BaseModel, create_model, field_validator, BeforeValidator
|
5
6
|
from pydantic.fields import FieldInfo
|
6
7
|
|
7
8
|
|
crypticorn/common/utils.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"""General utility functions and helper methods used across the codebase."""
|
2
2
|
|
3
|
+
from datetime import datetime
|
3
4
|
from typing import Any
|
4
5
|
from decimal import Decimal
|
5
6
|
import string
|
@@ -74,3 +75,19 @@ def optional_import(module_name: str, extra_name: str) -> Any:
|
|
74
75
|
f"Optional dependency '{module_name}' is required for this feature. "
|
75
76
|
f"Install it with: pip install crypticorn[{extra_name}]"
|
76
77
|
) from e
|
78
|
+
|
79
|
+
|
80
|
+
def datetime_to_timestamp(v: Any):
|
81
|
+
"""Converts a datetime to a timestamp.
|
82
|
+
Can be used as a pydantic validator.
|
83
|
+
>>> from pydantic import BeforeValidator, BaseModel
|
84
|
+
>>> class MyModel(BaseModel):
|
85
|
+
... timestamp: Annotated[int, BeforeValidator(datetime_to_timestamp)]
|
86
|
+
"""
|
87
|
+
if isinstance(v, list):
|
88
|
+
return [
|
89
|
+
int(item.timestamp()) if isinstance(item, datetime) else item for item in v
|
90
|
+
]
|
91
|
+
elif isinstance(v, datetime):
|
92
|
+
return int(v.timestamp())
|
93
|
+
return v
|
@@ -215,9 +215,7 @@ class Configuration:
|
|
215
215
|
debug: Optional[bool] = None,
|
216
216
|
) -> None:
|
217
217
|
"""Constructor"""
|
218
|
-
self._base_path =
|
219
|
-
"https://api.crypticorn.dev/v1/metrics" if host is None else host
|
220
|
-
)
|
218
|
+
self._base_path = "http://127.0.0.1:8000/v1/metrics" if host is None else host
|
221
219
|
"""Default Base url
|
222
220
|
"""
|
223
221
|
self.server_index = 0 if server_index is None and host is None else server_index
|
@@ -559,7 +557,7 @@ class Configuration:
|
|
559
557
|
"""
|
560
558
|
return [
|
561
559
|
{
|
562
|
-
"url": "
|
560
|
+
"url": "http://127.0.0.1:8000/v1/metrics",
|
563
561
|
"description": "No description provided",
|
564
562
|
}
|
565
563
|
]
|
@@ -17,8 +17,7 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from
|
21
|
-
from pydantic import BaseModel, ConfigDict, StrictStr
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
22
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
23
22
|
from typing import Optional, Set
|
24
23
|
from typing_extensions import Self
|
@@ -29,7 +28,7 @@ class MarketcapRanking(BaseModel):
|
|
29
28
|
MarketcapRanking
|
30
29
|
""" # noqa: E501
|
31
30
|
|
32
|
-
timestamp:
|
31
|
+
timestamp: StrictInt
|
33
32
|
symbols: List[Optional[StrictStr]]
|
34
33
|
__properties: ClassVar[List[str]] = ["timestamp", "symbols"]
|
35
34
|
|
@@ -17,7 +17,6 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from datetime import datetime
|
21
20
|
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
|
22
21
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
22
|
from typing import Optional, Set
|
@@ -29,7 +28,7 @@ class OHLCV(BaseModel):
|
|
29
28
|
OHLCV
|
30
29
|
""" # noqa: E501
|
31
30
|
|
32
|
-
timestamp:
|
31
|
+
timestamp: StrictInt
|
33
32
|
open: Union[StrictFloat, StrictInt]
|
34
33
|
high: Union[StrictFloat, StrictInt]
|
35
34
|
low: Union[StrictFloat, StrictInt]
|
crypticorn/metrics/main.py
CHANGED
@@ -51,8 +51,12 @@ class MarketcapApiWrapper(MarketcapApi):
|
|
51
51
|
"""
|
52
52
|
pd = optional_import("pandas", "extra")
|
53
53
|
response = await self.get_marketcap_symbols(*args, **kwargs)
|
54
|
-
|
55
|
-
|
54
|
+
rows = []
|
55
|
+
for item in response:
|
56
|
+
row = {"timestamp": item.timestamp}
|
57
|
+
row.update({i+1: sym for i, sym in enumerate(item.symbols)})
|
58
|
+
rows.append(row)
|
59
|
+
df = pd.DataFrame(rows)
|
56
60
|
return df
|
57
61
|
|
58
62
|
|
@@ -100,9 +104,6 @@ class ExchangesApiWrapper(ExchangesApi):
|
|
100
104
|
cols = ["timestamp"] + sorted([col for col in df.columns if col != "timestamp"])
|
101
105
|
df = df[cols]
|
102
106
|
|
103
|
-
# Convert timestamp to unix timestamp
|
104
|
-
df["timestamp"] = pd.to_datetime(df["timestamp"]).astype("int64") // 10**9
|
105
|
-
|
106
107
|
# Convert exchange availability to boolean integers (0/1)
|
107
108
|
df = df.astype(
|
108
109
|
{
|
@@ -68,7 +68,7 @@ crypticorn/cli/templates/ruff.yml,sha256=gWicFFTzC4nToSmRkIIGipos8CZ447YG0kebBCJ
|
|
68
68
|
crypticorn/common/__init__.py,sha256=DXEuUU_kaLBSBcvpiFie_ROuK5XEZuTMIfsg-BZE0iE,752
|
69
69
|
crypticorn/common/ansi_colors.py,sha256=ts49UtfTy-c0uvlGwb3wE-jE_GbXvSBSfzwrDlNi0HE,1331
|
70
70
|
crypticorn/common/auth.py,sha256=5wgApDw5x7dI-IWU9tX_gih-gMozi7Y5Tgpen-A9fbo,8713
|
71
|
-
crypticorn/common/decorators.py,sha256=
|
71
|
+
crypticorn/common/decorators.py,sha256=t5Y3vSJ-gt0n2vOYYjYN0dtzNXvZxrJs2SEItpzG8oo,1127
|
72
72
|
crypticorn/common/enums.py,sha256=-KbdOEZ4LXHyPB6lBHzwLraBnIem9UXU3FM90culL1o,693
|
73
73
|
crypticorn/common/errors.py,sha256=UvPIAMuKaCG1Skbog4hJKHsjJyOvO95nF_UDBwfc3MU,27945
|
74
74
|
crypticorn/common/exceptions.py,sha256=iq_VFkZ4jr_7BeEjDwlmHyRYPLIYN98-MJGJrxe2OqM,6036
|
@@ -79,7 +79,7 @@ crypticorn/common/openapi.py,sha256=D8bCpCVVzYQptHrJ7SYOgCxI3R_d0cjW9KMOBq-x0xk,
|
|
79
79
|
crypticorn/common/pagination.py,sha256=BYMNB4JUW9eeiTw1q3CyHXaT_-hk_BrSXAOqvif08Ek,2334
|
80
80
|
crypticorn/common/scopes.py,sha256=TsSzMFHQAJ45CwhSrU3uRPHyHHjrCgPdJhAyjxY6b2Q,2456
|
81
81
|
crypticorn/common/urls.py,sha256=qJHxdkpwQR1iPLSPMYVoobnLNSsQoKVV5SsRng4dZYs,1161
|
82
|
-
crypticorn/common/utils.py,sha256=
|
82
|
+
crypticorn/common/utils.py,sha256=Qj_89xzhxVH7Pzu7PnRCbNZlBZuXVtUqbXY6X_nesRc,3054
|
83
83
|
crypticorn/common/warnings.py,sha256=bIfMLbKaCntMV88rTnoWgV6SZ9FJvo_adXv3yFW1rqg,2395
|
84
84
|
crypticorn/common/router/admin_router.py,sha256=x81s1gxhH7nLf7txqAIjVxrNgQmXsA1YG7g9v9KJwHA,3740
|
85
85
|
crypticorn/common/router/status_router.py,sha256=it6kfvx_Pn4Rv06fmViwhwr-m6f4WuSgcZwc6VTaMz4,868
|
@@ -159,11 +159,11 @@ crypticorn/klines/client/models/symbol_type.py,sha256=uOEqlQJ714fa0SEYOxzCOx9cG-
|
|
159
159
|
crypticorn/klines/client/models/timeframe.py,sha256=bSZJz3Q78V1RAnm3ZDtGBzFOnDKE3Pc5A0eP3ky3KaI,760
|
160
160
|
crypticorn/klines/client/models/udf_config.py,sha256=cVSxnJrkwnS4p0fEUgZMekueDv28k-p58bZwvHMSmqc,5152
|
161
161
|
crypticorn/metrics/__init__.py,sha256=t7FrHV5PaVTka90eIxDgOaWvOiyznSStcUanSbLov2o,126
|
162
|
-
crypticorn/metrics/main.py,sha256=
|
162
|
+
crypticorn/metrics/main.py,sha256=KK7HazbkBEXSUUB4PRiNDV9-8r_p5Z4Znqt_SIr_jII,3575
|
163
163
|
crypticorn/metrics/client/__init__.py,sha256=zp5tyfddEBfFrCqp9YEAwObC60lZ0GnqO3dvsAOt1zE,2530
|
164
164
|
crypticorn/metrics/client/api_client.py,sha256=pGWJuO-mgxlUdhJGwkScf7CviGzjDrmUAiU0LXasQY4,26934
|
165
165
|
crypticorn/metrics/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
166
|
-
crypticorn/metrics/client/configuration.py,sha256=
|
166
|
+
crypticorn/metrics/client/configuration.py,sha256=2GqHs-vx7bW_3S-bXMz_2RV-Z-HhdC8J_lQW2T8R3T8,19168
|
167
167
|
crypticorn/metrics/client/exceptions.py,sha256=UegnYftFlQDXAQv8BmD20yRzTtWpjTHcuOymTBWmgeE,6421
|
168
168
|
crypticorn/metrics/client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
169
169
|
crypticorn/metrics/client/rest.py,sha256=pWeYnpTfTV7L5U6Kli3b7i8VrmqdG8sskqSnTHPIoQo,7025
|
@@ -186,8 +186,8 @@ crypticorn/metrics/client/models/exchange_mapping.py,sha256=SJkMHO-ZZfnnjWNHAgmL
|
|
186
186
|
crypticorn/metrics/client/models/internal_exchange.py,sha256=aWc3gPt1TSQ74y5tivLAVOu-qySo9djgIWwsB8nYass,864
|
187
187
|
crypticorn/metrics/client/models/log_level.py,sha256=u_1h06MyyyfV5PYYh8Xjgq9ySF2CfU_clZbkww6aJk4,769
|
188
188
|
crypticorn/metrics/client/models/market_type.py,sha256=1fLJIuDO5wK5JABFxtnJzHMwJw1mSqf21-QVAP102xk,711
|
189
|
-
crypticorn/metrics/client/models/marketcap_ranking.py,sha256=
|
190
|
-
crypticorn/metrics/client/models/ohlcv.py,sha256=
|
189
|
+
crypticorn/metrics/client/models/marketcap_ranking.py,sha256=4oF7Ul76yDHxBEmAsgINd9g5UEKQesDT0TVJd6xiXmM,2563
|
190
|
+
crypticorn/metrics/client/models/ohlcv.py,sha256=xEpqWy1XwC1JwyUM6yvJCgpVTJiCWvxm0HJnnzvKawM,3339
|
191
191
|
crypticorn/metrics/client/models/severity.py,sha256=Bwls2jjCMP2lKc-_67d5WZbGPAebUEPge7a82iUf4Qs,731
|
192
192
|
crypticorn/metrics/client/models/time_interval.py,sha256=8bHhMNt56xVGvJi5xNFMrAkAZFRKfym1UkeGoM2H0j8,772
|
193
193
|
crypticorn/metrics/client/models/trading_status.py,sha256=_S-KAyuCJsLLY0UTcNKkhLWoPJS-ywf7y3yTdhIuF0w,746
|
@@ -259,9 +259,9 @@ crypticorn/trade/client/models/strategy_model_input.py,sha256=ala19jARyfA5ysys5D
|
|
259
259
|
crypticorn/trade/client/models/strategy_model_output.py,sha256=2o2lhbgUSTznowpMLEHF1Ex9TG9oRmzlCIb-gXqo7_s,5643
|
260
260
|
crypticorn/trade/client/models/tpsl.py,sha256=C2KgTIZs-a8W4msdaXgBKJcwtA-o5wR4rBauRP-iQxU,4317
|
261
261
|
crypticorn/trade/client/models/trading_action_type.py,sha256=pGq_TFLMPfYFizYP-xKgEC1ZF4U3lGdJYoGa_ZH2x-Q,769
|
262
|
-
crypticorn-2.10.
|
263
|
-
crypticorn-2.10.
|
264
|
-
crypticorn-2.10.
|
265
|
-
crypticorn-2.10.
|
266
|
-
crypticorn-2.10.
|
267
|
-
crypticorn-2.10.
|
262
|
+
crypticorn-2.10.3.dist-info/licenses/LICENSE,sha256=HonAVvzFXkP2C1d7D3ByIKPwjGH8NcHTAQvKH7uvOHQ,1856
|
263
|
+
crypticorn-2.10.3.dist-info/METADATA,sha256=_OszOOnOb4VBGZxrDlcRk16gnZqHiUWWSXAR8Bvq9J0,10125
|
264
|
+
crypticorn-2.10.3.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
265
|
+
crypticorn-2.10.3.dist-info/entry_points.txt,sha256=d_xHsGvUTebPveVUK0SrpDFQ5ZRSjlI7lNCc11sn2PM,59
|
266
|
+
crypticorn-2.10.3.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
|
267
|
+
crypticorn-2.10.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|