Spaces:
Running
Running
Update static/index.html
Browse files- static/index.html +29 -66
static/index.html
CHANGED
@@ -1,100 +1,63 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Sentinel Arbitrage Engine</title>
|
|
|
|
|
7 |
<style>
|
8 |
:root { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; }
|
9 |
-
body { background-color: #111927; color: #E5E7EB; font-size: 14px;
|
10 |
-
.container { max-width: 1280px; margin:
|
11 |
header { text-align: center; margin-bottom: 1.5rem; }
|
12 |
-
h1 { color: #38BDF8; margin-bottom: 0;
|
13 |
-
.status-bar { font-size: 12px; color: #9CA3AF; text-align: right; margin-bottom: 1rem; }
|
14 |
-
.status-online { color: #34D399; } .status-offline { color: #F87171; }
|
15 |
table { width: 100%; border-collapse: collapse; }
|
16 |
th { background-color: #374151; text-align: left; }
|
17 |
-
td, th { padding: 0.75rem 1rem; border-bottom: 1px solid #374151;
|
18 |
.buy { color: #34D399; } .sell { color: #F87171; }
|
19 |
.risk-low { color: #34D399; } .risk-medium { color: #FBBF24; } .risk-high { color: #F87171; }
|
20 |
-
|
|
|
|
|
21 |
</style>
|
22 |
-
<!-- The Socket.IO client library -->
|
23 |
-
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
24 |
</head>
|
25 |
<body>
|
26 |
<main class="container">
|
27 |
<header>
|
28 |
<h1>Sentinel Arbitrage Engine</h1>
|
29 |
</header>
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
</div>
|
34 |
-
|
35 |
-
<article>
|
36 |
<table>
|
37 |
<thead>
|
38 |
<tr>
|
|
|
39 |
<th>Pair</th>
|
40 |
<th>Oracle 1 (Pyth)</th>
|
41 |
-
<th>Oracle 2 (
|
42 |
<th>Discrepancy</th>
|
43 |
-
<th>Risk</th>
|
44 |
-
<th>
|
45 |
-
<th>Strategy</th>
|
46 |
</tr>
|
47 |
</thead>
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
</tbody>
|
51 |
</table>
|
52 |
</article>
|
53 |
</main>
|
54 |
-
|
55 |
-
<script>
|
56 |
-
// --- THE NEW JAVASCRIPT ENGINE ---
|
57 |
-
const socket = io();
|
58 |
-
const statusLight = document.getElementById('status-light');
|
59 |
-
const opportunitiesTable = document.getElementById('opportunities-table');
|
60 |
-
const placeholderRow = document.getElementById('placeholder-row');
|
61 |
-
const lastUpdateTime = document.getElementById('last-update-time');
|
62 |
-
|
63 |
-
socket.on('connect', () => {
|
64 |
-
console.log('✅ Connected to Sentinel Engine via WebSocket.');
|
65 |
-
statusLight.textContent = 'ONLINE';
|
66 |
-
statusLight.className = 'status-online';
|
67 |
-
if (placeholderRow) placeholderRow.cells[0].textContent = 'Monitoring for oracle dislocations...';
|
68 |
-
});
|
69 |
-
|
70 |
-
socket.on('disconnect', () => {
|
71 |
-
console.log('🔥 Disconnected from Sentinel Engine.');
|
72 |
-
statusLight.textContent = 'OFFLINE';
|
73 |
-
statusLight.className = 'status-offline';
|
74 |
-
});
|
75 |
-
|
76 |
-
socket.on('new_signal', (signal) => {
|
77 |
-
console.log('⚡️ New Signal Received:', signal);
|
78 |
-
if (placeholderRow) placeholderRow.remove();
|
79 |
-
|
80 |
-
const pythClass = signal.pyth_price < signal.chainlink_price ? 'buy' : 'sell';
|
81 |
-
const chainlinkClass = signal.pyth_price < signal.chainlink_price ? 'sell' : 'buy';
|
82 |
-
|
83 |
-
const newRow = opportunitiesTable.insertRow(0);
|
84 |
-
newRow.style.animation = 'fadeIn 0.7s ease-out';
|
85 |
-
newRow.innerHTML = `
|
86 |
-
<td><strong>BTC/USD</strong></td>
|
87 |
-
<td><span class="${pythClass}">Pyth Network</span><br>$${signal.pyth_price.toFixed(2)}</td>
|
88 |
-
<td><span class="${chainlinkClass}">Chainlink Agg.</span><br>$${signal.chainlink_price.toFixed(2)}</td>
|
89 |
-
<td><strong>${signal.spread_pct.toFixed(3)}%</strong></td>
|
90 |
-
<td><span class="risk-${signal.risk.toLowerCase()}">${signal.risk}</span></td>
|
91 |
-
<td>${signal.rationale}</td>
|
92 |
-
<td>${signal.strategy}</td>
|
93 |
-
`;
|
94 |
-
|
95 |
-
const timeStr = new Date(signal.timestamp).toLocaleTimeString('en-GB', { timeZone: 'UTC' });
|
96 |
-
lastUpdateTime.textContent = `${timeStr} UTC`;
|
97 |
-
});
|
98 |
-
</script>
|
99 |
</body>
|
100 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html lang="en" data-theme="dark">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Sentinel Arbitrage Engine</title>
|
7 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
8 |
+
<script src="https://unpkg.com/[email protected]"></script>
|
9 |
<style>
|
10 |
:root { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; }
|
11 |
+
body { background-color: #111927; color: #E5E7EB; font-size: 14px; }
|
12 |
+
.container { max-width: 1280px; margin: 1.5rem auto; padding: 0 1rem; }
|
13 |
header { text-align: center; margin-bottom: 1.5rem; }
|
14 |
+
h1 { color: #38BDF8; margin-bottom: 0; }
|
|
|
|
|
15 |
table { width: 100%; border-collapse: collapse; }
|
16 |
th { background-color: #374151; text-align: left; }
|
17 |
+
td, th { padding: 0.75rem 1rem; border-bottom: 1px solid #374151; }
|
18 |
.buy { color: #34D399; } .sell { color: #F87171; }
|
19 |
.risk-low { color: #34D399; } .risk-medium { color: #FBBF24; } .risk-high { color: #F87171; }
|
20 |
+
.status-bar { font-size: 14px; color: #9CA3AF; text-align: right; margin-bottom: 1rem; }
|
21 |
+
tbody tr { animation: fadeIn 0.5s ease-out; }
|
22 |
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
23 |
</style>
|
|
|
|
|
24 |
</head>
|
25 |
<body>
|
26 |
<main class="container">
|
27 |
<header>
|
28 |
<h1>Sentinel Arbitrage Engine</h1>
|
29 |
</header>
|
30 |
+
<div class="status-bar grid">
|
31 |
+
<div>Engine Status: <span style="color: #34D399;">ONLINE</span></div>
|
32 |
+
<div id="pnl-ticker" style="text-align: right;">Simulated P/L: $0.00</div>
|
33 |
</div>
|
34 |
+
<article data-theme="dark" style="padding: 0; overflow-x: auto;">
|
|
|
35 |
<table>
|
36 |
<thead>
|
37 |
<tr>
|
38 |
+
<th>Time (UTC)</th>
|
39 |
<th>Pair</th>
|
40 |
<th>Oracle 1 (Pyth)</th>
|
41 |
+
<th>Oracle 2 (Agg.)</th>
|
42 |
<th>Discrepancy</th>
|
43 |
+
<th>AI Risk</th>
|
44 |
+
<th>AI Strategy</th>
|
|
|
45 |
</tr>
|
46 |
</thead>
|
47 |
+
<!-- This table body will be completely replaced every 2 seconds -->
|
48 |
+
<tbody
|
49 |
+
id="opportunities-table"
|
50 |
+
hx-get="/api/signals"
|
51 |
+
hx-trigger="load, every 2s"
|
52 |
+
hx-swap="innerHTML">
|
53 |
+
<tr id="placeholder-row">
|
54 |
+
<td colspan="7" style="text-align:center; padding: 2rem;" aria-busy="true">
|
55 |
+
Awaiting first signal from engine...
|
56 |
+
</td>
|
57 |
+
</tr>
|
58 |
</tbody>
|
59 |
</table>
|
60 |
</article>
|
61 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
</body>
|
63 |
</html>
|