Spaces:
Running
Running
feat: refine live challenge UI and endpoint docs
Browse files- src/components/HeaderOpen.vue +1 -1
- src/views/LiveView.vue +10 -4
- src/views/RequestView.vue +1 -1
src/components/HeaderOpen.vue
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
class="menu-item"
|
| 19 |
:class="{ active: isActive('/live-challenge') }"
|
| 20 |
@click="navigateTo('/live-challenge')"
|
| 21 |
-
>Live
|
| 22 |
|
| 23 |
<span
|
| 24 |
class="menu-item"
|
|
|
|
| 18 |
class="menu-item"
|
| 19 |
:class="{ active: isActive('/live-challenge') }"
|
| 20 |
@click="navigateTo('/live-challenge')"
|
| 21 |
+
>Live Challenge</span>
|
| 22 |
|
| 23 |
<span
|
| 24 |
class="menu-item"
|
src/views/LiveView.vue
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
<!-- Asset tabs styled per AMA -->
|
| 14 |
<div class="asset-tabs">
|
| 15 |
<button
|
| 16 |
-
v-for="a in
|
| 17 |
:key="a"
|
| 18 |
class="asset-tab"
|
| 19 |
:class="{ 'is-active': asset === a }"
|
|
@@ -90,7 +90,7 @@
|
|
| 90 |
</div>
|
| 91 |
<div class="names">
|
| 92 |
<div class="agent">{{ c.kind==='bh' ? 'Buy & Hold' : c.title }}</div>
|
| 93 |
-
<div class="model">{{ c.subtitle }}</div>
|
| 94 |
</div>
|
| 95 |
</header>
|
| 96 |
|
|
@@ -180,6 +180,7 @@ import {
|
|
| 180 |
|
| 181 |
/* ---------- config ---------- */
|
| 182 |
const orderedAssets = ['BTC','ETH','BMRN','TSLA']
|
|
|
|
| 183 |
const LIVE_AGENT_WHITELIST = new Set([
|
| 184 |
'tradeagent',
|
| 185 |
'hedgefundagent',
|
|
@@ -216,6 +217,7 @@ const refreshing = ref(false)
|
|
| 216 |
let unsubscribe = null
|
| 217 |
const route = useRoute()
|
| 218 |
const viewStrategy = computed(() => route.path === '/live-challenge' ? 'long_short' : 'long_only')
|
|
|
|
| 219 |
|
| 220 |
/* ---------- bootstrap ---------- */
|
| 221 |
onMounted(async () => {
|
|
@@ -230,7 +232,7 @@ onMounted(async () => {
|
|
| 230 |
dataService.load(true).catch(e => console.error('LiveView: force refresh failed', e))
|
| 231 |
}
|
| 232 |
|
| 233 |
-
if (!
|
| 234 |
|
| 235 |
allDecisions = getAllDecisions() || []
|
| 236 |
if (!allDecisions.length) {
|
|
@@ -245,6 +247,10 @@ onBeforeUnmount(() => {
|
|
| 245 |
if (unsubscribe) { unsubscribe(); unsubscribe = null }
|
| 246 |
})
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
/* ---------- helpers ---------- */
|
| 249 |
const formatModelName = (model) => {
|
| 250 |
if (!model) return ''
|
|
@@ -454,7 +460,7 @@ watch(
|
|
| 454 |
key: `agent|${sel.agent_name}|${sel.model}`,
|
| 455 |
kind: 'agent',
|
| 456 |
title: sel.agent_name,
|
| 457 |
-
subtitle:
|
| 458 |
balance: perf.stratLast,
|
| 459 |
date: maxEndDate || perf.date, // Use max date from Supabase
|
| 460 |
logo: AGENT_LOGOS[sel.agent_name] || null,
|
|
|
|
| 13 |
<!-- Asset tabs styled per AMA -->
|
| 14 |
<div class="asset-tabs">
|
| 15 |
<button
|
| 16 |
+
v-for="a in tabAssets"
|
| 17 |
:key="a"
|
| 18 |
class="asset-tab"
|
| 19 |
:class="{ 'is-active': asset === a }"
|
|
|
|
| 90 |
</div>
|
| 91 |
<div class="names">
|
| 92 |
<div class="agent">{{ c.kind==='bh' ? 'Buy & Hold' : c.title }}</div>
|
| 93 |
+
<div v-if="c.subtitle" class="model">{{ c.subtitle }}</div>
|
| 94 |
</div>
|
| 95 |
</header>
|
| 96 |
|
|
|
|
| 180 |
|
| 181 |
/* ---------- config ---------- */
|
| 182 |
const orderedAssets = ['BTC','ETH','BMRN','TSLA']
|
| 183 |
+
const challengeAssets = ['BTC', 'TSLA']
|
| 184 |
const LIVE_AGENT_WHITELIST = new Set([
|
| 185 |
'tradeagent',
|
| 186 |
'hedgefundagent',
|
|
|
|
| 217 |
let unsubscribe = null
|
| 218 |
const route = useRoute()
|
| 219 |
const viewStrategy = computed(() => route.path === '/live-challenge' ? 'long_short' : 'long_only')
|
| 220 |
+
const tabAssets = computed(() => route.path === '/live-challenge' ? challengeAssets : orderedAssets)
|
| 221 |
|
| 222 |
/* ---------- bootstrap ---------- */
|
| 223 |
onMounted(async () => {
|
|
|
|
| 232 |
dataService.load(true).catch(e => console.error('LiveView: force refresh failed', e))
|
| 233 |
}
|
| 234 |
|
| 235 |
+
if (!tabAssets.value.includes(asset.value)) asset.value = tabAssets.value[0]
|
| 236 |
|
| 237 |
allDecisions = getAllDecisions() || []
|
| 238 |
if (!allDecisions.length) {
|
|
|
|
| 247 |
if (unsubscribe) { unsubscribe(); unsubscribe = null }
|
| 248 |
})
|
| 249 |
|
| 250 |
+
watch(tabAssets, (assets) => {
|
| 251 |
+
if (!assets.includes(asset.value)) asset.value = assets[0]
|
| 252 |
+
})
|
| 253 |
+
|
| 254 |
/* ---------- helpers ---------- */
|
| 255 |
const formatModelName = (model) => {
|
| 256 |
if (!model) return ''
|
|
|
|
| 460 |
key: `agent|${sel.agent_name}|${sel.model}`,
|
| 461 |
kind: 'agent',
|
| 462 |
title: sel.agent_name,
|
| 463 |
+
subtitle: '',
|
| 464 |
balance: perf.stratLast,
|
| 465 |
date: maxEndDate || perf.date, // Use max date from Supabase
|
| 466 |
logo: AGENT_LOGOS[sel.agent_name] || null,
|
src/views/RequestView.vue
CHANGED
|
@@ -177,7 +177,7 @@
|
|
| 177 |
</div>
|
| 178 |
<div class="guide-section">
|
| 179 |
<h4>cURL Sample (POST to your endpoint)</h4>
|
| 180 |
-
<pre class="code-block">curl -X POST "
|
| 181 |
-H "Content-Type: application/json" \
|
| 182 |
-d '{
|
| 183 |
"date": "2025-01-15",
|
|
|
|
| 177 |
</div>
|
| 178 |
<div class="guide-section">
|
| 179 |
<h4>cURL Sample (POST to your endpoint)</h4>
|
| 180 |
+
<pre class="code-block">curl -X POST "<your_endpoint>" \
|
| 181 |
-H "Content-Type: application/json" \
|
| 182 |
-d '{
|
| 183 |
"date": "2025-01-15",
|