Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +37 -123
static/index.html
CHANGED
|
@@ -4,10 +4,9 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Sentinel Arbitrage Engine</title>
|
| 7 |
-
|
| 8 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
| 9 |
-
<script src="https://
|
| 10 |
-
|
| 11 |
<style>
|
| 12 |
:root {
|
| 13 |
--pico-font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
|
|
@@ -16,106 +15,37 @@
|
|
| 16 |
--pico-color-red-400: #F87171;
|
| 17 |
--pico-color-amber-400: #FBBF24;
|
| 18 |
}
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
.
|
| 26 |
-
|
| 27 |
-
margin: 1.5rem auto;
|
| 28 |
-
padding: 0 1rem;
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
header {
|
| 32 |
-
text-align: center;
|
| 33 |
-
margin-bottom: 1.5rem;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
h1 {
|
| 37 |
-
color: #38BDF8;
|
| 38 |
-
margin-bottom: 0;
|
| 39 |
-
font-weight: 600;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
table {
|
| 43 |
-
width: 100%;
|
| 44 |
-
border-collapse: collapse;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
th {
|
| 48 |
-
background-color: #374151;
|
| 49 |
-
text-align: left;
|
| 50 |
-
position: sticky;
|
| 51 |
-
top: 0;
|
| 52 |
-
z-index: 10;
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
td, th {
|
| 56 |
-
padding: 0.75rem 1rem;
|
| 57 |
-
border-bottom: 1px solid #374151;
|
| 58 |
-
vertical-align: middle;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
tbody tr {
|
| 62 |
-
animation: fadeIn 0.7s ease-out forwards;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
.buy { color: var(--pico-color-green-400); }
|
| 66 |
.sell { color: var(--pico-color-red-400); }
|
| 67 |
-
|
| 68 |
.risk-low { color: var(--pico-color-green-400); }
|
| 69 |
.risk-medium { color: var(--pico-color-amber-400); }
|
| 70 |
.risk-high { color: var(--pico-color-red-400); }
|
| 71 |
-
|
| 72 |
-
.status-bar {
|
| 73 |
-
font-size: 12px;
|
| 74 |
-
color: #9CA3AF;
|
| 75 |
-
text-align: right;
|
| 76 |
-
margin-bottom: 1rem;
|
| 77 |
-
}
|
| 78 |
.status-online { color: #34D399; }
|
| 79 |
-
.
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
.asset-cell {
|
| 83 |
-
|
| 84 |
-
grid-template-columns: auto 1fr;
|
| 85 |
-
gap: 12px;
|
| 86 |
-
align-items: center;
|
| 87 |
-
}
|
| 88 |
-
.asset-logo {
|
| 89 |
-
width: 24px;
|
| 90 |
-
height: 24px;
|
| 91 |
-
}
|
| 92 |
-
.asset-cell a {
|
| 93 |
-
color: inherit;
|
| 94 |
-
text-decoration: none;
|
| 95 |
-
font-weight: bold;
|
| 96 |
-
}
|
| 97 |
-
.asset-cell a:hover {
|
| 98 |
-
text-decoration: underline;
|
| 99 |
-
}
|
| 100 |
-
/* --- END NEW STYLES --- */
|
| 101 |
-
|
| 102 |
-
@keyframes fadeIn {
|
| 103 |
-
from { background-color: rgba(52, 211, 153, 0.2); opacity: 0; }
|
| 104 |
-
to { background-color: transparent; opacity: 1; }
|
| 105 |
-
}
|
| 106 |
</style>
|
| 107 |
</head>
|
| 108 |
-
<body>
|
| 109 |
<main class="container">
|
| 110 |
<header>
|
| 111 |
<h1>Sentinel Arbitrage Engine</h1>
|
| 112 |
</header>
|
| 113 |
-
|
| 114 |
<div class="status-bar">
|
| 115 |
-
Engine Status: <span id="status-light" class="status-
|
| 116 |
</div>
|
| 117 |
-
|
| 118 |
-
<article>
|
| 119 |
<table>
|
| 120 |
<thead>
|
| 121 |
<tr>
|
|
@@ -128,56 +58,40 @@
|
|
| 128 |
</tr>
|
| 129 |
</thead>
|
| 130 |
<tbody id="opportunities-table">
|
| 131 |
-
<tr id="placeholder-row"><td colspan="6" style="text-align:center; padding: 2rem;">
|
| 132 |
</tbody>
|
| 133 |
</table>
|
| 134 |
</article>
|
| 135 |
</main>
|
| 136 |
-
|
| 137 |
<script>
|
|
|
|
|
|
|
|
|
|
| 138 |
const ASSET_CONFIG = {
|
| 139 |
-
'BTC': {
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
},
|
| 143 |
-
'
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
},
|
| 147 |
-
'
|
| 148 |
-
|
| 149 |
-
link: 'https://www.coingecko.com/en/coins/solana'
|
| 150 |
-
}
|
| 151 |
};
|
|
|
|
| 152 |
|
| 153 |
-
const socket = io();
|
| 154 |
-
const statusLight = document.getElementById('status-light');
|
| 155 |
const opportunitiesTable = document.getElementById('opportunities-table');
|
| 156 |
const lastUpdateTime = document.getElementById('last-update-time');
|
| 157 |
|
| 158 |
-
|
| 159 |
-
console.log('✅ Connected to Sentinel Engine.');
|
| 160 |
-
statusLight.textContent = 'ONLINE';
|
| 161 |
-
statusLight.className = 'status-online';
|
| 162 |
-
document.getElementById('placeholder-row').cells[0].textContent = 'Monitoring for oracle dislocations...';
|
| 163 |
-
});
|
| 164 |
-
|
| 165 |
-
socket.on('disconnect', () => {
|
| 166 |
-
console.log('🔥 Disconnected from Sentinel Engine.');
|
| 167 |
-
statusLight.textContent = 'OFFLINE';
|
| 168 |
-
statusLight.className = 'status-offline';
|
| 169 |
-
});
|
| 170 |
-
|
| 171 |
-
socket.on('new_signal', (signal) => {
|
| 172 |
-
console.log('⚡️ New Signal Received:', signal);
|
| 173 |
document.getElementById('placeholder-row')?.remove();
|
| 174 |
-
|
|
|
|
| 175 |
const isPythCheaper = signal.pyth_price < signal.chainlink_price;
|
| 176 |
const newRow = opportunitiesTable.insertRow(0);
|
| 177 |
-
|
| 178 |
const assetInfo = ASSET_CONFIG[signal.asset] || { logo: '', link: '#' };
|
| 179 |
|
| 180 |
-
// --- THE CRITICAL FIX IS HERE ---
|
| 181 |
newRow.innerHTML = `
|
| 182 |
<td>
|
| 183 |
<div class="asset-cell">
|
|
|
|
| 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/htmx.org@1.9.12"></script>
|
| 9 |
+
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
|
| 10 |
<style>
|
| 11 |
:root {
|
| 12 |
--pico-font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
|
|
|
|
| 15 |
--pico-color-red-400: #F87171;
|
| 16 |
--pico-color-amber-400: #FBBF24;
|
| 17 |
}
|
| 18 |
+
body { background-color: #111927; color: #E5E7EB; }
|
| 19 |
+
.container { max-width: 1280px; margin: 1.5rem auto; padding: 0 1rem; }
|
| 20 |
+
header { text-align: center; margin-bottom: 1.5rem; }
|
| 21 |
+
h1 { color: #38BDF8; margin-bottom: 0; font-weight: 600; }
|
| 22 |
+
table { width: 100%; border-collapse: collapse; }
|
| 23 |
+
th { background-color: #374151; text-align: left; position: sticky; top: 0; z-index: 10; }
|
| 24 |
+
td, th { padding: 0.75rem 1rem; border-bottom: 1px solid #374151; vertical-align: middle; }
|
| 25 |
+
tbody tr:first-child { animation: fadeIn 0.7s ease-out forwards; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
.buy { color: var(--pico-color-green-400); }
|
| 27 |
.sell { color: var(--pico-color-red-400); }
|
|
|
|
| 28 |
.risk-low { color: var(--pico-color-green-400); }
|
| 29 |
.risk-medium { color: var(--pico-color-amber-400); }
|
| 30 |
.risk-high { color: var(--pico-color-red-400); }
|
| 31 |
+
.status-bar { font-size: 12px; color: #9CA3AF; text-align: right; margin-bottom: 1rem; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
.status-online { color: #34D399; }
|
| 33 |
+
.asset-cell { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
|
| 34 |
+
.asset-logo { width: 24px; height: 24px; }
|
| 35 |
+
.asset-cell a { color: inherit; text-decoration: none; font-weight: bold; }
|
| 36 |
+
.asset-cell a:hover { text-decoration: underline; }
|
| 37 |
+
@keyframes fadeIn { from { background-color: rgba(52, 211, 153, 0.2); opacity: 0; } to { background-color: transparent; opacity: 1; } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</style>
|
| 39 |
</head>
|
| 40 |
+
<body hx-ext="sse" sse-connect="/api/signals/stream">
|
| 41 |
<main class="container">
|
| 42 |
<header>
|
| 43 |
<h1>Sentinel Arbitrage Engine</h1>
|
| 44 |
</header>
|
|
|
|
| 45 |
<div class="status-bar">
|
| 46 |
+
Engine Status: <span id="status-light" class="status-online">ONLINE</span> | Last Signal: <span id="last-update-time">--:--:--</span>
|
| 47 |
</div>
|
| 48 |
+
<article data-theme="dark" style="padding: 0; overflow-x: auto;">
|
|
|
|
| 49 |
<table>
|
| 50 |
<thead>
|
| 51 |
<tr>
|
|
|
|
| 58 |
</tr>
|
| 59 |
</thead>
|
| 60 |
<tbody id="opportunities-table">
|
| 61 |
+
<tr id="placeholder-row"><td colspan="6" style="text-align:center; padding: 2rem;">Monitoring for oracle dislocations across 10 assets...</td></tr>
|
| 62 |
</tbody>
|
| 63 |
</table>
|
| 64 |
</article>
|
| 65 |
</main>
|
|
|
|
| 66 |
<script>
|
| 67 |
+
// ====================================================================
|
| 68 |
+
// THE "MONEY-SPINNING" UI UPGRADE IS HERE
|
| 69 |
+
// ====================================================================
|
| 70 |
const ASSET_CONFIG = {
|
| 71 |
+
'BTC': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/1.png', link: 'https://www.coingecko.com/en/coins/bitcoin' },
|
| 72 |
+
'ETH': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png', link: 'https://www.coingecko.com/en/coins/ethereum' },
|
| 73 |
+
'SOL': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/5426.png', link: 'https://www.coingecko.com/en/coins/solana' },
|
| 74 |
+
'XRP': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/52.png', link: 'https://www.coingecko.com/en/coins/ripple' },
|
| 75 |
+
'DOGE': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/74.png', link: 'https://www.coingecko.com/en/coins/dogecoin' },
|
| 76 |
+
'ADA': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/2010.png', link: 'https://www.coingecko.com/en/coins/cardano' },
|
| 77 |
+
'AVAX': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/5805.png', link: 'https://www.coingecko.com/en/coins/avalanche' },
|
| 78 |
+
'LINK': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/1975.png', link: 'https://www.coingecko.com/en/coins/chainlink' },
|
| 79 |
+
'DOT': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/6636.png', link: 'https://www.coingecko.com/en/coins/polkadot' },
|
| 80 |
+
'MATIC': { logo: 'https://s2.coinmarketcap.com/static/img/coins/64x64/3890.png', link: 'https://www.coingecko.com/en/coins/polygon' }
|
|
|
|
|
|
|
| 81 |
};
|
| 82 |
+
// ====================================================================
|
| 83 |
|
|
|
|
|
|
|
| 84 |
const opportunitiesTable = document.getElementById('opportunities-table');
|
| 85 |
const lastUpdateTime = document.getElementById('last-update-time');
|
| 86 |
|
| 87 |
+
document.body.addEventListener('htmx:sseMessage', function(evt) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
document.getElementById('placeholder-row')?.remove();
|
| 89 |
+
|
| 90 |
+
const signal = JSON.parse(evt.detail.data);
|
| 91 |
const isPythCheaper = signal.pyth_price < signal.chainlink_price;
|
| 92 |
const newRow = opportunitiesTable.insertRow(0);
|
|
|
|
| 93 |
const assetInfo = ASSET_CONFIG[signal.asset] || { logo: '', link: '#' };
|
| 94 |
|
|
|
|
| 95 |
newRow.innerHTML = `
|
| 96 |
<td>
|
| 97 |
<div class="asset-cell">
|