From fd0b9d0c3621989cd0a49c495d93ccbac87c67cb Mon Sep 17 00:00:00 2001 From: claude_dev Date: Thu, 13 Aug 2026 19:57:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(live):=20=E7=BB=84=E5=90=88=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E5=AE=9E=E7=9B=98(R3-1):=20live=5Faccounts=E5=8A=A0st?= =?UTF-8?q?rategy=5Ftype/pool/max=5Fpool/benchmark=E5=88=97(ALTER=E8=BF=81?= =?UTF-8?q?=E7=A7=BB);=20supervisor=E5=AF=B9=E7=BB=84=E5=90=88=E8=A1=8C?= =?UTF-8?q?=E6=8B=89runner=5Flive=E5=AD=90=E8=BF=9B=E7=A8=8B(env=E4=BC=A0?= =?UTF-8?q?=E5=8F=82+=E5=B4=A9=E6=BA=83=E6=A3=80=E6=B5=8B);=20runner=5Fliv?= =?UTF-8?q?e=E9=87=8D=E5=86=99=E9=80=82=E9=85=8Dbullet=5Ftrade=200.9.2?= =?UTF-8?q?=E6=96=B0API(strategy=5Ffile+broker=5Ffactory,=E6=97=A7initiali?= =?UTF-8?q?ze=3D/broker=3D=E5=B7=B2=E5=BA=9F=E5=BC=83)+live=5Fstrategy.py?= =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=87=E4=BB=B6=E6=8C=82StrategyTemplate;?= =?UTF-8?q?=20=E5=89=8D=E7=AB=AFlive/New=E5=8F=8C=E5=8D=A1=E8=A1=A8?= =?UTF-8?q?=E5=8D=95+=E5=88=97=E8=A1=A8=E7=BB=84=E5=90=88=E5=BE=BD?= =?UTF-8?q?=E6=A0=87;=208=E6=B5=8B=E8=AF=95=20[vps]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/live.ts | 9 + frontend/src/views/live/List.vue | 5 +- frontend/src/views/live/New.vue | 264 +++++++++++++++++++++--------- sanguo_api/routes_live.py | 14 ++ sanguo_live/persistence.py | 26 ++- sanguo_live/runner.py | 84 +++++++++- sanguo_portfolio/live_strategy.py | 85 ++++++++++ sanguo_portfolio/runner_live.py | 149 ++++++++++------- tests/api/test_portfolio_live.py | 143 ++++++++++++++++ 9 files changed, 640 insertions(+), 139 deletions(-) create mode 100644 sanguo_portfolio/live_strategy.py create mode 100644 tests/api/test_portfolio_live.py diff --git a/frontend/src/api/live.ts b/frontend/src/api/live.ts index 50aca53..5141618 100644 --- a/frontend/src/api/live.ts +++ b/frontend/src/api/live.ts @@ -25,6 +25,11 @@ export interface LiveAccount { total_return?: number | null position_count?: number instance?: string + /** 'cta' 个股 / 'portfolio' 组合 */ + strategy_type?: string + pool?: string | null + max_pool?: number | null + benchmark?: string | null } export interface LiveCreateRequest { @@ -39,6 +44,10 @@ export interface LiveCreateRequest { connect_wait_sec?: number init_wait_sec?: number mini_path?: string + strategy_type?: string + pool?: string + max_pool?: number + benchmark?: string } export interface LiveStatus { diff --git a/frontend/src/views/live/List.vue b/frontend/src/views/live/List.vue index 5398dc5..408724b 100644 --- a/frontend/src/views/live/List.vue +++ b/frontend/src/views/live/List.vue @@ -183,7 +183,10 @@ async function onStop(a: LiveAccount): Promise { diff --git a/frontend/src/views/live/New.vue b/frontend/src/views/live/New.vue index 528b103..aa01aa6 100644 --- a/frontend/src/views/live/New.vue +++ b/frontend/src/views/live/New.vue @@ -1,5 +1,5 @@