crypticorn 2.8.0rc7__py3-none-any.whl → 2.8.1__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 (59) hide show
  1. crypticorn/__init__.py +1 -1
  2. crypticorn/cli/init.py +2 -2
  3. crypticorn/common/exceptions.py +5 -4
  4. crypticorn/common/logging.py +13 -4
  5. crypticorn/common/middleware.py +2 -3
  6. crypticorn/common/router/admin_router.py +10 -12
  7. crypticorn/common/router/status_router.py +2 -2
  8. crypticorn/hive/utils.py +1 -2
  9. crypticorn/klines/client/__init__.py +9 -1
  10. crypticorn/klines/client/api/__init__.py +1 -0
  11. crypticorn/klines/client/api/admin_api.py +1455 -0
  12. crypticorn/klines/client/api/change_in_timeframe_api.py +24 -20
  13. crypticorn/klines/client/api/funding_rates_api.py +12 -10
  14. crypticorn/klines/client/api/ohlcv_data_api.py +37 -24
  15. crypticorn/klines/client/api/status_api.py +8 -235
  16. crypticorn/klines/client/api/symbols_api.py +12 -9
  17. crypticorn/klines/client/api/udf_api.py +6 -6
  18. crypticorn/klines/client/models/__init__.py +8 -1
  19. crypticorn/klines/client/models/api_error_identifier.py +115 -0
  20. crypticorn/klines/client/models/api_error_level.py +37 -0
  21. crypticorn/klines/client/models/api_error_type.py +37 -0
  22. crypticorn/klines/client/models/exception_detail.py +6 -3
  23. crypticorn/klines/client/models/funding_rate.py +6 -12
  24. crypticorn/klines/client/models/funding_rate_response.py +103 -0
  25. crypticorn/klines/client/models/internal_exchange.py +39 -0
  26. crypticorn/klines/client/models/log_level.py +38 -0
  27. crypticorn/klines/client/models/market_type.py +35 -0
  28. crypticorn/klines/client/models/{ohlcv_history.py → ohlcv.py} +12 -13
  29. crypticorn/klines/client/models/search_symbol.py +3 -4
  30. crypticorn/klines/client/models/udf_config.py +2 -1
  31. crypticorn/klines/main.py +1 -13
  32. crypticorn/metrics/client/__init__.py +11 -0
  33. crypticorn/metrics/client/api/__init__.py +2 -0
  34. crypticorn/metrics/client/api/admin_api.py +1452 -0
  35. crypticorn/metrics/client/api/exchanges_api.py +51 -40
  36. crypticorn/metrics/client/api/indicators_api.py +49 -32
  37. crypticorn/metrics/client/api/logs_api.py +7 -7
  38. crypticorn/metrics/client/api/marketcap_api.py +28 -25
  39. crypticorn/metrics/client/api/markets_api.py +50 -278
  40. crypticorn/metrics/client/api/quote_currencies_api.py +289 -0
  41. crypticorn/metrics/client/api/status_api.py +4 -231
  42. crypticorn/metrics/client/api/tokens_api.py +241 -37
  43. crypticorn/metrics/client/models/__init__.py +9 -0
  44. crypticorn/metrics/client/models/api_error_identifier.py +115 -0
  45. crypticorn/metrics/client/models/api_error_level.py +37 -0
  46. crypticorn/metrics/client/models/api_error_type.py +37 -0
  47. crypticorn/metrics/client/models/exception_detail.py +6 -3
  48. crypticorn/metrics/client/models/exchange_mapping.py +121 -0
  49. crypticorn/metrics/client/models/internal_exchange.py +39 -0
  50. crypticorn/metrics/client/models/log_level.py +38 -0
  51. crypticorn/metrics/client/models/market_type.py +35 -0
  52. crypticorn/metrics/client/models/marketcap_ranking.py +87 -0
  53. crypticorn/metrics/client/models/ohlcv.py +113 -0
  54. crypticorn/metrics/main.py +14 -2
  55. {crypticorn-2.8.0rc7.dist-info → crypticorn-2.8.1.dist-info}/METADATA +3 -2
  56. {crypticorn-2.8.0rc7.dist-info → crypticorn-2.8.1.dist-info}/RECORD +59 -40
  57. {crypticorn-2.8.0rc7.dist-info → crypticorn-2.8.1.dist-info}/WHEEL +0 -0
  58. {crypticorn-2.8.0rc7.dist-info → crypticorn-2.8.1.dist-info}/entry_points.txt +0 -0
  59. {crypticorn-2.8.0rc7.dist-info → crypticorn-2.8.1.dist-info}/top_level.txt +0 -0
@@ -17,8 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
22
21
  from typing import Any, ClassVar, Dict, List, Union
23
22
  from typing import Optional, Set
24
23
  from typing_extensions import Self
@@ -26,13 +25,12 @@ from typing_extensions import Self
26
25
 
27
26
  class FundingRate(BaseModel):
28
27
  """
29
- FundingRate
28
+ Model for a single funding rate
30
29
  """ # noqa: E501
31
30
 
32
- symbol: StrictStr
33
- timestamp: datetime
34
- funding_rate: Union[StrictFloat, StrictInt]
35
- __properties: ClassVar[List[str]] = ["symbol", "timestamp", "funding_rate"]
31
+ timestamp: StrictInt = Field(description="The timestamp of the funding rate")
32
+ funding_rate: Union[StrictFloat, StrictInt] = Field(description="The funding rate")
33
+ __properties: ClassVar[List[str]] = ["timestamp", "funding_rate"]
36
34
 
37
35
  model_config = ConfigDict(
38
36
  populate_by_name=True,
@@ -83,10 +81,6 @@ class FundingRate(BaseModel):
83
81
  return cls.model_validate(obj)
84
82
 
85
83
  _obj = cls.model_validate(
86
- {
87
- "symbol": obj.get("symbol"),
88
- "timestamp": obj.get("timestamp"),
89
- "funding_rate": obj.get("funding_rate"),
90
- }
84
+ {"timestamp": obj.get("timestamp"), "funding_rate": obj.get("funding_rate")}
91
85
  )
92
86
  return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.klines.client.models.funding_rate import FundingRate
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class FundingRateResponse(BaseModel):
28
+ """
29
+ Response model for fetching funding rates
30
+ """ # noqa: E501
31
+
32
+ symbol: StrictStr = Field(description="The symbol of the funding rate")
33
+ funding_interval: StrictStr = Field(description="The funding interval")
34
+ funding_rates: List[FundingRate] = Field(description="The funding rates")
35
+ __properties: ClassVar[List[str]] = ["symbol", "funding_interval", "funding_rates"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of FundingRateResponse from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in funding_rates (list)
75
+ _items = []
76
+ if self.funding_rates:
77
+ for _item_funding_rates in self.funding_rates:
78
+ if _item_funding_rates:
79
+ _items.append(_item_funding_rates.to_dict())
80
+ _dict["funding_rates"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of FundingRateResponse from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "symbol": obj.get("symbol"),
95
+ "funding_interval": obj.get("funding_interval"),
96
+ "funding_rates": (
97
+ [FundingRate.from_dict(_item) for _item in obj["funding_rates"]]
98
+ if obj.get("funding_rates") is not None
99
+ else None
100
+ ),
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class InternalExchange(str, Enum):
22
+ """
23
+ All exchanges we are using, including public (Exchange)
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ KUCOIN = "kucoin"
30
+ BINGX = "bingx"
31
+ BINANCE = "binance"
32
+ BYBIT = "bybit"
33
+ HYPERLIQUID = "hyperliquid"
34
+ BITGET = "bitget"
35
+
36
+ @classmethod
37
+ def from_json(cls, json_str: str) -> Self:
38
+ """Create an instance of InternalExchange from a JSON string"""
39
+ return cls(json.loads(json_str))
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class LogLevel(str, Enum):
22
+ """
23
+ LogLevel
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ DEBUG = "DEBUG"
30
+ INFO = "INFO"
31
+ WARNING = "WARNING"
32
+ ERROR = "ERROR"
33
+ CRITICAL = "CRITICAL"
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of LogLevel from a JSON string"""
38
+ return cls(json.loads(json_str))
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class MarketType(str, Enum):
22
+ """
23
+ Market types
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ SPOT = "spot"
30
+ FUTURES = "futures"
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> Self:
34
+ """Create an instance of MarketType from a JSON string"""
35
+ return cls(json.loads(json_str))
@@ -17,26 +17,25 @@ 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, Field, StrictFloat, StrictInt
22
21
  from typing import Any, ClassVar, Dict, List, Union
23
22
  from typing import Optional, Set
24
23
  from typing_extensions import Self
25
24
 
26
25
 
27
- class OHLCVHistory(BaseModel):
26
+ class OHLCV(BaseModel):
28
27
  """
29
- OHLCVHistory
28
+ OHLCV
30
29
  """ # noqa: E501
31
30
 
32
- timestamps: List[datetime] = Field(description="Timestamps in seconds")
33
- open: List[Union[StrictFloat, StrictInt]] = Field(description="Open prices")
34
- high: List[Union[StrictFloat, StrictInt]] = Field(description="High prices")
35
- low: List[Union[StrictFloat, StrictInt]] = Field(description="Low prices")
36
- close: List[Union[StrictFloat, StrictInt]] = Field(description="Close prices")
37
- volume: List[Union[StrictFloat, StrictInt]] = Field(description="Volume")
31
+ timestamp: StrictInt = Field(description="Timestamp in seconds")
32
+ open: Union[StrictFloat, StrictInt] = Field(description="Open prices")
33
+ high: Union[StrictFloat, StrictInt] = Field(description="High prices")
34
+ low: Union[StrictFloat, StrictInt] = Field(description="Low prices")
35
+ close: Union[StrictFloat, StrictInt] = Field(description="Close prices")
36
+ volume: Union[StrictFloat, StrictInt] = Field(description="Volume")
38
37
  __properties: ClassVar[List[str]] = [
39
- "timestamps",
38
+ "timestamp",
40
39
  "open",
41
40
  "high",
42
41
  "low",
@@ -61,7 +60,7 @@ class OHLCVHistory(BaseModel):
61
60
 
62
61
  @classmethod
63
62
  def from_json(cls, json_str: str) -> Optional[Self]:
64
- """Create an instance of OHLCVHistory from a JSON string"""
63
+ """Create an instance of OHLCV from a JSON string"""
65
64
  return cls.from_dict(json.loads(json_str))
66
65
 
67
66
  def to_dict(self) -> Dict[str, Any]:
@@ -85,7 +84,7 @@ class OHLCVHistory(BaseModel):
85
84
 
86
85
  @classmethod
87
86
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
- """Create an instance of OHLCVHistory from a dict"""
87
+ """Create an instance of OHLCV from a dict"""
89
88
  if obj is None:
90
89
  return None
91
90
 
@@ -94,7 +93,7 @@ class OHLCVHistory(BaseModel):
94
93
 
95
94
  _obj = cls.model_validate(
96
95
  {
97
- "timestamps": obj.get("timestamps"),
96
+ "timestamp": obj.get("timestamp"),
98
97
  "open": obj.get("open"),
99
98
  "high": obj.get("high"),
100
99
  "low": obj.get("low"),
@@ -17,8 +17,9 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.klines.client.models.internal_exchange import InternalExchange
22
23
  from typing import Optional, Set
23
24
  from typing_extensions import Self
24
25
 
@@ -30,9 +31,7 @@ class SearchSymbol(BaseModel):
30
31
 
31
32
  symbol: StrictStr
32
33
  description: StrictStr
33
- exchange: StrictStr = Field(
34
- description="All exchanges we are using, including public (Exchange)"
35
- )
34
+ exchange: InternalExchange
36
35
  type: StrictStr
37
36
  __properties: ClassVar[List[str]] = ["symbol", "description", "exchange", "type"]
38
37
 
@@ -19,6 +19,7 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
+ from crypticorn.klines.client.models.internal_exchange import InternalExchange
22
23
  from crypticorn.klines.client.models.symbol_type import SymbolType
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
@@ -35,7 +36,7 @@ class UDFConfig(BaseModel):
35
36
  supports_search: Optional[StrictBool] = True
36
37
  supports_timescale_marks: Optional[StrictBool] = False
37
38
  supports_time: Optional[StrictBool] = True
38
- exchanges: List[StrictStr]
39
+ exchanges: List[InternalExchange]
39
40
  symbols_types: List[SymbolType]
40
41
  currency_codes: List[StrictStr]
41
42
  supported_markets: List[StrictStr]
crypticorn/klines/main.py CHANGED
@@ -65,19 +65,7 @@ class OHLCVDataApiWrapper(OHLCVDataApi):
65
65
  """
66
66
  pd = optional_import("pandas", "extra")
67
67
  response = await self.get_ohlcv(*args, **kwargs)
68
- df = pd.DataFrame(
69
- {
70
- "timestamp": [int(d.timestamp()) for d in response.timestamps],
71
- "open": response.open,
72
- "high": response.high,
73
- "low": response.low,
74
- "close": response.close,
75
- "volume": response.volume,
76
- }
77
- )
78
- df.sort_values(by="timestamp", ascending=False, inplace=True)
79
- df.reset_index(drop=True, inplace=True)
80
- return df
68
+ return pd.DataFrame(response)
81
69
 
82
70
 
83
71
  class SymbolsApiWrapper(SymbolsApi):
@@ -17,11 +17,13 @@ Do not edit the class manually.
17
17
  __version__ = "1.0.0"
18
18
 
19
19
  # import apis into sdk package
20
+ from crypticorn.metrics.client.api.admin_api import AdminApi
20
21
  from crypticorn.metrics.client.api.exchanges_api import ExchangesApi
21
22
  from crypticorn.metrics.client.api.indicators_api import IndicatorsApi
22
23
  from crypticorn.metrics.client.api.logs_api import LogsApi
23
24
  from crypticorn.metrics.client.api.marketcap_api import MarketcapApi
24
25
  from crypticorn.metrics.client.api.markets_api import MarketsApi
26
+ from crypticorn.metrics.client.api.quote_currencies_api import QuoteCurrenciesApi
25
27
  from crypticorn.metrics.client.api.status_api import StatusApi
26
28
  from crypticorn.metrics.client.api.tokens_api import TokensApi
27
29
 
@@ -37,7 +39,16 @@ from crypticorn.metrics.client.exceptions import ApiAttributeError
37
39
  from crypticorn.metrics.client.exceptions import ApiException
38
40
 
39
41
  # import models into sdk package
42
+ from crypticorn.metrics.client.models.api_error_identifier import ApiErrorIdentifier
43
+ from crypticorn.metrics.client.models.api_error_level import ApiErrorLevel
44
+ from crypticorn.metrics.client.models.api_error_type import ApiErrorType
40
45
  from crypticorn.metrics.client.models.exception_detail import ExceptionDetail
46
+ from crypticorn.metrics.client.models.exchange_mapping import ExchangeMapping
47
+ from crypticorn.metrics.client.models.internal_exchange import InternalExchange
48
+ from crypticorn.metrics.client.models.log_level import LogLevel
49
+ from crypticorn.metrics.client.models.market_type import MarketType
50
+ from crypticorn.metrics.client.models.marketcap_ranking import MarketcapRanking
51
+ from crypticorn.metrics.client.models.ohlcv import OHLCV
41
52
  from crypticorn.metrics.client.models.severity import Severity
42
53
  from crypticorn.metrics.client.models.time_interval import TimeInterval
43
54
  from crypticorn.metrics.client.models.trading_status import TradingStatus
@@ -1,10 +1,12 @@
1
1
  # flake8: noqa
2
2
 
3
3
  # import apis into api package
4
+ from crypticorn.metrics.client.api.admin_api import AdminApi
4
5
  from crypticorn.metrics.client.api.exchanges_api import ExchangesApi
5
6
  from crypticorn.metrics.client.api.indicators_api import IndicatorsApi
6
7
  from crypticorn.metrics.client.api.logs_api import LogsApi
7
8
  from crypticorn.metrics.client.api.marketcap_api import MarketcapApi
8
9
  from crypticorn.metrics.client.api.markets_api import MarketsApi
10
+ from crypticorn.metrics.client.api.quote_currencies_api import QuoteCurrenciesApi
9
11
  from crypticorn.metrics.client.api.status_api import StatusApi
10
12
  from crypticorn.metrics.client.api.tokens_api import TokensApi