crypticorn 2.10.2__py3-none-any.whl → 2.11.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.
@@ -1,5 +1,7 @@
1
- from enum import StrEnum
2
-
1
+ try:
2
+ from enum import StrEnum
3
+ except ImportError:
4
+ from strenum import StrEnum
3
5
 
4
6
  class AnsiColors(StrEnum):
5
7
  """Provides a collection of ANSI color codes for terminal text formatting, including regular, bright, and bold text colors. Useful for creating colorful and readable console output."""
crypticorn/common/auth.py CHANGED
@@ -18,7 +18,7 @@ from fastapi.security import (
18
18
  APIKeyHeader,
19
19
  )
20
20
  from typing_extensions import Annotated
21
-
21
+ from typing import Union
22
22
  # Auth Schemes
23
23
  http_bearer = HTTPBearer(
24
24
  bearerFormat="JWT",
@@ -132,7 +132,7 @@ class AuthHandler:
132
132
 
133
133
  async def api_key_auth(
134
134
  self,
135
- api_key: Annotated[str | None, Depends(apikey_header)] = None,
135
+ api_key: Annotated[Union[str, None], Depends(apikey_header)] = None,
136
136
  sec: SecurityScopes = SecurityScopes(),
137
137
  ) -> Verify200Response:
138
138
  """
@@ -144,7 +144,7 @@ class AuthHandler:
144
144
  async def bearer_auth(
145
145
  self,
146
146
  bearer: Annotated[
147
- HTTPAuthorizationCredentials | None,
147
+ Union[HTTPAuthorizationCredentials, None],
148
148
  Depends(http_bearer),
149
149
  ] = None,
150
150
  sec: SecurityScopes = SecurityScopes(),
@@ -158,9 +158,11 @@ class AuthHandler:
158
158
  async def combined_auth(
159
159
  self,
160
160
  bearer: Annotated[
161
- HTTPAuthorizationCredentials | None, Depends(http_bearer)
161
+ Union[HTTPAuthorizationCredentials, None], Depends(http_bearer)
162
+ ] = None,
163
+ api_key: Annotated[
164
+ Union[str, None], Depends(apikey_header)
162
165
  ] = None,
163
- api_key: Annotated[str | None, Depends(apikey_header)] = None,
164
166
  sec: SecurityScopes = SecurityScopes(),
165
167
  ) -> Verify200Response:
166
168
  """
@@ -202,7 +204,7 @@ class AuthHandler:
202
204
 
203
205
  async def ws_api_key_auth(
204
206
  self,
205
- api_key: Annotated[str | None, Query()] = None,
207
+ api_key: Annotated[Union[str, None], Query()] = None,
206
208
  sec: SecurityScopes = SecurityScopes(),
207
209
  ) -> Verify200Response:
208
210
  """
@@ -213,7 +215,7 @@ class AuthHandler:
213
215
 
214
216
  async def ws_bearer_auth(
215
217
  self,
216
- bearer: Annotated[str | None, Query()] = None,
218
+ bearer: Annotated[Union[str, None], Query()] = None,
217
219
  sec: SecurityScopes = SecurityScopes(),
218
220
  ) -> Verify200Response:
219
221
  """
@@ -224,8 +226,8 @@ class AuthHandler:
224
226
 
225
227
  async def ws_combined_auth(
226
228
  self,
227
- bearer: Annotated[str | None, Query()] = None,
228
- api_key: Annotated[str | None, Query()] = None,
229
+ bearer: Annotated[Union[str, None], Query()] = None,
230
+ api_key: Annotated[Union[str, None], Query()] = None,
229
231
  sec: SecurityScopes = SecurityScopes(),
230
232
  ) -> Verify200Response:
231
233
  """
@@ -1,6 +1,10 @@
1
1
  """Defines common enumerations used throughout the codebase for type safety and consistency."""
2
2
 
3
- from enum import StrEnum
3
+ try:
4
+ from enum import StrEnum
5
+ except ImportError:
6
+ from strenum import StrEnum
7
+
4
8
  from crypticorn.common.mixins import ValidateEnumMixin
5
9
 
6
10
 
@@ -1,8 +1,12 @@
1
1
  """Comprehensive error handling system defining various API error types, HTTP exceptions, and error content structures."""
2
2
 
3
- from enum import Enum, StrEnum
3
+ from enum import Enum
4
4
  from fastapi import status
5
5
  from crypticorn.common.mixins import ApiErrorFallback
6
+ try:
7
+ from enum import StrEnum
8
+ except ImportError:
9
+ from strenum import StrEnum
6
10
 
7
11
 
8
12
  class ApiErrorType(StrEnum):
@@ -1,5 +1,4 @@
1
1
  from typing import Optional, Dict, Any
2
- from enum import StrEnum
3
2
  from pydantic import BaseModel, Field
4
3
  from fastapi import HTTPException as FastAPIHTTPException, Request, FastAPI
5
4
  from fastapi.exceptions import RequestValidationError, ResponseValidationError
@@ -7,6 +6,10 @@ from fastapi.responses import JSONResponse
7
6
  from crypticorn.common import ApiError, ApiErrorIdentifier, ApiErrorType, ApiErrorLevel
8
7
  import logging
9
8
  import json
9
+ try:
10
+ from enum import StrEnum
11
+ except ImportError:
12
+ from strenum import StrEnum
10
13
 
11
14
  _logger = logging.getLogger("crypticorn")
12
15
 
@@ -2,12 +2,16 @@ from __future__ import annotations
2
2
 
3
3
  import logging
4
4
  import sys
5
- from enum import StrEnum
6
5
  from crypticorn.common.mixins import ValidateEnumMixin
7
6
  from crypticorn.common.ansi_colors import AnsiColors as C
8
7
  from datetime import datetime
9
8
  import os
10
9
 
10
+ try:
11
+ from enum import StrEnum
12
+ except ImportError:
13
+ from strenum import StrEnum
14
+
11
15
 
12
16
  class LogLevel(ValidateEnumMixin, StrEnum):
13
17
  DEBUG = "DEBUG"
@@ -1,4 +1,7 @@
1
- from enum import StrEnum
1
+ try:
2
+ from enum import StrEnum
3
+ except ImportError:
4
+ from strenum import StrEnum
2
5
 
3
6
 
4
7
  class Scope(StrEnum):
crypticorn/common/urls.py CHANGED
@@ -1,6 +1,10 @@
1
- from enum import StrEnum
2
1
  from crypticorn.common.enums import ValidateEnumMixin
3
2
 
3
+ try:
4
+ from enum import StrEnum
5
+ except ImportError:
6
+ from strenum import StrEnum
7
+
4
8
 
5
9
  class ApiEnv(StrEnum):
6
10
  """The environment the API is being used with."""
@@ -1,7 +1,7 @@
1
1
  """General utility functions and helper methods used across the codebase."""
2
2
 
3
3
  from datetime import datetime
4
- from typing import Any
4
+ from typing import Any, Union
5
5
  from decimal import Decimal
6
6
  import string
7
7
  import random
@@ -41,8 +41,8 @@ def gen_random_id(length: int = 20) -> str:
41
41
  "The `is_equal` method is deprecated; use `math.is_close` instead.", category=None
42
42
  )
43
43
  def is_equal(
44
- a: float | Decimal,
45
- b: float | Decimal,
44
+ a: Union[float, Decimal],
45
+ b: Union[float, Decimal],
46
46
  rel_tol: float = 1e-9,
47
47
  abs_tol: float = 0.0,
48
48
  ) -> bool:
@@ -1,7 +1,7 @@
1
1
  """Crypticorn-specific warnings."""
2
2
 
3
3
  from __future__ import annotations
4
-
4
+ from typing import Union
5
5
 
6
6
  class CrypticornDeprecationWarning(DeprecationWarning):
7
7
  """A Crypticorn specific deprecation warning.
@@ -24,7 +24,7 @@ class CrypticornDeprecationWarning(DeprecationWarning):
24
24
  message: str,
25
25
  *args: object,
26
26
  since: tuple[int, int],
27
- expected_removal: tuple[int, int] | None = None,
27
+ expected_removal: Union[tuple[int, int], None] = None,
28
28
  ) -> None:
29
29
  super().__init__(message, *args)
30
30
  self.message = message.rstrip(".")
@@ -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
- df = pd.DataFrame(response)
55
- df.rename(columns={df.columns[0]: "timestamp"}, inplace=True)
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
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypticorn
3
- Version: 2.10.2
3
+ Version: 2.11.0
4
4
  Summary: Maximise Your Crypto Trading Profits with Machine Learning
5
5
  Author-email: Crypticorn <timon@crypticorn.com>
6
6
  License: Copyright © 2025 Crypticorn
@@ -32,13 +32,14 @@ Classifier: Programming Language :: Python :: 3.11
32
32
  Classifier: Programming Language :: Python :: 3.12
33
33
  Classifier: Programming Language :: Python :: 3.13
34
34
  Classifier: Typing :: Typed
35
- Requires-Python: >=3.10
35
+ Requires-Python: >=3.9
36
36
  Description-Content-Type: text/markdown
37
37
  License-File: LICENSE
38
38
  Requires-Dist: fastapi<1.0.0,>=0.115.0
39
39
  Requires-Dist: click<9.0.0,>=8.0.0
40
40
  Requires-Dist: psutil<8.0.0,>=7.0.0
41
41
  Requires-Dist: setuptools<81.0.0,>=80.0.0
42
+ Requires-Dist: strenum
42
43
  Requires-Dist: urllib3<3.0.0,>=1.25.3
43
44
  Requires-Dist: python_dateutil<3.0.0,>=2.8.2
44
45
  Requires-Dist: aiohttp<4.0.0,>=3.8.4
@@ -76,7 +77,7 @@ crypto market - and programmatically interact with the entire Crypticorn ecosyst
76
77
 
77
78
  ## Installation
78
79
 
79
- You need Python 3.10+ installed to be able to use this library.
80
+ You need Python 3.9+ installed to be able to use this library.
80
81
 
81
82
  You can install the latest stable version from [PyPi](https://pypi.org/project/crypticorn/):
82
83
  ```bash
@@ -66,21 +66,21 @@ crypticorn/cli/templates/dependabot.yml,sha256=ct5ieB8KAV1KLzoYKUNm6dZ9wKG_P_JQH
66
66
  crypticorn/cli/templates/merge-env.sh,sha256=Q6d_RKcp2h6fOifYid8AsCvVGuUdleXkY3AxOVQ5psw,501
67
67
  crypticorn/cli/templates/ruff.yml,sha256=gWicFFTzC4nToSmRkIIGipos8CZ447YG0kebBCJhtJE,319
68
68
  crypticorn/common/__init__.py,sha256=DXEuUU_kaLBSBcvpiFie_ROuK5XEZuTMIfsg-BZE0iE,752
69
- crypticorn/common/ansi_colors.py,sha256=ts49UtfTy-c0uvlGwb3wE-jE_GbXvSBSfzwrDlNi0HE,1331
70
- crypticorn/common/auth.py,sha256=5wgApDw5x7dI-IWU9tX_gih-gMozi7Y5Tgpen-A9fbo,8713
69
+ crypticorn/common/ansi_colors.py,sha256=IA-3_wujtpniJuaZJdAkc0gYX0tkN7RMk5XfLcKJsfI,1391
70
+ crypticorn/common/auth.py,sha256=u_p2kiS3G2PfE4UZPZ2TuWvLkLkS00C3WnaLcMOvJlM,8807
71
71
  crypticorn/common/decorators.py,sha256=t5Y3vSJ-gt0n2vOYYjYN0dtzNXvZxrJs2SEItpzG8oo,1127
72
- crypticorn/common/enums.py,sha256=-KbdOEZ4LXHyPB6lBHzwLraBnIem9UXU3FM90culL1o,693
73
- crypticorn/common/errors.py,sha256=UvPIAMuKaCG1Skbog4hJKHsjJyOvO95nF_UDBwfc3MU,27945
74
- crypticorn/common/exceptions.py,sha256=iq_VFkZ4jr_7BeEjDwlmHyRYPLIYN98-MJGJrxe2OqM,6036
75
- crypticorn/common/logging.py,sha256=bpWT3ip8CM5tf_jKECJjwrVVf5GYcRjfo-CPb47gISU,4346
72
+ crypticorn/common/enums.py,sha256=md7C_p2gAu6BbDboLm-DYYuJWjCHgRdk68iC1H5ZqPg,755
73
+ crypticorn/common/errors.py,sha256=f109l0Xz-R8QfvRLw4ce7j5enQaqc9fTPBW1tgoY58I,28022
74
+ crypticorn/common/exceptions.py,sha256=DdBWUYPtojuhzkbRMzvKxh5g0ieQfMWP9p6cEH4wSTM,6097
75
+ crypticorn/common/logging.py,sha256=3ZTFB9j8Mqy_AlNYABUFQ_134OH0YtophJkP4_GDJ9w,4408
76
76
  crypticorn/common/middleware.py,sha256=O7XiXPimNYUhF9QTv6yFUTVlb91-SK-3CfTrWMNP6Ck,1011
77
77
  crypticorn/common/mixins.py,sha256=l7XQrBISaee6fDZXy96k0HnQ18XYocjTUXlNpVxhaOY,2206
78
78
  crypticorn/common/openapi.py,sha256=D8bCpCVVzYQptHrJ7SYOgCxI3R_d0cjW9KMOBq-x0xk,279
79
79
  crypticorn/common/pagination.py,sha256=BYMNB4JUW9eeiTw1q3CyHXaT_-hk_BrSXAOqvif08Ek,2334
80
- crypticorn/common/scopes.py,sha256=TsSzMFHQAJ45CwhSrU3uRPHyHHjrCgPdJhAyjxY6b2Q,2456
81
- crypticorn/common/urls.py,sha256=qJHxdkpwQR1iPLSPMYVoobnLNSsQoKVV5SsRng4dZYs,1161
82
- crypticorn/common/utils.py,sha256=Qj_89xzhxVH7Pzu7PnRCbNZlBZuXVtUqbXY6X_nesRc,3054
83
- crypticorn/common/warnings.py,sha256=bIfMLbKaCntMV88rTnoWgV6SZ9FJvo_adXv3yFW1rqg,2395
80
+ crypticorn/common/scopes.py,sha256=1hSrB0EHhO2aYC1A0Rvc0hdjdihyHM2nl-DGKQWHl3U,2517
81
+ crypticorn/common/urls.py,sha256=v23H2gevTNZ6HMRXDPiuc8znBbNdNqj0JTAdm5Hhms8,1223
82
+ crypticorn/common/utils.py,sha256=LcWudhcjZtULg87yYghh5muTYdHvk3UmkEAXmX7xgLk,3073
83
+ crypticorn/common/warnings.py,sha256=yEDsj8FNla9QMR_DOtD4lyEJInXdygY4sqVJEp5hgjU,2425
84
84
  crypticorn/common/router/admin_router.py,sha256=x81s1gxhH7nLf7txqAIjVxrNgQmXsA1YG7g9v9KJwHA,3740
85
85
  crypticorn/common/router/status_router.py,sha256=it6kfvx_Pn4Rv06fmViwhwr-m6f4WuSgcZwc6VTaMz4,868
86
86
  crypticorn/hive/__init__.py,sha256=hRfTlEzEql4msytdUC_04vfaHzVKG5CGZle1M-9QFgY,81
@@ -159,7 +159,7 @@ 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=I4KZ-46ro6I6-EWf3p1BZV-8Iryorr8pRUZhv3yXzXI,3581
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
@@ -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.2.dist-info/licenses/LICENSE,sha256=HonAVvzFXkP2C1d7D3ByIKPwjGH8NcHTAQvKH7uvOHQ,1856
263
- crypticorn-2.10.2.dist-info/METADATA,sha256=_uozb0TNqOSqB4MNQz0EvY10GaRYWrkdbCCUskx0RnY,10125
264
- crypticorn-2.10.2.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
265
- crypticorn-2.10.2.dist-info/entry_points.txt,sha256=d_xHsGvUTebPveVUK0SrpDFQ5ZRSjlI7lNCc11sn2PM,59
266
- crypticorn-2.10.2.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
267
- crypticorn-2.10.2.dist-info/RECORD,,
262
+ crypticorn-2.11.0.dist-info/licenses/LICENSE,sha256=HonAVvzFXkP2C1d7D3ByIKPwjGH8NcHTAQvKH7uvOHQ,1856
263
+ crypticorn-2.11.0.dist-info/METADATA,sha256=Tpe2gUY6o3_ECAirH9pyvsF5XvXk9fpIu44guCdaqFA,10146
264
+ crypticorn-2.11.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
265
+ crypticorn-2.11.0.dist-info/entry_points.txt,sha256=d_xHsGvUTebPveVUK0SrpDFQ5ZRSjlI7lNCc11sn2PM,59
266
+ crypticorn-2.11.0.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
267
+ crypticorn-2.11.0.dist-info/RECORD,,