Spaces:
Running
Running
File size: 16,209 Bytes
6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc 58fb9de 6841ecc | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Forex Bot Backend</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
.server-card {
transition: all 0.3s ease;
border-left: 4px solid #3b82f6;
}
.server-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.code-container {
background-color: #1f2937;
color: #d1d5db;
padding: 1rem;
border-radius: 0.5rem;
font-family: monospace;
white-space: pre-wrap;
overflow-x: auto;
}
</style>
</head>
<body class="bg-gray-50 p-6">
<div class="max-w-6xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden">
<!-- Header -->
<div class="bg-blue-600 p-6 text-white">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" />
</svg>
<div>
<h1 class="text-3xl font-bold">SMC Trading Bot - Backend System</h1>
<p class="text-blue-100">Node.js & Python backend infrastructure for trade execution and monitoring</p>
</div>
</div>
</div>
<!-- Main Content -->
<div class="p-8">
<!-- Architecture Overview -->
<section class="mb-12">
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-2">System Architecture</h2>
<div class="bg-gray-100 p-6 rounded-lg">
<img src="http://static.photos/technology/1024x576/42" alt="Backend Architecture" class="w-full rounded-lg mb-4">
<div class="grid md:grid-cols-4 gap-4 text-center">
<div class="bg-white p-3 rounded-lg shadow-sm">
<div class="font-semibold text-blue-600">1. Data Collector</div>
<p class="text-sm text-gray-600">MT5 API & WebSocket feeds</p>
</div>
<div class="bg-white p-3 rounded-lg shadow-sm">
<div class="font-semibold text-blue-600">2. Strategy Engine</div>
<p class="text-sm text-gray-600">SMC pattern detection</p>
</div>
<div class="bg-white p-3 rounded-lg shadow-sm">
<div class="font-semibold text-blue-600">3. Execution Layer</div>
<p class="text-sm text-gray-600">Order management</p>
</div>
<div class="bg-white p-3 rounded-lg shadow-sm">
<div class="font-semibold text-blue-600">4. Monitoring</div>
<p class="text-sm text-gray-600">Performance tracking</p>
</div>
</div>
</div>
</section>
<!-- Server Infrastructure -->
<section class="mb-12">
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-2">Server Infrastructure</h2>
<div class="grid md:grid-cols-3 gap-6">
<div class="bg-gray-50 p-6 rounded-lg server-card">
<div class="flex items-center mb-3">
<div class="bg-blue-100 rounded-full p-2 mr-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" />
</svg>
</div>
<h3 class="text-xl font-semibold">Data Processing</h3>
</div>
<p class="text-gray-600 mb-2">AWS EC2 c5.2xlarge instance</p>
<ul class="text-sm text-gray-600 space-y-1">
<li>• 8 vCPUs, 16GB RAM</li>
<li>• 500GB SSD storage</li>
<li>• Dedicated MT5 bridge</li>
</ul>
</div>
<div class="bg-gray-50 p-6 rounded-lg server-card">
<div class="flex items-center mb-3">
<div class="bg-blue-100 rounded-full p-2 mr-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
</svg>
</div>
<h3 class="text-xl font-semibold">Execution Server</h3>
</div>
<p class="text-gray-600 mb-2">AWS EC2 c5.xlarge instance</p>
<ul class="text-sm text-gray-600 space-y-1">
<li>• 4 vCPUs, 8GB RAM</li>
<li>• 250GB SSD storage</li>
<li>• Low-latency networking</li>
</ul>
</div>
<div class="bg-gray-50 p-6 rounded-lg server-card">
<div class="flex items-center mb-3">
<div class="bg-blue-100 rounded-full p-2 mr-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>
<h3 class="text-xl font-semibold">Monitoring</h3>
</div>
<p class="text-gray-600 mb-2">AWS EC2 t3.medium instance</p>
<ul class="text-sm text-gray-600 space-y-1">
<li>• 2 vCPUs, 4GB RAM</li>
<li>• CloudWatch integration</li>
<li>• Telegram alerts</li>
</ul>
</div>
</div>
</section>
<!-- API Endpoints -->
<section class="mb-12">
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-2">REST API Endpoints</h2>
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-xl font-semibold mb-3 text-blue-700">1. Market Data</h3>
<div class="code-container mb-4">
<span class="text-green-400">// Get current market structure</span><br>
<span class="text-blue-400">GET</span> <span class="text-yellow-200">/api/market/structure?symbol=EURUSD&tf=5M</span><br>
<span class="text-gray-500">Response:</span> {<br>
"bias": "Bullish",<br>
"protectedLow": 1.12345,<br>
"protectedHigh": 1.12567,<br>
"pivots": [1, -1, 0, 1]<br>
}
</div>
<div class="code-container">
<span class="text-green-400">// Stream real-time price data</span><br>
<span class="text-blue-400">WS</span> <span class="text-yellow-200">/ws/prices?symbols=EURUSD,GBPUSD,XAUUSD</span><br>
<span class="text-gray-500">Messages:</span> {<br>
"symbol": "EURUSD",<br>
"bid": 1.12345,<br>
"ask": 1.12355,<br>
"time": "2023-07-20T12:34:56Z"<br>
}
</div>
</div>
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-xl font-semibold mb-3 text-blue-700">2. Trade Execution</h3>
<div class="code-container mb-4">
<span class="text-green-400">// Submit new trade</span><br>
<span class="text-blue-400">POST</span> <span class="text-yellow-200">/api/trades</span><br>
<span class="text-gray-500">Body:</span> {<br>
"symbol": "EURUSD",<br>
"type": "BUY",<br>
"entry": 1.12345,<br>
"sl": 1.12245,<br>
"tp": 1.12545,<br>
"riskPercent": 1.0,<br>
"comment": "SMC BOS setup"<br>
}
</div>
<div class="code-container">
<span class="text-green-400">// Get active trades</span><br>
<span class="text-blue-400">GET</span> <span class="text-yellow-200">/api/trades?status=active</span><br>
<span class="text-gray-500">Response:</span> [{<br>
"id": 12345,<br>
"symbol": "EURUSD",<br>
"type": "BUY",<br>
"entry": 1.12345,<br>
"sl": 1.12245,<br>
"tp": 1.12545,<br>
"profit": 32.50,<br>
"status": "open"<br>
}]
</div>
</div>
<div class="bg-gray-50 p-5 rounded-lg">
<h3 class="text-xl font-semibold mb-3 text-blue-700">3. System Monitoring</h3>
<div class="code-container">
<span class="text-green-400">// Get system health</span><br>
<span class="text-blue-400">GET</span> <span class="text-yellow-200">/api/health</span><br>
<span class="text-gray-500">Response:</span> {<br>
"status": "operational",<br>
"lastTradeTime": "2023-07-20T12:34:56Z",<br>
"cpuLoad": 35.2,<br>
"memoryUsage": 45.8,<br>
"activeSymbols": ["EURUSD", "GBPUSD"]<br>
}
</div>
</div>
</section>
<!-- Database Schema -->
<section>
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-2">Database Schema</h2>
<div class="bg-gray-50 p-5 rounded-lg">
<div class="grid md:grid-cols-2 gap-6">
<div>
<h3 class="text-lg font-semibold mb-2 text-blue-600">Trades Table</h3>
<div class="code-container">
CREATE TABLE trades (<br>
id SERIAL PRIMARY KEY,<br>
symbol VARCHAR(10) NOT NULL,<br>
direction VARCHAR(4) NOT NULL,<br>
entry_price DECIMAL(10,5) NOT NULL,<br>
sl_price DECIMAL(10,5) NOT NULL,<br>
tp_price DECIMAL(10,5) NOT NULL,<br>
lot_size DECIMAL(10,2) NOT NULL,<br>
risk_percent DECIMAL(5,2) NOT NULL,<br>
status VARCHAR(10) NOT NULL,<br>
open_time TIMESTAMP NOT NULL,<br>
close_time TIMESTAMP,<br>
profit DECIMAL(10,2)<br>
);
</div>
</div>
<div>
<h3 class="text-lg font-semibold mb-2 text-blue-600">Market Data Table</h3>
<div class="code-container">
CREATE TABLE market_data (<br>
id SERIAL PRIMARY KEY,<br>
symbol VARCHAR(10) NOT NULL,<br>
timeframe VARCHAR(5) NOT NULL,<br>
timestamp TIMESTAMP NOT NULL,<br>
open DECIMAL(10,5) NOT NULL,<br>
high DECIMAL(10,5) NOT NULL,<br>
low DECIMAL(10,5) NOT NULL,<br>
close DECIMAL(10,5) NOT NULL,<br>
volume INTEGER NOT NULL,<br>
pivot_type SMALLINT<br>
);
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Footer -->
<div class="bg-gray-800 text-white p-6">
<div class="container mx-auto">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2 text-blue-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
<span class="text-xl font-bold">SMC Trading Bot</span>
</div>
<p class="text-gray-400 mt-1">Professional backend infrastructure</p>
</div>
<div class="flex space-x-4">
<a href="index.html" class="text-gray-300 hover:text-white">Home</a>
<a href="bots.html" class="text-gray-300 hover:text-white">How Bots Work</a>
<a href="smc-bot-mql5.html" class="text-gray-300 hover:text-white">MQL5 Core</a>
<a href="backend.html" class="text-blue-400 font-medium">Backend</a>
</div>
</div>
<div class="border-t border-gray-700 mt-4 pt-4 text-center text-gray-400">
<p>© 2023 Forex AutoPilot. All rights reserved.</p>
</div>
</div>
</div>
</div>
</body>
</html> |