forked from Black101081/Nautilus-Web-Interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_integration.html
More file actions
167 lines (147 loc) · 5.25 KB
/
test_integration.html
File metadata and controls
167 lines (147 loc) · 5.25 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nautilus API Test</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 50px auto;
padding: 20px;
background: #1a1a1a;
color: #fff;
}
h1 {
color: #4CAF50;
}
.section {
background: #2a2a2a;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
}
button {
background: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
margin: 5px;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background: #45a049;
}
.result {
background: #333;
padding: 15px;
margin: 10px 0;
border-radius: 4px;
font-family: monospace;
white-space: pre-wrap;
}
.success {
border-left: 4px solid #4CAF50;
}
.error {
border-left: 4px solid #f44336;
}
</style>
</head>
<body>
<h1>🚀 Nautilus Trader API Test</h1>
<div class="section">
<h2>1. Health Check</h2>
<button onclick="testHealth()">Test Health Endpoint</button>
<div id="health-result" class="result"></div>
</div>
<div class="section">
<h2>2. Engine Info</h2>
<button onclick="testEngineInfo()">Get Engine Info</button>
<div id="engine-result" class="result"></div>
</div>
<div class="section">
<h2>3. Database Operations</h2>
<button onclick="testOptimizePostgreSQL()">Optimize PostgreSQL</button>
<button onclick="testBackupPostgreSQL()">Backup PostgreSQL</button>
<button onclick="testExportParquet()">Export Parquet</button>
<button onclick="testFlushRedis()">Flush Redis</button>
<div id="database-result" class="result"></div>
</div>
<div class="section">
<h2>4. Instruments</h2>
<button onclick="testInstruments()">Get Instruments</button>
<div id="instruments-result" class="result"></div>
</div>
<div class="section">
<h2>5. Cache Stats</h2>
<button onclick="testCacheStats()">Get Cache Stats</button>
<div id="cache-result" class="result"></div>
</div>
<script>
const API_URL = 'https://8000-izgd9v56smwjcue9xjn05-99f39a2a.manusvm.computer';
async function callAPI(endpoint, method = 'GET') {
try {
const response = await fetch(`${API_URL}${endpoint}`, {
method,
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
return {
success: false,
error: error.message
};
}
}
function displayResult(elementId, data, isSuccess = true) {
const element = document.getElementById(elementId);
element.textContent = JSON.stringify(data, null, 2);
element.className = isSuccess ? 'result success' : 'result error';
}
async function testHealth() {
const result = await callAPI('/api/health');
displayResult('health-result', result, result.status === 'healthy');
}
async function testEngineInfo() {
const result = await callAPI('/api/nautilus/engine/info');
displayResult('engine-result', result, !result.error);
}
async function testOptimizePostgreSQL() {
const result = await callAPI('/api/nautilus/database/optimize-postgresql', 'POST');
displayResult('database-result', result, result.success);
}
async function testBackupPostgreSQL() {
const result = await callAPI('/api/nautilus/database/backup-postgresql', 'POST');
displayResult('database-result', result, result.success);
}
async function testExportParquet() {
const result = await callAPI('/api/nautilus/database/export-parquet', 'POST');
displayResult('database-result', result, result.success);
}
async function testFlushRedis() {
const result = await callAPI('/api/nautilus/database/flush-redis', 'POST');
displayResult('database-result', result, result.success);
}
async function testInstruments() {
const result = await callAPI('/api/nautilus/instruments');
displayResult('instruments-result', result, result.success);
}
async function testCacheStats() {
const result = await callAPI('/api/nautilus/cache/stats');
displayResult('cache-result', result, result.success);
}
// Auto-run health check on load
window.onload = () => {
testHealth();
};
</script>
</body>
</html>