Criar uma rede neura complexa, para buscar os pares criptmoedas e e calcular suas entradas e saidas, use todos dados disponivel, volumes compras vendas , nao use indicadores. para trader de alta alavancagem. crie uma rede neural de teste e outra criando ordens em tempo real e fechando, crie um historio e grafico evolutivo de saldo considere 100 dolares iniciais , e otimize o saldo no maxim - Follow Up Deployment
Browse files- index.html +435 -17
index.html
CHANGED
|
@@ -1,20 +1,438 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
<
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0"
|
| 6 |
-
<
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
<
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Rede Neural para Trading de Criptomoedas</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.neural-network {
|
| 12 |
+
position: relative;
|
| 13 |
+
height: 300px;
|
| 14 |
+
background: #0f172a;
|
| 15 |
+
border-radius: 12px;
|
| 16 |
+
overflow: hidden;
|
| 17 |
+
}
|
| 18 |
+
.neuron {
|
| 19 |
+
position: absolute;
|
| 20 |
+
width: 24px;
|
| 21 |
+
height: 24px;
|
| 22 |
+
border-radius: 50%;
|
| 23 |
+
background: linear-gradient(135deg, #6366f1, #8b5cf6);
|
| 24 |
+
box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
|
| 25 |
+
}
|
| 26 |
+
.connection {
|
| 27 |
+
position: absolute;
|
| 28 |
+
background: linear-gradient(to right, rgba(99, 102, 241, 0.7), rgba(139, 92, 246, 0.7));
|
| 29 |
+
height: 2px;
|
| 30 |
+
transform-origin: 0 50%;
|
| 31 |
+
}
|
| 32 |
+
.pulse {
|
| 33 |
+
animation: pulse 2s infinite;
|
| 34 |
+
}
|
| 35 |
+
@keyframes pulse {
|
| 36 |
+
0% { opacity: 0.3; }
|
| 37 |
+
50% { opacity: 1; }
|
| 38 |
+
100% { opacity: 0.3; }
|
| 39 |
+
}
|
| 40 |
+
.trading-view {
|
| 41 |
+
background: #1e293b;
|
| 42 |
+
border-radius: 12px;
|
| 43 |
+
overflow: hidden;
|
| 44 |
+
}
|
| 45 |
+
</style>
|
| 46 |
+
</head>
|
| 47 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
| 48 |
+
<div class="container mx-auto px-4 py-8">
|
| 49 |
+
<header class="text-center mb-12">
|
| 50 |
+
<h1 class="text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-500">
|
| 51 |
+
Rede Neural para Trading de Criptomoedas
|
| 52 |
+
</h1>
|
| 53 |
+
<p class="text-gray-400 mt-2">Sistema de alta alavancagem com análise em tempo real</p>
|
| 54 |
+
</header>
|
| 55 |
+
|
| 56 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
| 57 |
+
<!-- Painel de controle -->
|
| 58 |
+
<div class="bg-gray-800 p-6 rounded-xl shadow-lg">
|
| 59 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-300">Configurações</h2>
|
| 60 |
+
|
| 61 |
+
<div class="mb-6">
|
| 62 |
+
<label class="block text-gray-400 mb-2">Saldo Inicial</label>
|
| 63 |
+
<div class="text-2xl font-bold text-green-400">$100.00</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div class="mb-6">
|
| 67 |
+
<label class="block text-gray-400 mb-2">Par de Moedas</label>
|
| 68 |
+
<select class="w-full bg-gray-700 text-white rounded-lg p-2 border border-gray-600 focus:border-purple-500 focus:ring-purple-500">
|
| 69 |
+
<option>BTC/USDT</option>
|
| 70 |
+
<option>ETH/USDT</option>
|
| 71 |
+
<option>SOL/USDT</option>
|
| 72 |
+
<option>ADA/USDT</option>
|
| 73 |
+
</select>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<div class="mb-6">
|
| 77 |
+
<label class="block text-gray-400 mb-2">Alavancagem</label>
|
| 78 |
+
<select class="w-full bg-gray-700 text-white rounded-lg p-2 border border-gray-600 focus:border-purple-500 focus:ring-purple-500">
|
| 79 |
+
<option>10x</option>
|
| 80 |
+
<option>25x</option>
|
| 81 |
+
<option selected>50x</option>
|
| 82 |
+
<option>100x</option>
|
| 83 |
+
</select>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div class="mb-6">
|
| 87 |
+
<label class="block text-gray-400 mb-2">Modo de Operação</label>
|
| 88 |
+
<div class="flex space-x-4">
|
| 89 |
+
<button id="simulationBtn" class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-lg flex-1 transition-colors">
|
| 90 |
+
Simulação
|
| 91 |
+
</button>
|
| 92 |
+
<button id="liveBtn" class="bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg flex-1 transition-colors">
|
| 93 |
+
Tempo Real
|
| 94 |
+
</button>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<button id="startBtn" class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 rounded-lg transition-colors flex items-center justify-center">
|
| 99 |
+
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
| 100 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"></path>
|
| 101 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
| 102 |
+
</svg>
|
| 103 |
+
Iniciar Trading
|
| 104 |
+
</button>
|
| 105 |
+
|
| 106 |
+
<button id="stopBtn" class="w-full bg-red-600 hover:bg-red-700 text-white font-bold py-3 rounded-lg mt-4 transition-colors flex items-center justify-center">
|
| 107 |
+
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
| 108 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
| 109 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"></path>
|
| 110 |
+
</svg>
|
| 111 |
+
Parar Trading
|
| 112 |
+
</button>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<!-- Visualização da Rede Neural -->
|
| 116 |
+
<div class="bg-gray-800 p-6 rounded-xl shadow-lg lg:col-span-2">
|
| 117 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-300">Rede Neural em Ação</h2>
|
| 118 |
+
<div class="neural-network" id="neuralNetwork">
|
| 119 |
+
<!-- Neurons and connections will be generated by JavaScript -->
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<div class="grid grid-cols-2 gap-4 mt-6">
|
| 123 |
+
<div class="bg-gray-700 p-4 rounded-lg">
|
| 124 |
+
<h3 class="text-gray-400 text-sm">Precisão</h3>
|
| 125 |
+
<div class="text-2xl font-bold text-blue-400">76.4%</div>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="bg-gray-700 p-4 rounded-lg">
|
| 128 |
+
<h3 class="text-gray-400 text-sm">Ordens Executadas</h3>
|
| 129 |
+
<div class="text-2xl font-bold text-purple-400">42</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<!-- Gráfico de Evolução de Saldo -->
|
| 136 |
+
<div class="bg-gray-800 p-6 rounded-xl shadow-lg mt-8">
|
| 137 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-300">Evolução do Saldo</h2>
|
| 138 |
+
<div class="h-80">
|
| 139 |
+
<canvas id="balanceChart"></canvas>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
<!-- Histórico de Transações -->
|
| 144 |
+
<div class="bg-gray-800 p-6 rounded-xl shadow-lg mt-8">
|
| 145 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-300">Histórico de Transações</h2>
|
| 146 |
+
<div class="overflow-x-auto">
|
| 147 |
+
<table class="w-full text-sm text-left text-gray-400">
|
| 148 |
+
<thead class="text-xs uppercase bg-gray-700 text-gray-400">
|
| 149 |
+
<tr>
|
| 150 |
+
<th class="px-4 py-3">Data/Hora</th>
|
| 151 |
+
<th class="px-4 py-3">Par</th>
|
| 152 |
+
<th class="px-4 py-3">Tipo</th>
|
| 153 |
+
<th class="px-4 py-3">Preço</th>
|
| 154 |
+
<th class="px-4 py-3">Quantidade</th>
|
| 155 |
+
<th class="px-4 py-3">Resultado</th>
|
| 156 |
+
</tr>
|
| 157 |
+
</thead>
|
| 158 |
+
<tbody id="transactionHistory">
|
| 159 |
+
<tr class="border-b border-gray-700">
|
| 160 |
+
<td class="px-4 py-3">-</td>
|
| 161 |
+
<td class="px-4 py-3">-</td>
|
| 162 |
+
<td class="px-4 py-3">-</td>
|
| 163 |
+
<td class="px-4 py-3">-</td>
|
| 164 |
+
<td class="px-4 py-3">-</td>
|
| 165 |
+
<td class="px-4 py-3">-</td>
|
| 166 |
+
</tr>
|
| 167 |
+
</tbody>
|
| 168 |
+
</table>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
</div>
|
| 172 |
+
|
| 173 |
+
<script>
|
| 174 |
+
// Configuração do Tailwind
|
| 175 |
+
tailwind.config = {
|
| 176 |
+
theme: {
|
| 177 |
+
extend: {
|
| 178 |
+
colors: {
|
| 179 |
+
gray: {
|
| 180 |
+
900: '#0f172a',
|
| 181 |
+
800: '#1e293b',
|
| 182 |
+
700: '#334155',
|
| 183 |
+
600: '#475569',
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
// Variáveis globais
|
| 191 |
+
let tradingActive = false;
|
| 192 |
+
let simulationInterval;
|
| 193 |
+
let currentBalance = 100;
|
| 194 |
+
let transactionCount = 0;
|
| 195 |
+
let balanceHistory = [100];
|
| 196 |
+
let chart;
|
| 197 |
+
|
| 198 |
+
// Inicialização
|
| 199 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 200 |
+
createNeuralNetworkVisualization();
|
| 201 |
+
initializeBalanceChart();
|
| 202 |
+
setupEventListeners();
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
// Criar visualização da rede neural
|
| 206 |
+
function createNeuralNetworkVisualization() {
|
| 207 |
+
const container = document.getElementById('neuralNetwork');
|
| 208 |
+
const layers = [4, 6, 5, 3, 1]; // Número de neurônios por camada
|
| 209 |
+
const neurons = [];
|
| 210 |
+
|
| 211 |
+
// Criar neurônios
|
| 212 |
+
layers.forEach((neuronCount, layerIndex) => {
|
| 213 |
+
for (let i = 0; i < neuronCount; i++) {
|
| 214 |
+
const neuron = document.createElement('div');
|
| 215 |
+
neuron.className = 'neuron';
|
| 216 |
+
|
| 217 |
+
// Posicionar os neurônios uniformemente
|
| 218 |
+
const x = 50 + (layerIndex * (container.offsetWidth - 100) / (layers.length - 1));
|
| 219 |
+
const y = 50 + (i * (container.offsetHeight - 100) / (neuronCount - 1 || 1));
|
| 220 |
+
|
| 221 |
+
neuron.style.left = `${x}px`;
|
| 222 |
+
neuron.style.top = `${y}px`;
|
| 223 |
+
|
| 224 |
+
// Adicionar efeito de pulso aleatório
|
| 225 |
+
if (Math.random() > 0.7) {
|
| 226 |
+
neuron.classList.add('pulse');
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
container.appendChild(neuron);
|
| 230 |
+
neurons.push({element: neuron, x, y, layer: layerIndex});
|
| 231 |
+
}
|
| 232 |
+
});
|
| 233 |
+
|
| 234 |
+
// Criar conexões (apenas entre camadas consecutivas)
|
| 235 |
+
for (let l = 0; l < layers.length - 1; l++) {
|
| 236 |
+
const currentLayerNeurons = neurons.filter(n => n.layer === l);
|
| 237 |
+
const nextLayerNeurons = neurons.filter(n => n.layer === l + 1);
|
| 238 |
+
|
| 239 |
+
currentLayerNeurons.forEach(fromNeuron => {
|
| 240 |
+
nextLayerNeurons.forEach(toNeuron => {
|
| 241 |
+
// Criar uma linha entre os neurônios
|
| 242 |
+
const connection = document.createElement('div');
|
| 243 |
+
connection.className = 'connection';
|
| 244 |
+
|
| 245 |
+
const length = Math.sqrt(
|
| 246 |
+
Math.pow(toNeuron.x - fromNeuron.x, 2) +
|
| 247 |
+
Math.pow(toNeuron.y - fromNeuron.y, 2)
|
| 248 |
+
);
|
| 249 |
+
|
| 250 |
+
const angle = Math.atan2(
|
| 251 |
+
toNeuron.y - fromNeuron.y,
|
| 252 |
+
toNeuron.x - fromNeuron.x
|
| 253 |
+
) * 180 / Math.PI;
|
| 254 |
+
|
| 255 |
+
connection.style.width = `${length}px`;
|
| 256 |
+
connection.style.left = `${fromNeuron.x}px`;
|
| 257 |
+
connection.style.top = `${fromNeuron.y}px`;
|
| 258 |
+
connection.style.transform = `rotate(${angle}deg)`;
|
| 259 |
+
connection.style.opacity = 0.1 + Math.random() * 0.3;
|
| 260 |
+
|
| 261 |
+
container.appendChild(connection);
|
| 262 |
+
});
|
| 263 |
+
});
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
// Inicializar gráfico de saldo
|
| 268 |
+
function initializeBalanceChart() {
|
| 269 |
+
const ctx = document.getElementById('balanceChart').getContext('2d');
|
| 270 |
+
chart = new Chart(ctx, {
|
| 271 |
+
type: 'line',
|
| 272 |
+
data: {
|
| 273 |
+
labels: Array.from({length: balanceHistory.length}, (_, i) => `Ordem ${i+1}`),
|
| 274 |
+
datasets: [{
|
| 275 |
+
label: 'Saldo em USD',
|
| 276 |
+
data: balanceHistory,
|
| 277 |
+
borderColor: '#8b5cf6',
|
| 278 |
+
backgroundColor: 'rgba(139, 92, 246, 0.1)',
|
| 279 |
+
borderWidth: 2,
|
| 280 |
+
fill: true,
|
| 281 |
+
tension: 0.3
|
| 282 |
+
}]
|
| 283 |
+
},
|
| 284 |
+
options: {
|
| 285 |
+
responsive: true,
|
| 286 |
+
maintainAspectRatio: false,
|
| 287 |
+
plugins: {
|
| 288 |
+
legend: {
|
| 289 |
+
display: false
|
| 290 |
+
}
|
| 291 |
+
},
|
| 292 |
+
scales: {
|
| 293 |
+
y: {
|
| 294 |
+
beginAtZero: false,
|
| 295 |
+
grid: {
|
| 296 |
+
color: 'rgba(255, 255, 255, 0.1)'
|
| 297 |
+
},
|
| 298 |
+
ticks: {
|
| 299 |
+
color: '#cbd5e1'
|
| 300 |
+
}
|
| 301 |
+
},
|
| 302 |
+
x: {
|
| 303 |
+
grid: {
|
| 304 |
+
color: 'rgba(255, 255, 255, 0.1)'
|
| 305 |
+
},
|
| 306 |
+
ticks: {
|
| 307 |
+
color: '#cbd5e1'
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
});
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// Configurar event listeners
|
| 316 |
+
function setupEventListeners() {
|
| 317 |
+
document.getElementById('startBtn').addEventListener('click', startTrading);
|
| 318 |
+
document.getElementById('stopBtn').addEventListener('click', stopTrading);
|
| 319 |
+
document.getElementById('simulationBtn').addEventListener('click', () => toggleMode('simulation'));
|
| 320 |
+
document.getElementById('liveBtn').addEventListener('click', () => toggleMode('live'));
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// Alternar entre modos de operação
|
| 324 |
+
function toggleMode(mode) {
|
| 325 |
+
const simBtn = document.getElementById('simulationBtn');
|
| 326 |
+
const liveBtn = document.getElementById('liveBtn');
|
| 327 |
+
|
| 328 |
+
if (mode === 'simulation') {
|
| 329 |
+
simBtn.classList.add('bg-purple-600', 'hover:bg-purple-700');
|
| 330 |
+
simBtn.classList.remove('bg-gray-700', 'hover:bg-gray-600');
|
| 331 |
+
liveBtn.classList.add('bg-gray-700', 'hover:bg-gray-600');
|
| 332 |
+
liveBtn.classList.remove('bg-purple-600', 'hover:bg-purple-700');
|
| 333 |
+
} else {
|
| 334 |
+
liveBtn.classList.add('bg-purple-600', 'hover:bg-purple-700');
|
| 335 |
+
liveBtn.classList.remove('bg-gray-700', 'hover:bg-gray-600');
|
| 336 |
+
simBtn.classList.add('bg-gray-700', 'hover:bg-gray-600');
|
| 337 |
+
simBtn.classList.remove('bg-purple-600', 'hover:bg-purple-700');
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// Iniciar trading
|
| 342 |
+
function startTrading() {
|
| 343 |
+
if (tradingActive) return;
|
| 344 |
+
|
| 345 |
+
tradingActive = true;
|
| 346 |
+
document.getElementById('startBtn').disabled = true;
|
| 347 |
+
document.getElementById('startBtn').classList.add('opacity-50');
|
| 348 |
+
|
| 349 |
+
// Simular operações de trading
|
| 350 |
+
simulationInterval = setInterval(() => {
|
| 351 |
+
// Simular uma decisão da rede neural
|
| 352 |
+
const decision = Math.random() > 0.5 ? 'BUY' : 'SELL';
|
| 353 |
+
const pair = document.querySelector('select').value;
|
| 354 |
+
const price = (Math.random() * 10000).toFixed(2);
|
| 355 |
+
const amount = (Math.random() * 0.5).toFixed(4);
|
| 356 |
+
|
| 357 |
+
// Gerar resultado aleatório (ganho ou perda)
|
| 358 |
+
const outcome = Math.random() > 0.4 ? 'PROFIT' : 'LOSS';
|
| 359 |
+
const profitLoss = outcome === 'PROFIT'
|
| 360 |
+
? (Math.random() * 15).toFixed(2)
|
| 361 |
+
: (-Math.random() * 10).toFixed(2);
|
| 362 |
+
|
| 363 |
+
// Atualizar saldo
|
| 364 |
+
currentBalance = parseFloat((currentBalance + parseFloat(profitLoss)).toFixed(2));
|
| 365 |
+
balanceHistory.push(currentBalance);
|
| 366 |
+
|
| 367 |
+
// Atualizar contador de transações
|
| 368 |
+
transactionCount++;
|
| 369 |
+
|
| 370 |
+
// Atualizar histórico
|
| 371 |
+
addTransactionToHistory(new Date(), pair, decision, price, amount, profitLoss);
|
| 372 |
+
|
| 373 |
+
// Atualizar gráfico
|
| 374 |
+
updateBalanceChart();
|
| 375 |
+
|
| 376 |
+
// Atualizar estatísticas
|
| 377 |
+
updateStatistics();
|
| 378 |
+
|
| 379 |
+
}, 3000); // Simular uma operação a cada 3 segundos
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// Parar trading
|
| 383 |
+
function stopTrading() {
|
| 384 |
+
if (!tradingActive) return;
|
| 385 |
+
|
| 386 |
+
tradingActive = false;
|
| 387 |
+
clearInterval(simulationInterval);
|
| 388 |
+
document.getElementById('startBtn').disabled = false;
|
| 389 |
+
document.getElementById('startBtn').classList.remove('opacity-50');
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// Adicionar transação ao histórico
|
| 393 |
+
function addTransactionToHistory(date, pair, type, price, amount, result) {
|
| 394 |
+
const historyTable = document.getElementById('transactionHistory');
|
| 395 |
+
|
| 396 |
+
// Limitar a 10 transações no histórico
|
| 397 |
+
if (historyTable.children.length >= 10) {
|
| 398 |
+
historyTable.removeChild(historyTable.lastChild);
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
const row = document.createElement('tr');
|
| 402 |
+
row.className = 'border-b border-gray-700';
|
| 403 |
+
|
| 404 |
+
const formattedDate = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
|
| 405 |
+
const resultClass = parseFloat(result) >= 0 ? 'text-green-400' : 'text-red-400';
|
| 406 |
+
const resultSymbol = parseFloat(result) >= 0 ? '+' : '';
|
| 407 |
+
|
| 408 |
+
row.innerHTML = `
|
| 409 |
+
<td class="px-4 py-3">${formattedDate}</td>
|
| 410 |
+
<td class="px-4 py-3">${pair}</td>
|
| 411 |
+
<td class="px-4 py-3 ${type === 'BUY' ? 'text-green-400' : 'text-red-400'}">${type}</td>
|
| 412 |
+
<td class="px-4 py-3">${price}</td>
|
| 413 |
+
<td class="px-4 py-3">${amount}</td>
|
| 414 |
+
<td class="px-4 py-3 ${resultClass}">${resultSymbol}${result} USD</td>
|
| 415 |
+
`;
|
| 416 |
+
|
| 417 |
+
historyTable.insertBefore(row, historyTable.firstChild);
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
// Atualizar gráfico de saldo
|
| 421 |
+
function updateBalanceChart() {
|
| 422 |
+
chart.data.labels = Array.from({length: balanceHistory.length}, (_, i) => `Ordem ${i+1}`);
|
| 423 |
+
chart.data.datasets[0].data = balanceHistory;
|
| 424 |
+
chart.update();
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
// Atualizar estatísticas
|
| 428 |
+
function updateStatistics() {
|
| 429 |
+
// Atualizar contador de ordens
|
| 430 |
+
document.querySelector('.text-2xl.text-purple-400').textContent = transactionCount;
|
| 431 |
+
|
| 432 |
+
// Calcular e atualizar precisão (simulada)
|
| 433 |
+
const accuracy = 70 + Math.random() * 15;
|
| 434 |
+
document.querySelector('.text-2xl.text-blue-400').textContent = accuracy.toFixed(1) + '%';
|
| 435 |
+
}
|
| 436 |
+
</script>
|
| 437 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=olywwe/https-huggingface-co-spaces-olywwe-bibytgradio" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 438 |
+
</html>
|