crypticorn 2.17.0rc4__py3-none-any.whl → 2.17.0rc6__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 (151) hide show
  1. crypticorn/auth/client/api/admin_api.py +6 -26
  2. crypticorn/auth/client/api/auth_api.py +36 -148
  3. crypticorn/auth/client/api/service_api.py +3 -16
  4. crypticorn/auth/client/api/user_api.py +33 -136
  5. crypticorn/auth/client/api/wallet_api.py +18 -76
  6. crypticorn/auth/client/api_client.py +0 -5
  7. crypticorn/auth/client/models/add_wallet_request.py +1 -1
  8. crypticorn/auth/client/models/authorize_user_request.py +1 -1
  9. crypticorn/auth/client/models/create_api_key_request.py +1 -1
  10. crypticorn/auth/client/models/create_user_request.py +1 -1
  11. crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
  12. crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
  13. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
  14. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
  15. crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
  16. crypticorn/auth/client/models/logout_default_response.py +1 -1
  17. crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
  18. crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
  19. crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
  20. crypticorn/auth/client/models/token_info200_response.py +1 -1
  21. crypticorn/auth/client/models/update_user_request.py +1 -1
  22. crypticorn/auth/client/models/user_by_username200_response.py +1 -1
  23. crypticorn/auth/client/models/verify200_response.py +1 -1
  24. crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
  25. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
  26. crypticorn/auth/client/models/whoami200_response.py +1 -1
  27. crypticorn/cli/init.py +1 -1
  28. crypticorn/cli/templates/.env.docker.temp +3 -0
  29. crypticorn/cli/templates/.env.example.temp +4 -0
  30. crypticorn/cli/templates/Dockerfile +5 -2
  31. crypticorn/client.py +0 -1
  32. crypticorn/common/auth.py +31 -4
  33. crypticorn/common/decorators.py +1 -2
  34. crypticorn/common/enums.py +0 -2
  35. crypticorn/common/errors.py +10 -0
  36. crypticorn/common/metrics.py +1 -1
  37. crypticorn/common/middleware.py +0 -1
  38. crypticorn/common/pagination.py +116 -24
  39. crypticorn/common/router/admin_router.py +1 -11
  40. crypticorn/common/router/status_router.py +33 -2
  41. crypticorn/common/scopes.py +2 -2
  42. crypticorn/common/utils.py +1 -2
  43. crypticorn/dex/__init__.py +6 -0
  44. crypticorn/dex/client/__init__.py +49 -0
  45. crypticorn/dex/client/api/__init__.py +6 -0
  46. crypticorn/dex/client/api/admin_api.py +2983 -0
  47. crypticorn/dex/client/api/signals_api.py +1794 -0
  48. crypticorn/dex/client/api/status_api.py +889 -0
  49. crypticorn/dex/client/api_client.py +753 -0
  50. crypticorn/dex/client/api_response.py +20 -0
  51. crypticorn/dex/client/configuration.py +620 -0
  52. crypticorn/dex/client/exceptions.py +220 -0
  53. crypticorn/dex/client/models/__init__.py +30 -0
  54. crypticorn/dex/client/models/api_error_identifier.py +121 -0
  55. crypticorn/dex/client/models/api_error_level.py +37 -0
  56. crypticorn/dex/client/models/api_error_type.py +37 -0
  57. crypticorn/dex/client/models/exception_detail.py +117 -0
  58. crypticorn/dex/client/models/log_level.py +38 -0
  59. crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
  60. crypticorn/dex/client/models/risk.py +86 -0
  61. crypticorn/dex/client/models/signal_overview_stats.py +156 -0
  62. crypticorn/dex/client/models/signal_volume.py +84 -0
  63. crypticorn/dex/client/models/signal_with_token.py +163 -0
  64. crypticorn/dex/client/models/token_data.py +127 -0
  65. crypticorn/dex/client/models/token_detail.py +116 -0
  66. crypticorn/dex/client/py.typed +0 -0
  67. crypticorn/dex/client/rest.py +217 -0
  68. crypticorn/dex/main.py +1 -0
  69. crypticorn/hive/client/api/admin_api.py +18 -75
  70. crypticorn/hive/client/api/data_api.py +6 -28
  71. crypticorn/hive/client/api/models_api.py +22 -88
  72. crypticorn/hive/client/api/status_api.py +6 -27
  73. crypticorn/hive/client/api_client.py +0 -5
  74. crypticorn/hive/client/models/coin_info.py +1 -1
  75. crypticorn/hive/client/models/exception_detail.py +1 -1
  76. crypticorn/hive/client/models/target_info.py +1 -1
  77. crypticorn/hive/utils.py +2 -2
  78. crypticorn/klines/client/api/admin_api.py +18 -75
  79. crypticorn/klines/client/api/change_in_timeframe_api.py +3 -16
  80. crypticorn/klines/client/api/funding_rates_api.py +3 -16
  81. crypticorn/klines/client/api/ohlcv_data_api.py +3 -16
  82. crypticorn/klines/client/api/status_api.py +6 -27
  83. crypticorn/klines/client/api/symbols_api.py +3 -16
  84. crypticorn/klines/client/api/udf_api.py +18 -74
  85. crypticorn/klines/client/api_client.py +0 -5
  86. crypticorn/klines/client/models/exception_detail.py +1 -1
  87. crypticorn/klines/client/models/ohlcv.py +1 -1
  88. crypticorn/klines/client/models/symbol_group.py +1 -1
  89. crypticorn/klines/client/models/udf_config.py +1 -1
  90. crypticorn/metrics/client/api/admin_api.py +18 -75
  91. crypticorn/metrics/client/api/exchanges_api.py +12 -52
  92. crypticorn/metrics/client/api/indicators_api.py +6 -28
  93. crypticorn/metrics/client/api/logs_api.py +3 -16
  94. crypticorn/metrics/client/api/marketcap_api.py +12 -52
  95. crypticorn/metrics/client/api/markets_api.py +3 -16
  96. crypticorn/metrics/client/api/quote_currencies_api.py +3 -16
  97. crypticorn/metrics/client/api/status_api.py +6 -27
  98. crypticorn/metrics/client/api/tokens_api.py +6 -26
  99. crypticorn/metrics/client/api_client.py +0 -5
  100. crypticorn/metrics/client/models/exception_detail.py +1 -1
  101. crypticorn/metrics/client/models/exchange_mapping.py +1 -1
  102. crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
  103. crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
  104. crypticorn/metrics/client/models/ohlcv.py +1 -1
  105. crypticorn/pay/client/api/admin_api.py +21 -87
  106. crypticorn/pay/client/api/now_payments_api.py +15 -64
  107. crypticorn/pay/client/api/payments_api.py +6 -28
  108. crypticorn/pay/client/api/products_api.py +12 -52
  109. crypticorn/pay/client/api/status_api.py +6 -27
  110. crypticorn/pay/client/api_client.py +0 -5
  111. crypticorn/pay/client/models/exception_detail.py +1 -1
  112. crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
  113. crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
  114. crypticorn/pay/client/models/product.py +1 -1
  115. crypticorn/pay/client/models/product_create.py +1 -1
  116. crypticorn/pay/client/models/product_update.py +1 -1
  117. crypticorn/trade/client/__init__.py +15 -0
  118. crypticorn/trade/client/api/admin_api.py +43 -107
  119. crypticorn/trade/client/api/api_keys_api.py +207 -184
  120. crypticorn/trade/client/api/bots_api.py +6557 -240
  121. crypticorn/trade/client/api/exchanges_api.py +9 -36
  122. crypticorn/trade/client/api/notifications_api.py +18 -72
  123. crypticorn/trade/client/api/orders_api.py +220 -115
  124. crypticorn/trade/client/api/status_api.py +6 -24
  125. crypticorn/trade/client/api/strategies_api.py +15 -60
  126. crypticorn/trade/client/api/trading_actions_api.py +431 -112
  127. crypticorn/trade/client/models/__init__.py +15 -0
  128. crypticorn/trade/client/models/bot.py +7 -18
  129. crypticorn/trade/client/models/bot_create.py +17 -1
  130. crypticorn/trade/client/models/bot_update.py +17 -1
  131. crypticorn/trade/client/models/exchange_key_create.py +17 -1
  132. crypticorn/trade/client/models/exchange_key_update.py +17 -1
  133. crypticorn/trade/client/models/notification.py +17 -1
  134. crypticorn/trade/client/models/notification_create.py +17 -1
  135. crypticorn/trade/client/models/notification_update.py +17 -1
  136. crypticorn/trade/client/models/orders_count.py +88 -0
  137. crypticorn/trade/client/models/paginated_response_futures_trading_action.py +134 -0
  138. crypticorn/trade/client/models/paginated_response_order.py +134 -0
  139. crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action.py +141 -0
  140. crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action_data_inner.py +165 -0
  141. crypticorn/trade/client/models/pn_l.py +95 -0
  142. crypticorn/trade/client/models/spot_trading_action.py +207 -0
  143. crypticorn/trade/client/models/strategy.py +17 -1
  144. crypticorn/trade/client/models/strategy_create.py +17 -1
  145. crypticorn/trade/client/models/strategy_update.py +17 -1
  146. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/METADATA +3 -3
  147. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/RECORD +151 -116
  148. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/WHEEL +0 -0
  149. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/entry_points.txt +0 -0
  150. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/licenses/LICENSE +0 -0
  151. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/top_level.txt +0 -0
@@ -2,14 +2,36 @@
2
2
  This module contains the status router for the API.
3
3
  It provides endpoints for checking the status of the API and get the server's time.
4
4
  SHOULD ALLOW ACCESS TO THIS ROUTER WITHOUT AUTH.
5
+ To enable metrics, pass enable_metrics=True and the auth_handler to the router.
6
+ >>> status_router.enable_metrics = True
7
+ >>> status_router.auth_handler = auth_handler
8
+ Then include the router in the FastAPI app.
5
9
  >>> app.include_router(status_router)
6
10
  """
7
11
 
8
12
  from datetime import datetime
9
- from typing import Literal
10
13
  from fastapi import APIRouter, Request
14
+ from typing import Annotated, Literal
15
+ from fastapi import APIRouter, Response, Depends
16
+ from prometheus_client import generate_latest, CONTENT_TYPE_LATEST
17
+ from crypticorn.common.metrics import registry
18
+ from crypticorn.common.auth import AuthHandler, basic_auth
11
19
 
12
- router = APIRouter(tags=["Status"], prefix="")
20
+ class EnhancedApiRouter(APIRouter):
21
+ def __init__(self, enable_metrics: bool = False, auth_handler: AuthHandler = None, *args, **kwargs):
22
+ """
23
+ Enhanced API Router that allows for metrics and authentication.
24
+ If enable_metrics is True, the router will include the metrics endpoint.
25
+ If auth_handler is provided, the router will use the auth handler to authenticate requests with
26
+ """
27
+ super().__init__(*args, **kwargs)
28
+ self.enable_metrics = enable_metrics
29
+ self.auth_handler = auth_handler
30
+
31
+ if self.enable_metrics and not self.auth_handler:
32
+ raise ValueError("auth_handler must be provided if enable_metrics is True")
33
+
34
+ router = EnhancedApiRouter(tags=["Status"], prefix="", enable_metrics=False, auth_handler=None)
13
35
 
14
36
 
15
37
  @router.get("/", operation_id="ping")
@@ -29,3 +51,12 @@ async def time(type: Literal["iso", "unix"] = "iso") -> str:
29
51
  return datetime.now().isoformat()
30
52
  elif type == "unix":
31
53
  return str(int(datetime.now().timestamp()))
54
+
55
+
56
+ @router.get("/metrics", operation_id="getMetrics", include_in_schema=router.enable_metrics)
57
+ def metrics(username: Annotated[str, Depends(basic_auth)]):
58
+ """
59
+ Get Prometheus metrics for the application. Returns plain text.
60
+ """
61
+ return Response(generate_latest(registry), media_type=CONTENT_TYPE_LATEST)
62
+
@@ -16,7 +16,7 @@ class Scope(StrEnum):
16
16
 
17
17
  # Scopes that can be purchased - these actually exist in the jwt token
18
18
  READ_PREDICTIONS = "read:predictions"
19
- READ_DEXSIGNALS = "read:dexsignals"
19
+ READ_DEX_SIGNALS = "read:dex:signals"
20
20
 
21
21
  # Hive scopes
22
22
  READ_HIVE_MODEL = "read:hive:model"
@@ -88,5 +88,5 @@ class Scope(StrEnum):
88
88
  cls.READ_METRICS_MARKETS,
89
89
  cls.READ_KLINES,
90
90
  cls.READ_SENTIMENT,
91
- cls.READ_DEXSIGNALS,
91
+ cls.READ_DEX_SIGNALS,
92
92
  ]
@@ -1,11 +1,10 @@
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, Type, Union
4
+ from typing import Any, Union
5
5
  from decimal import Decimal
6
6
  import string
7
7
  import random
8
- from pydantic import BaseModel
9
8
  import typing_extensions
10
9
  import warnings
11
10
 
@@ -0,0 +1,6 @@
1
+ from crypticorn.dex.client import *
2
+ from crypticorn.dex.main import DexClient
3
+
4
+ __all__ = [
5
+ "DexClient",
6
+ ]
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ DEX AI API
7
+
8
+ API for DEX AI
9
+
10
+ The version of the OpenAPI document: 1.0.0
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
+
13
+ Do not edit the class manually.
14
+ """ # noqa: E501
15
+
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ # import apis into sdk package
20
+ from crypticorn.dex.client.api.admin_api import AdminApi
21
+ from crypticorn.dex.client.api.signals_api import SignalsApi
22
+ from crypticorn.dex.client.api.status_api import StatusApi
23
+
24
+ # import ApiClient
25
+ from crypticorn.dex.client.api_response import ApiResponse
26
+ from crypticorn.dex.client.api_client import ApiClient
27
+ from crypticorn.dex.client.configuration import Configuration
28
+ from crypticorn.dex.client.exceptions import OpenApiException
29
+ from crypticorn.dex.client.exceptions import ApiTypeError
30
+ from crypticorn.dex.client.exceptions import ApiValueError
31
+ from crypticorn.dex.client.exceptions import ApiKeyError
32
+ from crypticorn.dex.client.exceptions import ApiAttributeError
33
+ from crypticorn.dex.client.exceptions import ApiException
34
+
35
+ # import models into sdk package
36
+ from crypticorn.dex.client.models.api_error_identifier import ApiErrorIdentifier
37
+ from crypticorn.dex.client.models.api_error_level import ApiErrorLevel
38
+ from crypticorn.dex.client.models.api_error_type import ApiErrorType
39
+ from crypticorn.dex.client.models.exception_detail import ExceptionDetail
40
+ from crypticorn.dex.client.models.log_level import LogLevel
41
+ from crypticorn.dex.client.models.paginated_response_signal_with_token import (
42
+ PaginatedResponseSignalWithToken,
43
+ )
44
+ from crypticorn.dex.client.models.risk import Risk
45
+ from crypticorn.dex.client.models.signal_overview_stats import SignalOverviewStats
46
+ from crypticorn.dex.client.models.signal_volume import SignalVolume
47
+ from crypticorn.dex.client.models.signal_with_token import SignalWithToken
48
+ from crypticorn.dex.client.models.token_data import TokenData
49
+ from crypticorn.dex.client.models.token_detail import TokenDetail
@@ -0,0 +1,6 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from crypticorn.dex.client.api.admin_api import AdminApi
5
+ from crypticorn.dex.client.api.signals_api import SignalsApi
6
+ from crypticorn.dex.client.api.status_api import StatusApi