-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dashboard.html
More file actions
373 lines (324 loc) Β· 13.1 KB
/
test_dashboard.html
File metadata and controls
373 lines (324 loc) Β· 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pump.fun Indicator - Test Dashboard</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
color: #e0e0e0;
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 40px;
padding: 30px;
background: rgba(255, 255, 255, 0.05);
border-radius: 15px;
backdrop-filter: blur(10px);
}
.header h1 {
font-size: 36px;
background: linear-gradient(45deg, #00d4ff, #ff00ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 10px;
}
.status {
display: inline-block;
padding: 8px 16px;
background: rgba(0, 255, 0, 0.2);
border: 1px solid #00ff00;
border-radius: 20px;
color: #00ff00;
font-size: 14px;
}
.test-section {
background: rgba(255, 255, 255, 0.05);
border-radius: 15px;
padding: 25px;
margin-bottom: 20px;
backdrop-filter: blur(10px);
}
.test-section h2 {
margin-bottom: 20px;
color: #00d4ff;
}
.test-controls {
display: flex;
gap: 10px;
margin-bottom: 20px;
flex-wrap: wrap;
}
button {
padding: 12px 24px;
background: linear-gradient(45deg, #00d4ff, #ff00ff);
border: none;
border-radius: 8px;
color: white;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s;
}
button:hover {
transform: scale(1.05);
}
input {
flex: 1;
min-width: 200px;
padding: 12px;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 8px;
color: white;
font-size: 16px;
}
.results {
background: rgba(0, 0, 0, 0.3);
border-radius: 10px;
padding: 15px;
max-height: 400px;
overflow-y: auto;
font-family: 'Courier New', monospace;
font-size: 14px;
white-space: pre-wrap;
word-break: break-all;
}
.token-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 15px;
margin-top: 20px;
}
.token-card {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
padding: 15px;
border: 1px solid rgba(255, 255, 255, 0.1);
transition: transform 0.2s;
}
.token-card:hover {
transform: translateY(-2px);
border-color: #00d4ff;
}
.token-symbol {
font-size: 18px;
font-weight: bold;
color: #00d4ff;
margin-bottom: 5px;
}
.token-name {
font-size: 14px;
opacity: 0.7;
margin-bottom: 10px;
}
.token-metric {
display: flex;
justify-content: space-between;
margin: 5px 0;
font-size: 14px;
}
.metric-value {
font-weight: bold;
}
.positive {
color: #00ff88;
}
.negative {
color: #ff4444;
}
.loading {
text-align: center;
padding: 20px;
color: #00d4ff;
}
.error {
background: rgba(255, 0, 0, 0.1);
border: 1px solid #ff4444;
color: #ff4444;
padding: 15px;
border-radius: 8px;
margin: 10px 0;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Pump.fun Trading Indicator</h1>
<p style="margin: 10px 0;">Test Dashboard - Development Mode</p>
<span class="status" id="apiStatus">Checking API...</span>
</div>
<div class="test-section">
<h2>π API Health Check</h2>
<div class="test-controls">
<button onclick="checkHealth()">Check Health</button>
<button onclick="testAllEndpoints()">Test All Endpoints</button>
</div>
<div class="results" id="healthResults">Click "Check Health" to test the API connection...</div>
</div>
<div class="test-section">
<h2>π° Recent Tokens</h2>
<div class="test-controls">
<button onclick="getRecentTokens()">Get Recent Tokens</button>
<button onclick="clearTokens()">Clear</button>
</div>
<div class="token-grid" id="tokenGrid"></div>
</div>
<div class="test-section">
<h2>π Token Analysis</h2>
<div class="test-controls">
<input type="text" id="tokenAddress" placeholder="Enter token address (or use 'test' for mock)">
<button onclick="analyzeToken()">Analyze</button>
</div>
<div class="results" id="analysisResults">Enter a token address to analyze...</div>
</div>
<div class="test-section">
<h2>π Technical Indicators</h2>
<div class="test-controls">
<input type="text" id="indicatorToken" placeholder="Token address for indicators">
<select id="timeframe" style="padding: 12px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; color: white;">
<option value="1m">1 Minute</option>
<option value="5m">5 Minutes</option>
<option value="15m">15 Minutes</option>
<option value="1h" selected>1 Hour</option>
<option value="4h">4 Hours</option>
<option value="1d">1 Day</option>
</select>
<button onclick="getIndicators()">Get Indicators</button>
</div>
<div class="results" id="indicatorResults">Select a token and timeframe...</div>
</div>
</div>
<script>
const API_URL = 'http://localhost:8000';
// Check API status on load
window.onload = () => {
checkHealth();
};
async function checkHealth() {
const statusEl = document.getElementById('apiStatus');
const resultsEl = document.getElementById('healthResults');
try {
resultsEl.textContent = 'Checking API health...';
const response = await fetch(`${API_URL}/api/health`);
const data = await response.json();
statusEl.textContent = 'β
API Connected';
statusEl.style.background = 'rgba(0, 255, 0, 0.2)';
statusEl.style.borderColor = '#00ff00';
statusEl.style.color = '#00ff00';
resultsEl.textContent = JSON.stringify(data, null, 2);
} catch (error) {
statusEl.textContent = 'β API Disconnected';
statusEl.style.background = 'rgba(255, 0, 0, 0.2)';
statusEl.style.borderColor = '#ff0000';
statusEl.style.color = '#ff0000';
resultsEl.textContent = `Error: ${error.message}\n\nMake sure the API server is running:\npython run_local.py`;
}
}
async function getRecentTokens() {
const gridEl = document.getElementById('tokenGrid');
gridEl.innerHTML = '<div class="loading">Loading tokens...</div>';
try {
const response = await fetch(`${API_URL}/api/tokens/recent`);
const data = await response.json();
gridEl.innerHTML = '';
data.tokens.forEach(token => {
const card = document.createElement('div');
card.className = 'token-card';
card.innerHTML = `
<div class="token-symbol">${token.symbol}</div>
<div class="token-name">${token.name}</div>
<div class="token-metric">
<span>Price:</span>
<span class="metric-value positive">$${token.price.toFixed(6)}</span>
</div>
<div class="token-metric">
<span>Volume 24h:</span>
<span class="metric-value">$${token.volume_24h.toLocaleString()}</span>
</div>
<div class="token-metric">
<span>Liquidity:</span>
<span class="metric-value">$${token.liquidity.toLocaleString()}</span>
</div>
<div class="token-metric">
<span>Holders:</span>
<span class="metric-value">${token.holder_count.toLocaleString()}</span>
</div>
`;
card.onclick = () => {
document.getElementById('tokenAddress').value = token.address;
analyzeToken();
};
gridEl.appendChild(card);
});
} catch (error) {
gridEl.innerHTML = `<div class="error">Error loading tokens: ${error.message}</div>`;
}
}
function clearTokens() {
document.getElementById('tokenGrid').innerHTML = '';
}
async function analyzeToken() {
const address = document.getElementById('tokenAddress').value || 'test_token_123';
const resultsEl = document.getElementById('analysisResults');
try {
resultsEl.textContent = 'Analyzing token...';
const response = await fetch(`${API_URL}/api/tokens/${address}`);
const data = await response.json();
resultsEl.textContent = JSON.stringify(data, null, 2);
// Also populate indicator token field
document.getElementById('indicatorToken').value = address;
} catch (error) {
resultsEl.textContent = `Error: ${error.message}`;
}
}
async function getIndicators() {
const address = document.getElementById('indicatorToken').value || document.getElementById('tokenAddress').value || 'test_token';
const timeframe = document.getElementById('timeframe').value;
const resultsEl = document.getElementById('indicatorResults');
try {
resultsEl.textContent = 'Calculating indicators...';
const response = await fetch(`${API_URL}/api/tokens/${address}/indicators?timeframe=${timeframe}`);
const data = await response.json();
resultsEl.textContent = JSON.stringify(data, null, 2);
} catch (error) {
resultsEl.textContent = `Error: ${error.message}`;
}
}
async function testAllEndpoints() {
const resultsEl = document.getElementById('healthResults');
resultsEl.textContent = 'Testing all endpoints...\n\n';
const endpoints = [
'/api/health',
'/api/tokens/recent?limit=5',
'/api/tokens/test_token_abc123',
'/api/tokens/test_token_abc123/indicators?timeframe=1h'
];
for (const endpoint of endpoints) {
try {
resultsEl.textContent += `Testing ${endpoint}...\n`;
const response = await fetch(`${API_URL}${endpoint}`);
const data = await response.json();
resultsEl.textContent += `β
Success: ${response.status}\n\n`;
} catch (error) {
resultsEl.textContent += `β Failed: ${error.message}\n\n`;
}
}
resultsEl.textContent += 'All tests complete!';
}
</script>
</body>
</html>