crypticorn 2.5.0rc5__py3-none-any.whl → 2.5.2__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 (144) hide show
  1. crypticorn/auth/main.py +2 -0
  2. crypticorn/client.py +60 -69
  3. crypticorn/common/__init__.py +3 -1
  4. crypticorn/common/auth.py +38 -20
  5. crypticorn/common/enums.py +4 -31
  6. crypticorn/common/errors.py +72 -17
  7. crypticorn/common/exceptions.py +29 -15
  8. crypticorn/common/mixins.py +37 -0
  9. crypticorn/common/status_router.py +42 -0
  10. crypticorn/common/urls.py +2 -1
  11. crypticorn/common/utils.py +9 -14
  12. crypticorn/hive/main.py +2 -0
  13. crypticorn/klines/client/__init__.py +10 -43
  14. crypticorn/klines/client/api/__init__.py +1 -1
  15. crypticorn/klines/client/api/change_in_timeframe_api.py +16 -31
  16. crypticorn/klines/client/api/funding_rates_api.py +8 -22
  17. crypticorn/klines/client/api/ohlcv_data_api.py +17 -38
  18. crypticorn/klines/client/api/{health_check_api.py → status_api.py} +18 -23
  19. crypticorn/klines/client/api/symbols_api.py +18 -34
  20. crypticorn/klines/client/api/udf_api.py +48 -59
  21. crypticorn/klines/client/api_client.py +1 -1
  22. crypticorn/klines/client/configuration.py +1 -1
  23. crypticorn/klines/client/exceptions.py +1 -1
  24. crypticorn/klines/client/models/__init__.py +9 -42
  25. crypticorn/klines/client/models/{change_in_timeframe_response.py → change_in_timeframe.py} +5 -5
  26. crypticorn/klines/client/models/{error_response.py → exception_detail.py} +25 -20
  27. crypticorn/klines/client/models/{funding_rate_response.py → funding_rate.py} +5 -5
  28. crypticorn/klines/client/models/{ohlcv_response.py → ohlcv_history.py} +14 -14
  29. crypticorn/klines/client/models/resolution.py +1 -1
  30. crypticorn/klines/client/models/{exchange.py → search_symbol.py} +17 -13
  31. crypticorn/klines/client/models/sort_direction.py +1 -1
  32. crypticorn/klines/client/models/{symbol_group_response.py → symbol_group.py} +5 -5
  33. crypticorn/klines/client/models/{symbol_info_response.py → symbol_info.py} +5 -5
  34. crypticorn/klines/client/models/symbol_type.py +1 -1
  35. crypticorn/klines/client/models/timeframe.py +1 -1
  36. crypticorn/klines/client/models/{udf_config_response.py → udf_config.py} +7 -19
  37. crypticorn/klines/client/rest.py +1 -1
  38. crypticorn/klines/main.py +40 -23
  39. crypticorn/metrics/client/__init__.py +3 -22
  40. crypticorn/metrics/client/api/__init__.py +1 -1
  41. crypticorn/metrics/client/api/exchanges_api.py +53 -97
  42. crypticorn/metrics/client/api/indicators_api.py +26 -52
  43. crypticorn/metrics/client/api/logs_api.py +8 -23
  44. crypticorn/metrics/client/api/marketcap_api.py +36 -88
  45. crypticorn/metrics/client/api/markets_api.py +26 -55
  46. crypticorn/metrics/client/api/{health_check_api.py → status_api.py} +18 -23
  47. crypticorn/metrics/client/api/tokens_api.py +7 -21
  48. crypticorn/metrics/client/api_client.py +1 -1
  49. crypticorn/metrics/client/configuration.py +1 -1
  50. crypticorn/metrics/client/exceptions.py +1 -1
  51. crypticorn/metrics/client/models/__init__.py +2 -21
  52. crypticorn/metrics/client/models/{error_response.py → exception_detail.py} +25 -20
  53. crypticorn/metrics/client/models/severity.py +1 -1
  54. crypticorn/metrics/client/models/time_interval.py +1 -1
  55. crypticorn/metrics/client/models/trading_status.py +1 -1
  56. crypticorn/metrics/client/rest.py +1 -1
  57. crypticorn/metrics/main.py +51 -43
  58. crypticorn/pay/main.py +2 -0
  59. crypticorn/trade/client/__init__.py +1 -5
  60. crypticorn/trade/client/api/exchanges_api.py +6 -6
  61. crypticorn/trade/client/api/trading_actions_api.py +16 -15
  62. crypticorn/trade/client/models/__init__.py +1 -5
  63. crypticorn/trade/client/models/action_model.py +1 -2
  64. crypticorn/trade/client/models/bot_model.py +3 -7
  65. crypticorn/trade/client/models/exchange_key_model.py +2 -11
  66. crypticorn/trade/client/models/execution_ids.py +1 -1
  67. crypticorn/trade/client/models/futures_trading_action.py +1 -2
  68. crypticorn/trade/client/models/notification_model.py +3 -12
  69. crypticorn/trade/client/models/order_model.py +7 -21
  70. crypticorn/trade/client/models/spot_trading_action.py +230 -0
  71. crypticorn/trade/client/models/strategy_exchange_info.py +2 -3
  72. crypticorn/trade/client/models/strategy_model_input.py +1 -2
  73. crypticorn/trade/client/models/strategy_model_output.py +1 -2
  74. crypticorn/trade/client/models/tpsl.py +3 -1
  75. crypticorn/trade/main.py +2 -0
  76. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/METADATA +7 -5
  77. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/RECORD +81 -141
  78. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/WHEEL +1 -1
  79. crypticorn/common/sorter.py +0 -40
  80. crypticorn/klines/client/models/base_response_health_check_response.py +0 -114
  81. crypticorn/klines/client/models/base_response_list_change_in_timeframe_response.py +0 -123
  82. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +0 -118
  83. crypticorn/klines/client/models/base_response_list_str.py +0 -106
  84. crypticorn/klines/client/models/base_response_ohlcv_response.py +0 -114
  85. crypticorn/klines/client/models/health_check_response.py +0 -91
  86. crypticorn/klines/client/models/history_error_response.py +0 -89
  87. crypticorn/klines/client/models/history_no_data_response.py +0 -99
  88. crypticorn/klines/client/models/history_success_response.py +0 -99
  89. crypticorn/klines/client/models/http_validation_error.py +0 -99
  90. crypticorn/klines/client/models/market.py +0 -35
  91. crypticorn/klines/client/models/market_type.py +0 -35
  92. crypticorn/klines/client/models/response_get_history_udf_history_get.py +0 -198
  93. crypticorn/klines/client/models/response_get_udf_history.py +0 -198
  94. crypticorn/klines/client/models/search_symbol_response.py +0 -104
  95. crypticorn/klines/client/models/validation_error.py +0 -105
  96. crypticorn/klines/client/models/validation_error_loc_inner.py +0 -159
  97. crypticorn/metrics/client/models/base_response_dict.py +0 -106
  98. crypticorn/metrics/client/models/base_response_health_check_response.py +0 -114
  99. crypticorn/metrics/client/models/base_response_list_dict.py +0 -106
  100. crypticorn/metrics/client/models/base_response_list_exchange_mapping.py +0 -118
  101. crypticorn/metrics/client/models/base_response_list_str.py +0 -106
  102. crypticorn/metrics/client/models/exchange_mapping.py +0 -134
  103. crypticorn/metrics/client/models/health_check_response.py +0 -91
  104. crypticorn/metrics/client/models/http_validation_error.py +0 -99
  105. crypticorn/metrics/client/models/market.py +0 -35
  106. crypticorn/metrics/client/models/market_type.py +0 -35
  107. crypticorn/metrics/client/models/validation_error.py +0 -105
  108. crypticorn/metrics/client/models/validation_error_loc_inner.py +0 -159
  109. crypticorn/pay/client/models/api_status_res.py +0 -83
  110. crypticorn/pay/client/models/body_create_now_invoice.py +0 -98
  111. crypticorn/pay/client/models/body_create_product.py +0 -98
  112. crypticorn/pay/client/models/body_get_products.py +0 -87
  113. crypticorn/pay/client/models/body_handle_now_webhook.py +0 -98
  114. crypticorn/pay/client/models/body_update_product.py +0 -98
  115. crypticorn/pay/client/models/combined_payment_history.py +0 -101
  116. crypticorn/pay/client/models/create_invoice_req.py +0 -188
  117. crypticorn/pay/client/models/create_invoice_res.py +0 -188
  118. crypticorn/pay/client/models/currency.py +0 -165
  119. crypticorn/pay/client/models/estimate_price_req.py +0 -91
  120. crypticorn/pay/client/models/estimate_price_res.py +0 -102
  121. crypticorn/pay/client/models/get_currencies_res.py +0 -99
  122. crypticorn/pay/client/models/get_payment_status_res.py +0 -222
  123. crypticorn/pay/client/models/get_payments_list_res.py +0 -109
  124. crypticorn/pay/client/models/min_amount_req.py +0 -124
  125. crypticorn/pay/client/models/min_amount_res.py +0 -105
  126. crypticorn/pay/client/models/now_fee_structure.py +0 -104
  127. crypticorn/pay/client/models/now_payment_model.py +0 -124
  128. crypticorn/pay/client/models/now_payment_status.py +0 -42
  129. crypticorn/pay/client/models/now_webhook_payload.py +0 -181
  130. crypticorn/pay/client/models/partial_product_update_model.py +0 -150
  131. crypticorn/pay/client/models/product.py +0 -87
  132. crypticorn/pay/client/models/product_model.py +0 -128
  133. crypticorn/pay/client/models/product_subs_model.py +0 -108
  134. crypticorn/pay/client/models/product_update_model.py +0 -150
  135. crypticorn/pay/client/models/unified_payment_model.py +0 -112
  136. crypticorn/trade/client/models/api_error_identifier.py +0 -104
  137. crypticorn/trade/client/models/api_error_level.py +0 -37
  138. crypticorn/trade/client/models/api_error_type.py +0 -37
  139. crypticorn/trade/client/models/api_key_model.py +0 -156
  140. crypticorn/trade/client/models/exchange.py +0 -35
  141. crypticorn/trade/client/models/market_type.py +0 -35
  142. /crypticorn/common/{pydantic.py → decorators.py} +0 -0
  143. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/entry_points.txt +0 -0
  144. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
- from enum import Enum
2
- from typing import Optional, Dict, Type, Any
1
+ from typing import Optional, Dict, Any
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
6
- from fastapi.openapi.utils import get_openapi
7
5
  from fastapi.responses import JSONResponse
8
6
  from crypticorn.common import ApiError, ApiErrorIdentifier, ApiErrorType, ApiErrorLevel
9
7
 
8
+
10
9
  class ExceptionDetail(BaseModel):
11
- '''This is the detail of the exception. It is used to enrich the exception with additional information by unwrapping the ApiError into its components.'''
10
+ """This is the detail of the exception. It is used to enrich the exception with additional information by unwrapping the ApiError into its components."""
11
+
12
12
  message: Optional[str] = Field(None, description="An additional error message")
13
13
  code: ApiErrorIdentifier = Field(..., description="The unique error code")
14
14
  type: ApiErrorType = Field(..., description="The type of error")
@@ -18,11 +18,12 @@ class ExceptionDetail(BaseModel):
18
18
 
19
19
 
20
20
  class ExceptionContent(BaseModel):
21
- '''This is the detail of the exception. Pass an ApiError to the constructor and an optional human readable message.'''
21
+ """This is the detail of the exception. Pass an ApiError to the constructor and an optional human readable message."""
22
+
22
23
  error: ApiError = Field(..., description="The unique error code")
23
24
  message: Optional[str] = Field(None, description="An additional error message")
24
25
  details: Any = Field(None, description="Additional details about the error")
25
-
26
+
26
27
  def enrich(self) -> ExceptionDetail:
27
28
  return ExceptionDetail(
28
29
  message=self.message,
@@ -33,6 +34,7 @@ class ExceptionContent(BaseModel):
33
34
  details=self.details,
34
35
  )
35
36
 
37
+
36
38
  class HTTPException(FastAPIHTTPException):
37
39
  """A custom HTTP exception wrapper around FastAPI's HTTPException.
38
40
  It allows for a more structured way to handle errors, with a message and an error code. The status code is being derived from the detail's error.
@@ -52,32 +54,44 @@ class HTTPException(FastAPIHTTPException):
52
54
  headers=headers,
53
55
  )
54
56
 
57
+
55
58
  async def general_handler(request: Request, exc: Exception):
56
- '''This is the default exception handler for all exceptions.'''
59
+ """This is the default exception handler for all exceptions."""
57
60
  body = ExceptionContent(message=str(exc), error=ApiError.UNKNOWN_ERROR)
58
- return JSONResponse(status_code=body.error.status_code, content=HTTPException(content=body).detail)
61
+ return JSONResponse(
62
+ status_code=body.error.status_code, content=HTTPException(content=body).detail
63
+ )
64
+
59
65
 
60
66
  async def request_validation_handler(request: Request, exc: RequestValidationError):
61
- '''This is the exception handler for all request validation errors.'''
67
+ """This is the exception handler for all request validation errors."""
62
68
  body = ExceptionContent(message=str(exc), error=ApiError.INVALID_DATA_REQUEST)
63
- return JSONResponse(status_code=body.error.status_code, content=HTTPException(content=body).detail)
69
+ return JSONResponse(
70
+ status_code=body.error.status_code, content=HTTPException(content=body).detail
71
+ )
72
+
64
73
 
65
74
  async def response_validation_handler(request: Request, exc: ResponseValidationError):
66
- '''This is the exception handler for all response validation errors.'''
75
+ """This is the exception handler for all response validation errors."""
67
76
  body = ExceptionContent(message=str(exc), error=ApiError.INVALID_DATA_RESPONSE)
68
- return JSONResponse(status_code=body.error.status_code, content=HTTPException(content=body).detail)
77
+ return JSONResponse(
78
+ status_code=body.error.status_code, content=HTTPException(content=body).detail
79
+ )
80
+
69
81
 
70
82
  async def http_handler(request: Request, exc: HTTPException):
71
- '''This is the exception handler for HTTPExceptions. It unwraps the HTTPException and returns the detail in a flat JSON response.'''
83
+ """This is the exception handler for HTTPExceptions. It unwraps the HTTPException and returns the detail in a flat JSON response."""
72
84
  return JSONResponse(status_code=exc.status_code, content=exc.detail)
73
85
 
86
+
74
87
  def register_exception_handlers(app: FastAPI):
75
- '''Utility to register serveral exception handlers in one go. Catches Exception, HTTPException and Data Validation errors and responds with a unified json body.'''
88
+ """Utility to register serveral exception handlers in one go. Catches Exception, HTTPException and Data Validation errors and responds with a unified json body."""
76
89
  app.add_exception_handler(Exception, general_handler)
77
90
  app.add_exception_handler(FastAPIHTTPException, http_handler)
78
91
  app.add_exception_handler(RequestValidationError, request_validation_handler)
79
92
  app.add_exception_handler(ResponseValidationError, response_validation_handler)
80
93
 
94
+
81
95
  exception_response = {
82
96
  "default": {"model": ExceptionDetail, "description": "Error response"}
83
- }
97
+ }
@@ -0,0 +1,37 @@
1
+ class ValidateEnumMixin:
2
+ """
3
+ Mixin for validating enum values manually.
4
+
5
+ ⚠️ Note:
6
+ This does NOT enforce validation automatically on enum creation.
7
+ It's up to the developer to call `Class.validate(value)` where needed.
8
+
9
+ Usage:
10
+ >>> class Color(ValidateEnumMixin, StrEnum):
11
+ >>> RED = "red"
12
+ >>> GREEN = "green"
13
+
14
+ >>> Color.validate("red") # True
15
+ >>> Color.validate("yellow") # False
16
+
17
+ Order of inheritance matters — the mixin must come first.
18
+ """
19
+
20
+ @classmethod
21
+ def validate(cls, value) -> bool:
22
+ """Validate if a value is in the enum. True if so, False otherwise."""
23
+ try:
24
+ cls(value)
25
+ return True
26
+ except ValueError:
27
+ return False
28
+
29
+
30
+ class ExcludeEnumMixin:
31
+ """Mixin to exclude enum from OpenAPI schema. We use this to avoid duplicating enums when generating client code from the openapi spec."""
32
+
33
+ @classmethod
34
+ def __get_pydantic_json_schema__(cls, core_schema, handler):
35
+ schema = handler(core_schema)
36
+ schema.pop("enum", None)
37
+ return schema
@@ -0,0 +1,42 @@
1
+ from datetime import datetime
2
+ from typing import Literal
3
+ from fastapi import APIRouter
4
+
5
+ router = APIRouter(tags=["Status"], prefix="")
6
+
7
+ @router.get("/", operation_id="ping")
8
+ async def ping() -> str:
9
+ """
10
+ Returns 'OK' if the API is running.
11
+ """
12
+ return "OK"
13
+
14
+ @router.get("/time", operation_id="getTime")
15
+ async def time(
16
+ type: Literal["iso", "unix"] = "iso"
17
+ ) -> str:
18
+ """
19
+ Returns the current time in the specified format.
20
+ """
21
+ if type == "iso":
22
+ return datetime.now().isoformat()
23
+ else:
24
+ return str(int(datetime.now().timestamp()))
25
+
26
+ @router.get("/config", operation_id="getConfig")
27
+ async def config() -> dict:
28
+ """
29
+ Returns the version of the crypticorn library and the environment.
30
+ """
31
+ import importlib.metadata
32
+ import os
33
+ from dotenv import load_dotenv
34
+ load_dotenv()
35
+ try:
36
+ crypticorn_version = importlib.metadata.version("flask")
37
+ except importlib.metadata.PackageNotFoundError:
38
+ crypticorn_version = "not installed"
39
+ return {
40
+ "crypticorn": crypticorn_version,
41
+ "environment": os.getenv("API_ENV", "not set"),
42
+ }
crypticorn/common/urls.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from enum import StrEnum
2
+ from crypticorn.common.enums import ValidateEnumMixin
2
3
 
3
4
 
4
5
  class ApiEnv(StrEnum):
@@ -30,7 +31,7 @@ class ApiVersion(StrEnum):
30
31
  V1 = "v1"
31
32
 
32
33
 
33
- class Service(StrEnum):
34
+ class Service(ValidateEnumMixin, StrEnum):
34
35
  HIVE = "hive"
35
36
  KLINES = "klines"
36
37
  PAY = "pay"
@@ -2,30 +2,22 @@ from typing import Any, Union
2
2
  from decimal import Decimal
3
3
  import string
4
4
  import random
5
-
6
- from fastapi import HTTPException
7
5
  from fastapi import status
8
6
  from typing_extensions import deprecated
9
7
 
10
- from crypticorn.common import ApiError
8
+ from crypticorn.common import ApiError, HTTPException, ExceptionContent
11
9
 
12
10
 
13
- def throw_if_none(value: Any, message: Union[ApiError, str]) -> None:
11
+ def throw_if_none(value: Any, error: ApiError = ApiError.OBJECT_NOT_FOUND) -> None:
14
12
  """Throws an FastAPI HTTPException if the value is None."""
15
13
  if value is None:
16
- raise HTTPException(
17
- status_code=status.HTTP_404_NOT_FOUND,
18
- detail=message.identifier if isinstance(message, ApiError) else message,
19
- )
14
+ raise HTTPException(content=ExceptionContent(error=error))
20
15
 
21
16
 
22
- def throw_if_falsy(value: Any, message: Union[ApiError, str]) -> None:
17
+ def throw_if_falsy(value: Any, error: ApiError = ApiError.OBJECT_NOT_FOUND) -> None:
23
18
  """Throws an FastAPI HTTPException if the value is False."""
24
19
  if not value:
25
- raise HTTPException(
26
- status_code=status.HTTP_400_BAD_REQUEST,
27
- detail=message.identifier if isinstance(message, ApiError) else message,
28
- )
20
+ raise HTTPException(content=ExceptionContent(error=error))
29
21
 
30
22
 
31
23
  def gen_random_id(length: int = 20) -> str:
@@ -56,7 +48,10 @@ def is_equal(
56
48
  )
57
49
 
58
50
 
59
- def optional_import(module_name: str, extra_name: str):
51
+ def optional_import(module_name: str, extra_name: str) -> Any:
52
+ """
53
+ Import a module optionally.
54
+ """
60
55
  try:
61
56
  return __import__(module_name)
62
57
  except ImportError as e:
crypticorn/hive/main.py CHANGED
@@ -14,6 +14,8 @@ class HiveClient:
14
14
  A client for interacting with the Crypticorn Hive API.
15
15
  """
16
16
 
17
+ config_class = Configuration
18
+
17
19
  def __init__(
18
20
  self,
19
21
  config: Configuration,
@@ -5,7 +5,7 @@
5
5
  """
6
6
  Klines Service API
7
7
 
8
- API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
8
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
9
9
 
10
10
  The version of the OpenAPI document: 1.0.0
11
11
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -19,8 +19,8 @@ __version__ = "1.0.0"
19
19
  # import apis into sdk package
20
20
  from crypticorn.klines.client.api.change_in_timeframe_api import ChangeInTimeframeApi
21
21
  from crypticorn.klines.client.api.funding_rates_api import FundingRatesApi
22
- from crypticorn.klines.client.api.health_check_api import HealthCheckApi
23
22
  from crypticorn.klines.client.api.ohlcv_data_api import OHLCVDataApi
23
+ from crypticorn.klines.client.api.status_api import StatusApi
24
24
  from crypticorn.klines.client.api.symbols_api import SymbolsApi
25
25
  from crypticorn.klines.client.api.udf_api import UDFApi
26
26
 
@@ -36,48 +36,15 @@ from crypticorn.klines.client.exceptions import ApiAttributeError
36
36
  from crypticorn.klines.client.exceptions import ApiException
37
37
 
38
38
  # import models into sdk package
39
- from crypticorn.klines.client.models.base_response_health_check_response import (
40
- BaseResponseHealthCheckResponse,
41
- )
42
- from crypticorn.klines.client.models.base_response_list_change_in_timeframe_response import (
43
- BaseResponseListChangeInTimeframeResponse,
44
- )
45
- from crypticorn.klines.client.models.base_response_list_funding_rate_response import (
46
- BaseResponseListFundingRateResponse,
47
- )
48
- from crypticorn.klines.client.models.base_response_list_str import BaseResponseListStr
49
- from crypticorn.klines.client.models.base_response_ohlcv_response import (
50
- BaseResponseOHLCVResponse,
51
- )
52
- from crypticorn.klines.client.models.change_in_timeframe_response import (
53
- ChangeInTimeframeResponse,
54
- )
55
- from crypticorn.klines.client.models.error_response import ErrorResponse
56
- from crypticorn.klines.client.models.exchange import Exchange
57
- from crypticorn.klines.client.models.funding_rate_response import FundingRateResponse
58
- from crypticorn.klines.client.models.http_validation_error import HTTPValidationError
59
- from crypticorn.klines.client.models.health_check_response import HealthCheckResponse
60
- from crypticorn.klines.client.models.history_error_response import HistoryErrorResponse
61
- from crypticorn.klines.client.models.history_no_data_response import (
62
- HistoryNoDataResponse,
63
- )
64
- from crypticorn.klines.client.models.history_success_response import (
65
- HistorySuccessResponse,
66
- )
67
- from crypticorn.klines.client.models.market_type import MarketType
68
- from crypticorn.klines.client.models.ohlcv_response import OHLCVResponse
39
+ from crypticorn.klines.client.models.change_in_timeframe import ChangeInTimeframe
40
+ from crypticorn.klines.client.models.exception_detail import ExceptionDetail
41
+ from crypticorn.klines.client.models.funding_rate import FundingRate
42
+ from crypticorn.klines.client.models.ohlcv_history import OHLCVHistory
69
43
  from crypticorn.klines.client.models.resolution import Resolution
70
- from crypticorn.klines.client.models.response_get_udf_history import (
71
- ResponseGetUdfHistory,
72
- )
73
- from crypticorn.klines.client.models.search_symbol_response import SearchSymbolResponse
44
+ from crypticorn.klines.client.models.search_symbol import SearchSymbol
74
45
  from crypticorn.klines.client.models.sort_direction import SortDirection
75
- from crypticorn.klines.client.models.symbol_group_response import SymbolGroupResponse
76
- from crypticorn.klines.client.models.symbol_info_response import SymbolInfoResponse
46
+ from crypticorn.klines.client.models.symbol_group import SymbolGroup
47
+ from crypticorn.klines.client.models.symbol_info import SymbolInfo
77
48
  from crypticorn.klines.client.models.symbol_type import SymbolType
78
49
  from crypticorn.klines.client.models.timeframe import Timeframe
79
- from crypticorn.klines.client.models.udf_config_response import UDFConfigResponse
80
- from crypticorn.klines.client.models.validation_error import ValidationError
81
- from crypticorn.klines.client.models.validation_error_loc_inner import (
82
- ValidationErrorLocInner,
83
- )
50
+ from crypticorn.klines.client.models.udf_config import UDFConfig
@@ -3,7 +3,7 @@
3
3
  # import apis into api package
4
4
  from crypticorn.klines.client.api.change_in_timeframe_api import ChangeInTimeframeApi
5
5
  from crypticorn.klines.client.api.funding_rates_api import FundingRatesApi
6
- from crypticorn.klines.client.api.health_check_api import HealthCheckApi
7
6
  from crypticorn.klines.client.api.ohlcv_data_api import OHLCVDataApi
7
+ from crypticorn.klines.client.api.status_api import StatusApi
8
8
  from crypticorn.klines.client.api.symbols_api import SymbolsApi
9
9
  from crypticorn.klines.client.api.udf_api import UDFApi
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Klines Service API
5
5
 
6
- API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -16,13 +16,10 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pydantic import Field
20
- from typing import Optional
19
+ from pydantic import Field, StrictStr
20
+ from typing import List, Optional
21
21
  from typing_extensions import Annotated
22
- from crypticorn.klines.client.models.base_response_list_change_in_timeframe_response import (
23
- BaseResponseListChangeInTimeframeResponse,
24
- )
25
- from crypticorn.klines.client.models.market_type import MarketType
22
+ from crypticorn.klines.client.models.change_in_timeframe import ChangeInTimeframe
26
23
  from crypticorn.klines.client.models.timeframe import Timeframe
27
24
 
28
25
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
@@ -46,7 +43,7 @@ class ChangeInTimeframeApi:
46
43
  async def get_change_in_timeframe(
47
44
  self,
48
45
  market: Annotated[
49
- Optional[MarketType], Field(description="Market type: 'spot' or 'futures'")
46
+ Optional[StrictStr], Field(description="Market type: 'spot' or 'futures'")
50
47
  ] = None,
51
48
  timeframe: Annotated[
52
49
  Optional[Timeframe],
@@ -63,13 +60,13 @@ class ChangeInTimeframeApi:
63
60
  _content_type: Optional[StrictStr] = None,
64
61
  _headers: Optional[Dict[StrictStr, Any]] = None,
65
62
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
66
- ) -> BaseResponseListChangeInTimeframeResponse:
63
+ ) -> List[ChangeInTimeframe]:
67
64
  """Get Change In Timeframe
68
65
 
69
66
  Retrieve price change percentage between last two completed timestamps for all pairs. Valid markets: spot, futures Valid timeframes: 15m, 30m, 1h, 4h, 1d
70
67
 
71
68
  :param market: Market type: 'spot' or 'futures'
72
- :type market: MarketType
69
+ :type market: str
73
70
  :param timeframe: Timeframe: '15m', '30m', '1h', '4h', '1d'
74
71
  :type timeframe: Timeframe
75
72
  :param _request_timeout: timeout setting for this request. If one
@@ -104,11 +101,7 @@ class ChangeInTimeframeApi:
104
101
  )
105
102
 
106
103
  _response_types_map: Dict[str, Optional[str]] = {
107
- "200": "BaseResponseListChangeInTimeframeResponse",
108
- "400": "ErrorResponse",
109
- "404": "ErrorResponse",
110
- "500": "ErrorResponse",
111
- "422": "HTTPValidationError",
104
+ "200": "List[ChangeInTimeframe]",
112
105
  }
113
106
  response_data = await self.api_client.call_api(
114
107
  *_param, _request_timeout=_request_timeout
@@ -123,7 +116,7 @@ class ChangeInTimeframeApi:
123
116
  async def get_change_in_timeframe_with_http_info(
124
117
  self,
125
118
  market: Annotated[
126
- Optional[MarketType], Field(description="Market type: 'spot' or 'futures'")
119
+ Optional[StrictStr], Field(description="Market type: 'spot' or 'futures'")
127
120
  ] = None,
128
121
  timeframe: Annotated[
129
122
  Optional[Timeframe],
@@ -140,13 +133,13 @@ class ChangeInTimeframeApi:
140
133
  _content_type: Optional[StrictStr] = None,
141
134
  _headers: Optional[Dict[StrictStr, Any]] = None,
142
135
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
143
- ) -> ApiResponse[BaseResponseListChangeInTimeframeResponse]:
136
+ ) -> ApiResponse[List[ChangeInTimeframe]]:
144
137
  """Get Change In Timeframe
145
138
 
146
139
  Retrieve price change percentage between last two completed timestamps for all pairs. Valid markets: spot, futures Valid timeframes: 15m, 30m, 1h, 4h, 1d
147
140
 
148
141
  :param market: Market type: 'spot' or 'futures'
149
- :type market: MarketType
142
+ :type market: str
150
143
  :param timeframe: Timeframe: '15m', '30m', '1h', '4h', '1d'
151
144
  :type timeframe: Timeframe
152
145
  :param _request_timeout: timeout setting for this request. If one
@@ -181,11 +174,7 @@ class ChangeInTimeframeApi:
181
174
  )
182
175
 
183
176
  _response_types_map: Dict[str, Optional[str]] = {
184
- "200": "BaseResponseListChangeInTimeframeResponse",
185
- "400": "ErrorResponse",
186
- "404": "ErrorResponse",
187
- "500": "ErrorResponse",
188
- "422": "HTTPValidationError",
177
+ "200": "List[ChangeInTimeframe]",
189
178
  }
190
179
  response_data = await self.api_client.call_api(
191
180
  *_param, _request_timeout=_request_timeout
@@ -200,7 +189,7 @@ class ChangeInTimeframeApi:
200
189
  async def get_change_in_timeframe_without_preload_content(
201
190
  self,
202
191
  market: Annotated[
203
- Optional[MarketType], Field(description="Market type: 'spot' or 'futures'")
192
+ Optional[StrictStr], Field(description="Market type: 'spot' or 'futures'")
204
193
  ] = None,
205
194
  timeframe: Annotated[
206
195
  Optional[Timeframe],
@@ -223,7 +212,7 @@ class ChangeInTimeframeApi:
223
212
  Retrieve price change percentage between last two completed timestamps for all pairs. Valid markets: spot, futures Valid timeframes: 15m, 30m, 1h, 4h, 1d
224
213
 
225
214
  :param market: Market type: 'spot' or 'futures'
226
- :type market: MarketType
215
+ :type market: str
227
216
  :param timeframe: Timeframe: '15m', '30m', '1h', '4h', '1d'
228
217
  :type timeframe: Timeframe
229
218
  :param _request_timeout: timeout setting for this request. If one
@@ -258,11 +247,7 @@ class ChangeInTimeframeApi:
258
247
  )
259
248
 
260
249
  _response_types_map: Dict[str, Optional[str]] = {
261
- "200": "BaseResponseListChangeInTimeframeResponse",
262
- "400": "ErrorResponse",
263
- "404": "ErrorResponse",
264
- "500": "ErrorResponse",
265
- "422": "HTTPValidationError",
250
+ "200": "List[ChangeInTimeframe]",
266
251
  }
267
252
  response_data = await self.api_client.call_api(
268
253
  *_param, _request_timeout=_request_timeout
@@ -296,7 +281,7 @@ class ChangeInTimeframeApi:
296
281
  # process the query parameters
297
282
  if market is not None:
298
283
 
299
- _query_params.append(("market", market.value))
284
+ _query_params.append(("market", market))
300
285
 
301
286
  if timeframe is not None:
302
287
 
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Klines Service API
5
5
 
6
- API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance.
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -17,11 +17,9 @@ from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
19
  from pydantic import Field, StrictInt, StrictStr
20
- from typing import Optional
20
+ from typing import List, Optional
21
21
  from typing_extensions import Annotated
22
- from crypticorn.klines.client.models.base_response_list_funding_rate_response import (
23
- BaseResponseListFundingRateResponse,
24
- )
22
+ from crypticorn.klines.client.models.funding_rate import FundingRate
25
23
 
26
24
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
27
25
  from crypticorn.klines.client.api_response import ApiResponse
@@ -67,7 +65,7 @@ class FundingRatesApi:
67
65
  _content_type: Optional[StrictStr] = None,
68
66
  _headers: Optional[Dict[StrictStr, Any]] = None,
69
67
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
70
- ) -> BaseResponseListFundingRateResponse:
68
+ ) -> List[FundingRate]:
71
69
  """Funding Rate
72
70
 
73
71
  Retrieve funding rate data for a specific symbol in the futures market.
@@ -114,11 +112,7 @@ class FundingRatesApi:
114
112
  )
115
113
 
116
114
  _response_types_map: Dict[str, Optional[str]] = {
117
- "200": "BaseResponseListFundingRateResponse",
118
- "400": "ErrorResponse",
119
- "404": "ErrorResponse",
120
- "500": "ErrorResponse",
121
- "422": "HTTPValidationError",
115
+ "200": "List[FundingRate]",
122
116
  }
123
117
  response_data = await self.api_client.call_api(
124
118
  *_param, _request_timeout=_request_timeout
@@ -156,7 +150,7 @@ class FundingRatesApi:
156
150
  _content_type: Optional[StrictStr] = None,
157
151
  _headers: Optional[Dict[StrictStr, Any]] = None,
158
152
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
159
- ) -> ApiResponse[BaseResponseListFundingRateResponse]:
153
+ ) -> ApiResponse[List[FundingRate]]:
160
154
  """Funding Rate
161
155
 
162
156
  Retrieve funding rate data for a specific symbol in the futures market.
@@ -203,11 +197,7 @@ class FundingRatesApi:
203
197
  )
204
198
 
205
199
  _response_types_map: Dict[str, Optional[str]] = {
206
- "200": "BaseResponseListFundingRateResponse",
207
- "400": "ErrorResponse",
208
- "404": "ErrorResponse",
209
- "500": "ErrorResponse",
210
- "422": "HTTPValidationError",
200
+ "200": "List[FundingRate]",
211
201
  }
212
202
  response_data = await self.api_client.call_api(
213
203
  *_param, _request_timeout=_request_timeout
@@ -292,11 +282,7 @@ class FundingRatesApi:
292
282
  )
293
283
 
294
284
  _response_types_map: Dict[str, Optional[str]] = {
295
- "200": "BaseResponseListFundingRateResponse",
296
- "400": "ErrorResponse",
297
- "404": "ErrorResponse",
298
- "500": "ErrorResponse",
299
- "422": "HTTPValidationError",
285
+ "200": "List[FundingRate]",
300
286
  }
301
287
  response_data = await self.api_client.call_api(
302
288
  *_param, _request_timeout=_request_timeout