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.
- crypticorn/auth/client/api/admin_api.py +6 -26
- crypticorn/auth/client/api/auth_api.py +36 -148
- crypticorn/auth/client/api/service_api.py +3 -16
- crypticorn/auth/client/api/user_api.py +33 -136
- crypticorn/auth/client/api/wallet_api.py +18 -76
- crypticorn/auth/client/api_client.py +0 -5
- crypticorn/auth/client/models/add_wallet_request.py +1 -1
- crypticorn/auth/client/models/authorize_user_request.py +1 -1
- crypticorn/auth/client/models/create_api_key_request.py +1 -1
- crypticorn/auth/client/models/create_user_request.py +1 -1
- crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
- crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
- crypticorn/auth/client/models/logout_default_response.py +1 -1
- crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
- crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
- crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
- crypticorn/auth/client/models/token_info200_response.py +1 -1
- crypticorn/auth/client/models/update_user_request.py +1 -1
- crypticorn/auth/client/models/user_by_username200_response.py +1 -1
- crypticorn/auth/client/models/verify200_response.py +1 -1
- crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
- crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
- crypticorn/auth/client/models/whoami200_response.py +1 -1
- crypticorn/cli/init.py +1 -1
- crypticorn/cli/templates/.env.docker.temp +3 -0
- crypticorn/cli/templates/.env.example.temp +4 -0
- crypticorn/cli/templates/Dockerfile +5 -2
- crypticorn/client.py +0 -1
- crypticorn/common/auth.py +31 -4
- crypticorn/common/decorators.py +1 -2
- crypticorn/common/enums.py +0 -2
- crypticorn/common/errors.py +10 -0
- crypticorn/common/metrics.py +1 -1
- crypticorn/common/middleware.py +0 -1
- crypticorn/common/pagination.py +116 -24
- crypticorn/common/router/admin_router.py +1 -11
- crypticorn/common/router/status_router.py +33 -2
- crypticorn/common/scopes.py +2 -2
- crypticorn/common/utils.py +1 -2
- crypticorn/dex/__init__.py +6 -0
- crypticorn/dex/client/__init__.py +49 -0
- crypticorn/dex/client/api/__init__.py +6 -0
- crypticorn/dex/client/api/admin_api.py +2983 -0
- crypticorn/dex/client/api/signals_api.py +1794 -0
- crypticorn/dex/client/api/status_api.py +889 -0
- crypticorn/dex/client/api_client.py +753 -0
- crypticorn/dex/client/api_response.py +20 -0
- crypticorn/dex/client/configuration.py +620 -0
- crypticorn/dex/client/exceptions.py +220 -0
- crypticorn/dex/client/models/__init__.py +30 -0
- crypticorn/dex/client/models/api_error_identifier.py +121 -0
- crypticorn/dex/client/models/api_error_level.py +37 -0
- crypticorn/dex/client/models/api_error_type.py +37 -0
- crypticorn/dex/client/models/exception_detail.py +117 -0
- crypticorn/dex/client/models/log_level.py +38 -0
- crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
- crypticorn/dex/client/models/risk.py +86 -0
- crypticorn/dex/client/models/signal_overview_stats.py +156 -0
- crypticorn/dex/client/models/signal_volume.py +84 -0
- crypticorn/dex/client/models/signal_with_token.py +163 -0
- crypticorn/dex/client/models/token_data.py +127 -0
- crypticorn/dex/client/models/token_detail.py +116 -0
- crypticorn/dex/client/py.typed +0 -0
- crypticorn/dex/client/rest.py +217 -0
- crypticorn/dex/main.py +1 -0
- crypticorn/hive/client/api/admin_api.py +18 -75
- crypticorn/hive/client/api/data_api.py +6 -28
- crypticorn/hive/client/api/models_api.py +22 -88
- crypticorn/hive/client/api/status_api.py +6 -27
- crypticorn/hive/client/api_client.py +0 -5
- crypticorn/hive/client/models/coin_info.py +1 -1
- crypticorn/hive/client/models/exception_detail.py +1 -1
- crypticorn/hive/client/models/target_info.py +1 -1
- crypticorn/hive/utils.py +2 -2
- crypticorn/klines/client/api/admin_api.py +18 -75
- crypticorn/klines/client/api/change_in_timeframe_api.py +3 -16
- crypticorn/klines/client/api/funding_rates_api.py +3 -16
- crypticorn/klines/client/api/ohlcv_data_api.py +3 -16
- crypticorn/klines/client/api/status_api.py +6 -27
- crypticorn/klines/client/api/symbols_api.py +3 -16
- crypticorn/klines/client/api/udf_api.py +18 -74
- crypticorn/klines/client/api_client.py +0 -5
- crypticorn/klines/client/models/exception_detail.py +1 -1
- crypticorn/klines/client/models/ohlcv.py +1 -1
- crypticorn/klines/client/models/symbol_group.py +1 -1
- crypticorn/klines/client/models/udf_config.py +1 -1
- crypticorn/metrics/client/api/admin_api.py +18 -75
- crypticorn/metrics/client/api/exchanges_api.py +12 -52
- crypticorn/metrics/client/api/indicators_api.py +6 -28
- crypticorn/metrics/client/api/logs_api.py +3 -16
- crypticorn/metrics/client/api/marketcap_api.py +12 -52
- crypticorn/metrics/client/api/markets_api.py +3 -16
- crypticorn/metrics/client/api/quote_currencies_api.py +3 -16
- crypticorn/metrics/client/api/status_api.py +6 -27
- crypticorn/metrics/client/api/tokens_api.py +6 -26
- crypticorn/metrics/client/api_client.py +0 -5
- crypticorn/metrics/client/models/exception_detail.py +1 -1
- crypticorn/metrics/client/models/exchange_mapping.py +1 -1
- crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
- crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
- crypticorn/metrics/client/models/ohlcv.py +1 -1
- crypticorn/pay/client/api/admin_api.py +21 -87
- crypticorn/pay/client/api/now_payments_api.py +15 -64
- crypticorn/pay/client/api/payments_api.py +6 -28
- crypticorn/pay/client/api/products_api.py +12 -52
- crypticorn/pay/client/api/status_api.py +6 -27
- crypticorn/pay/client/api_client.py +0 -5
- crypticorn/pay/client/models/exception_detail.py +1 -1
- crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
- crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
- crypticorn/pay/client/models/product.py +1 -1
- crypticorn/pay/client/models/product_create.py +1 -1
- crypticorn/pay/client/models/product_update.py +1 -1
- crypticorn/trade/client/__init__.py +15 -0
- crypticorn/trade/client/api/admin_api.py +43 -107
- crypticorn/trade/client/api/api_keys_api.py +207 -184
- crypticorn/trade/client/api/bots_api.py +6557 -240
- crypticorn/trade/client/api/exchanges_api.py +9 -36
- crypticorn/trade/client/api/notifications_api.py +18 -72
- crypticorn/trade/client/api/orders_api.py +220 -115
- crypticorn/trade/client/api/status_api.py +6 -24
- crypticorn/trade/client/api/strategies_api.py +15 -60
- crypticorn/trade/client/api/trading_actions_api.py +431 -112
- crypticorn/trade/client/models/__init__.py +15 -0
- crypticorn/trade/client/models/bot.py +7 -18
- crypticorn/trade/client/models/bot_create.py +17 -1
- crypticorn/trade/client/models/bot_update.py +17 -1
- crypticorn/trade/client/models/exchange_key_create.py +17 -1
- crypticorn/trade/client/models/exchange_key_update.py +17 -1
- crypticorn/trade/client/models/notification.py +17 -1
- crypticorn/trade/client/models/notification_create.py +17 -1
- crypticorn/trade/client/models/notification_update.py +17 -1
- crypticorn/trade/client/models/orders_count.py +88 -0
- crypticorn/trade/client/models/paginated_response_futures_trading_action.py +134 -0
- crypticorn/trade/client/models/paginated_response_order.py +134 -0
- crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action.py +141 -0
- crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action_data_inner.py +165 -0
- crypticorn/trade/client/models/pn_l.py +95 -0
- crypticorn/trade/client/models/spot_trading_action.py +207 -0
- crypticorn/trade/client/models/strategy.py +17 -1
- crypticorn/trade/client/models/strategy_create.py +17 -1
- crypticorn/trade/client/models/strategy_update.py +17 -1
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/METADATA +3 -3
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/RECORD +151 -116
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/WHEEL +0 -0
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/licenses/LICENSE +0 -0
- {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
|
-
|
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
|
+
|
crypticorn/common/scopes.py
CHANGED
@@ -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
|
-
|
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.
|
91
|
+
cls.READ_DEX_SIGNALS,
|
92
92
|
]
|
crypticorn/common/utils.py
CHANGED
@@ -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,
|
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,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
|