crypticorn 2.7.4__py3-none-any.whl → 2.8.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.
Files changed (68) hide show
  1. crypticorn/__init__.py +8 -1
  2. crypticorn/auth/client/models/create_api_key_request.py +3 -1
  3. crypticorn/auth/client/models/get_api_keys200_response_inner.py +3 -1
  4. crypticorn/client.py +34 -16
  5. crypticorn/common/__init__.py +5 -1
  6. crypticorn/common/ansi_colors.py +37 -0
  7. crypticorn/common/auth.py +3 -1
  8. crypticorn/common/exceptions.py +29 -11
  9. crypticorn/common/logging.py +126 -0
  10. crypticorn/common/middleware.py +27 -0
  11. crypticorn/common/mixins.py +2 -1
  12. crypticorn/common/router/admin_router.py +100 -0
  13. crypticorn/common/router/status_router.py +24 -0
  14. crypticorn/common/scopes.py +5 -0
  15. crypticorn/hive/client/__init__.py +6 -3
  16. crypticorn/hive/client/api/__init__.py +1 -0
  17. crypticorn/hive/client/api/admin_api.py +1452 -0
  18. crypticorn/hive/client/api/models_api.py +7 -7
  19. crypticorn/hive/client/api/status_api.py +4 -231
  20. crypticorn/hive/client/models/__init__.py +5 -3
  21. crypticorn/hive/client/models/api_error_identifier.py +115 -0
  22. crypticorn/hive/client/models/api_error_level.py +37 -0
  23. crypticorn/hive/client/models/api_error_type.py +37 -0
  24. crypticorn/hive/client/models/data_info.py +27 -5
  25. crypticorn/hive/client/models/data_options.py +92 -0
  26. crypticorn/hive/client/models/exception_detail.py +6 -3
  27. crypticorn/hive/client/models/log_level.py +38 -0
  28. crypticorn/hive/client/models/model.py +3 -3
  29. crypticorn/hive/main.py +22 -3
  30. crypticorn/hive/utils.py +1 -2
  31. crypticorn/metrics/client/__init__.py +11 -0
  32. crypticorn/metrics/client/api/__init__.py +2 -0
  33. crypticorn/metrics/client/api/admin_api.py +1452 -0
  34. crypticorn/metrics/client/api/exchanges_api.py +51 -40
  35. crypticorn/metrics/client/api/indicators_api.py +49 -32
  36. crypticorn/metrics/client/api/logs_api.py +7 -7
  37. crypticorn/metrics/client/api/marketcap_api.py +28 -25
  38. crypticorn/metrics/client/api/markets_api.py +50 -278
  39. crypticorn/metrics/client/api/quote_currencies_api.py +289 -0
  40. crypticorn/metrics/client/api/status_api.py +4 -231
  41. crypticorn/metrics/client/api/tokens_api.py +241 -37
  42. crypticorn/metrics/client/models/__init__.py +9 -0
  43. crypticorn/metrics/client/models/api_error_identifier.py +115 -0
  44. crypticorn/metrics/client/models/api_error_level.py +37 -0
  45. crypticorn/metrics/client/models/api_error_type.py +37 -0
  46. crypticorn/metrics/client/models/exception_detail.py +6 -3
  47. crypticorn/metrics/client/models/exchange_mapping.py +121 -0
  48. crypticorn/metrics/client/models/internal_exchange.py +39 -0
  49. crypticorn/metrics/client/models/log_level.py +38 -0
  50. crypticorn/metrics/client/models/market_type.py +35 -0
  51. crypticorn/metrics/client/models/marketcap_ranking.py +87 -0
  52. crypticorn/metrics/client/models/ohlcv.py +113 -0
  53. crypticorn/metrics/main.py +14 -2
  54. crypticorn/pay/client/__init__.py +3 -0
  55. crypticorn/pay/client/api/__init__.py +1 -0
  56. crypticorn/pay/client/api/admin_api.py +1453 -0
  57. crypticorn/pay/client/api/status_api.py +4 -231
  58. crypticorn/pay/client/models/__init__.py +2 -0
  59. crypticorn/pay/client/models/log_level.py +38 -0
  60. crypticorn/{hive/client/models/data_value_value_value_inner.py → pay/client/models/response_getuptime.py} +36 -31
  61. crypticorn/pay/client/models/scope.py +2 -0
  62. crypticorn/pay/main.py +2 -0
  63. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/METADATA +46 -21
  64. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/RECORD +67 -44
  65. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/WHEEL +1 -1
  66. crypticorn/common/status_router.py +0 -44
  67. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/entry_points.txt +0 -0
  68. {crypticorn-2.7.4.dist-info → crypticorn-2.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,121 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from crypticorn.metrics.client.models.market_type import MarketType
23
+ from crypticorn.metrics.client.models.trading_status import TradingStatus
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class ExchangeMapping(BaseModel):
29
+ """
30
+ ExchangeMapping
31
+ """ # noqa: E501
32
+
33
+ exchange_name: StrictStr = Field(description="The name of the exchange")
34
+ symbol: StrictStr = Field(description="The symbol of the exchange")
35
+ quote_currency: StrictStr = Field(description="The quote currency of the exchange")
36
+ pair: StrictStr = Field(description="The pair of the exchange")
37
+ first_trade_timestamp: StrictInt = Field(
38
+ description="The first trade timestamp of the exchange"
39
+ )
40
+ last_trade_timestamp: StrictInt = Field(
41
+ description="The last trade timestamp of the exchange"
42
+ )
43
+ status: TradingStatus = Field(description="The status of the exchange")
44
+ market_type: Optional[MarketType] = None
45
+ __properties: ClassVar[List[str]] = [
46
+ "exchange_name",
47
+ "symbol",
48
+ "quote_currency",
49
+ "pair",
50
+ "first_trade_timestamp",
51
+ "last_trade_timestamp",
52
+ "status",
53
+ "market_type",
54
+ ]
55
+
56
+ model_config = ConfigDict(
57
+ populate_by_name=True,
58
+ validate_assignment=True,
59
+ protected_namespaces=(),
60
+ )
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict())
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of ExchangeMapping from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # set to None if market_type (nullable) is None
94
+ # and model_fields_set contains the field
95
+ if self.market_type is None and "market_type" in self.model_fields_set:
96
+ _dict["market_type"] = None
97
+
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of ExchangeMapping from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate(
110
+ {
111
+ "exchange_name": obj.get("exchange_name"),
112
+ "symbol": obj.get("symbol"),
113
+ "quote_currency": obj.get("quote_currency"),
114
+ "pair": obj.get("pair"),
115
+ "first_trade_timestamp": obj.get("first_trade_timestamp"),
116
+ "last_trade_timestamp": obj.get("last_trade_timestamp"),
117
+ "status": obj.get("status"),
118
+ "market_type": obj.get("market_type"),
119
+ }
120
+ )
121
+ return _obj
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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))
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class MarketcapRanking(BaseModel):
28
+ """
29
+ MarketcapRanking
30
+ """ # noqa: E501
31
+
32
+ timestamp: datetime
33
+ symbols: List[StrictStr]
34
+ __properties: ClassVar[List[str]] = ["timestamp", "symbols"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of MarketcapRanking from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of MarketcapRanking from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate(
85
+ {"timestamp": obj.get("timestamp"), "symbols": obj.get("symbols")}
86
+ )
87
+ return _obj
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Marketcap Service API
5
+
6
+ API for retrieving historical marketcap data, available exchanges, and indicators.
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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class OHLCV(BaseModel):
28
+ """
29
+ OHLCV
30
+ """ # noqa: E501
31
+
32
+ timestamp: datetime
33
+ open: Union[StrictFloat, StrictInt]
34
+ high: Union[StrictFloat, StrictInt]
35
+ low: Union[StrictFloat, StrictInt]
36
+ close: Union[StrictFloat, StrictInt]
37
+ volume: Union[StrictFloat, StrictInt]
38
+ marketcap: Optional[Union[StrictFloat, StrictInt]] = None
39
+ __properties: ClassVar[List[str]] = [
40
+ "timestamp",
41
+ "open",
42
+ "high",
43
+ "low",
44
+ "close",
45
+ "volume",
46
+ "marketcap",
47
+ ]
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
+ return json.dumps(self.to_dict())
63
+
64
+ @classmethod
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
66
+ """Create an instance of OHLCV from a JSON string"""
67
+ return cls.from_dict(json.loads(json_str))
68
+
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ """
79
+ excluded_fields: Set[str] = set([])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # set to None if marketcap (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.marketcap is None and "marketcap" in self.model_fields_set:
89
+ _dict["marketcap"] = None
90
+
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of OHLCV from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate(
103
+ {
104
+ "timestamp": obj.get("timestamp"),
105
+ "open": obj.get("open"),
106
+ "high": obj.get("high"),
107
+ "low": obj.get("low"),
108
+ "close": obj.get("close"),
109
+ "volume": obj.get("volume"),
110
+ "marketcap": obj.get("marketcap"),
111
+ }
112
+ )
113
+ return _obj
@@ -9,6 +9,8 @@ from crypticorn.metrics import (
9
9
  MarketcapApi,
10
10
  MarketsApi,
11
11
  TokensApi,
12
+ AdminApi,
13
+ QuoteCurrenciesApi,
12
14
  )
13
15
  from crypticorn.common import optional_import
14
16
 
@@ -34,6 +36,8 @@ class MetricsClient:
34
36
  self.markets = MarketsApi(self.base_client)
35
37
  self.tokens = TokensApiWrapper(self.base_client)
36
38
  self.exchanges = ExchangesApiWrapper(self.base_client)
39
+ self.quote_currencies = QuoteCurrenciesApi(self.base_client)
40
+ self.admin = AdminApi(self.base_client)
37
41
 
38
42
 
39
43
  class MarketcapApiWrapper(MarketcapApi):
@@ -57,12 +61,20 @@ class TokensApiWrapper(TokensApi):
57
61
  A wrapper for the TokensApi class.
58
62
  """
59
63
 
60
- async def get_stable_and_wrapped_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
64
+ async def get_stable_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
61
65
  """
62
66
  Get the tokens in a pandas dataframe
63
67
  """
64
68
  pd = optional_import("pandas", "extra")
65
- response = await self.get_stable_and_wrapped_tokens(*args, **kwargs)
69
+ response = await self.get_stable_tokens(*args, **kwargs)
70
+ return pd.DataFrame(response)
71
+
72
+ async def get_wrapped_tokens_fmt(self, *args, **kwargs) -> pd.DataFrame: # type: ignore
73
+ """
74
+ Get the wrapped tokens in a pandas dataframe
75
+ """
76
+ pd = optional_import("pandas", "extra")
77
+ response = await self.get_wrapped_tokens(*args, **kwargs)
66
78
  return pd.DataFrame(response)
67
79
 
68
80
 
@@ -17,6 +17,7 @@ Do not edit the class manually.
17
17
  __version__ = "1.0.0"
18
18
 
19
19
  # import apis into sdk package
20
+ from crypticorn.pay.client.api.admin_api import AdminApi
20
21
  from crypticorn.pay.client.api.now_payments_api import NOWPaymentsApi
21
22
  from crypticorn.pay.client.api.payments_api import PaymentsApi
22
23
  from crypticorn.pay.client.api.products_api import ProductsApi
@@ -35,6 +36,7 @@ from crypticorn.pay.client.exceptions import ApiException
35
36
 
36
37
  # import models into sdk package
37
38
  from crypticorn.pay.client.models.exception_detail import ExceptionDetail
39
+ from crypticorn.pay.client.models.log_level import LogLevel
38
40
  from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
39
41
  from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
40
42
  from crypticorn.pay.client.models.payment import Payment
@@ -44,4 +46,5 @@ from crypticorn.pay.client.models.product_read import ProductRead
44
46
  from crypticorn.pay.client.models.product_sub_read import ProductSubRead
45
47
  from crypticorn.pay.client.models.product_update import ProductUpdate
46
48
  from crypticorn.pay.client.models.provider import Provider
49
+ from crypticorn.pay.client.models.response_getuptime import ResponseGetuptime
47
50
  from crypticorn.pay.client.models.scope import Scope
@@ -1,6 +1,7 @@
1
1
  # flake8: noqa
2
2
 
3
3
  # import apis into api package
4
+ from crypticorn.pay.client.api.admin_api import AdminApi
4
5
  from crypticorn.pay.client.api.now_payments_api import NOWPaymentsApi
5
6
  from crypticorn.pay.client.api.payments_api import PaymentsApi
6
7
  from crypticorn.pay.client.api.products_api import ProductsApi