44 lines
2.0 KiB
Python
44 lines
2.0 KiB
Python
"""MCP adapter using the same SUPER operations and records as the web editor."""
|
|
|
|
from ..research.assets import Assets
|
|
from .evidence import read_selection
|
|
from .service import SuperResearch
|
|
|
|
|
|
class SuperResearchAccess:
|
|
async def super_plans(self, args):
|
|
return await Assets(self.db).list("superalpha_plan", args.q, args.limit, args.offset)
|
|
|
|
async def super_plan(self, args):
|
|
if args.experiment_id:
|
|
return await SuperResearch(self.db).experiment(args.experiment_id, args.limit, args.offset)
|
|
return await Assets(self.db).get(args.plan_id, args.version, "superalpha_plan")
|
|
|
|
async def save_super_plan(self, args):
|
|
result = await SuperResearch(self.db).save(args)
|
|
return {**result, "web_url": f"{self.public_origin}/#superalpha-research?plan_id={result['id']}"}
|
|
|
|
async def preview_super_selection(self, args):
|
|
result = await SuperResearch(self.db).selection_job(args)
|
|
self.wake = "jobs"
|
|
return result
|
|
|
|
async def super_selection(self, args):
|
|
return await read_selection(self.db, args)
|
|
|
|
async def build_super_candidates(self, args):
|
|
result = await SuperResearch(self.db).build(args)
|
|
return {**result, "web_url": f"{self.public_origin}/#superalpha-research?experiment_id={result['id']}",
|
|
"submit_with": "submit_backtests", "starts_backtests": False,
|
|
"submit_source": {k: result["source"][k] for k in ("research_id", "superalpha_plan_id", "superalpha_plan_version", "selection_snapshot_ids", "reference", "hypothesis")},
|
|
"paging": "完整候选可用 get_superalpha_plan 的 experiment_id 读取"}
|
|
|
|
async def super_alphas(self, args):
|
|
args.filters.management_scope = "super"
|
|
args.filters.alpha_type = "SUPER"
|
|
return await self.business.search_alphas(args.filters)
|
|
|
|
async def super_alpha(self, args):
|
|
result = await SuperResearch(self.db).alpha(args.alpha_id)
|
|
return {**result, "web_url": f"{self.public_origin}/#superalphas?alpha_id={args.alpha_id}"}
|