feat(v0.2): 完善量化研究与二次开发能力

This commit is contained in:
shy3130
2026-08-13 20:16:02 +08:00
parent 57eb641275
commit 8fe5dac7bd
105 changed files with 4974 additions and 678 deletions
+38
View File
@@ -0,0 +1,38 @@
from fastapi import APIRouter
from app.extensions import (
BACKEND_EXTENSION_API_VERSION,
BackendExtensionRegistrar,
ExtensionContext,
NotificationFormatContext,
NotificationFormatter,
)
class CompanyNotificationFormatter(NotificationFormatter):
def format_message(self, event: dict, context: NotificationFormatContext) -> str:
return f"[公司规则] {event.get('message', '')}".strip()
EXTENSION_ID = "company.example"
EXTENSION_API_VERSION = BACKEND_EXTENSION_API_VERSION
def setup(registrar: BackendExtensionRegistrar) -> None:
registrar.register_notification_formatter(
"company.notification",
CompanyNotificationFormatter(),
)
router = APIRouter(prefix="/api/custom/example", tags=["custom-example"])
@router.get("/status")
def status() -> dict:
return {"status": "ok"}
registrar.include_router(router)
def startup(context: ExtensionContext) -> None:
# Core repository and data directory are available here. Keep this hook fast.
_ = context