Aggregate the top status cards across strategies
With several strategies the header cards showed only the first one. Expose day_pnl and drawdown_pct per strategy and add aggregateStatus() (frontend) so the cards show the whole account: summed cash/equity/P&L/trades/positions, worst drawdown, and any halt. Single-strategy runs are unchanged. Adds tests.
This commit is contained in:
1 parent
657c473e82
commit
57dcfe7adb
6 files changed
+133
-3
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { aggregateStatus } from './aggregate'
|
||||
import * as api from './api'
|
||||
import BacktestPanel from './components/BacktestPanel.vue'
|
||||
import EquityChart from './components/EquityChart.vue'
|
||||
@@ -44,6 +45,8 @@ const runningLabel = computed(() => {
|
||||
return `Running: ${list.length} strategies`
|
||||
})
|
||||
|
||||
const displayStatus = computed(() => aggregateStatus(status.value, multiStatus.value))
|
||||
|
||||
const scopeLabel = computed(() => {
|
||||
const list = multiStatus.value.strategies || []
|
||||
if (!list.length) {
|
||||
@@ -298,10 +301,10 @@ onUnmounted(() => {
|
||||
</header>
|
||||
|
||||
<div
|
||||
v-if="status.halted"
|
||||
v-if="displayStatus.halted"
|
||||
class="rounded-lg border border-rose-500 bg-rose-500/20 p-3 text-sm font-semibold text-rose-100"
|
||||
>
|
||||
HALTED — {{ status.halt_reason }}. Trading is stopped and any open position was
|
||||
HALTED — {{ displayStatus.halt_reason }}. Trading is stopped and any open position was
|
||||
flattened. Restart the bot to resume (limits reset).
|
||||
</div>
|
||||
|
||||
@@ -319,7 +322,7 @@ onUnmounted(() => {
|
||||
{{ status.error }}
|
||||
</div>
|
||||
|
||||
<StatusCards :status="status" />
|
||||
<StatusCards :status="displayStatus" />
|
||||
|
||||
<MultiStrategyPanel
|
||||
:strategies="strategies"
|
||||
|
||||
Reference in new issue
Block a user