File size: 38,311 Bytes
9b6e815 7f02110 9b6e815 | 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 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | <!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#1e3a8a">
<meta name="description" content="QuantumAI - Plataforma avançada para negociação de opções binárias">
<title>Quantum AI - Plataforma Universal de Opções Binárias</title>
<link rel="manifest" href="/manifest.json">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.gradient-bg {
background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%);
}
.pulse-animation {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}
.chart-container {
height: 300px;
background-color: #1e293b;
border-radius: 0.5rem;
position: relative;
}
.signal-up {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.3) 100%);
border-left: 4px solid #10b981;
}
.signal-down {
background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.3) 100%);
border-left: 4px solid #ef4444;
}
.blink {
animation: blink 1s step-end infinite;
}
@keyframes blink {
50% { opacity: 0.5; }
}
.broker-logo {
height: 30px;
object-fit: contain;
filter: grayscale(100%) brightness(0.8);
transition: all 0.3s ease;
}
.broker-logo:hover {
filter: grayscale(0%) brightness(1);
}
.asset-selector {
scrollbar-width: thin;
scrollbar-color: #3b82f6 #1e293b;
}
.asset-selector::-webkit-scrollbar {
height: 6px;
}
.asset-selector::-webkit-scrollbar-track {
background: #1e293b;
}
.asset-selector::-webkit-scrollbar-thumb {
background-color: #3b82f6;
border-radius: 3px;
}
#priceChart {
width: 100%;
height: 100%;
}
.tradingview-widget-container {
width: 100%;
height: 100%;
}
.active-asset {
background-color: #3b82f6 !important;
color: white !important;
}
/* PWA specific styles */
#installContainer {
position: fixed;
bottom: 1rem;
right: 1rem;
z-index: 1000;
}
#installButton {
background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%);
color: white;
padding: 0.75rem 1.5rem;
border-radius: 2rem;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
gap: 0.5rem;
}
.app-icon {
width: 64px;
height: 64px;
border-radius: 12px;
object-fit: cover;
}
@media (max-width: 768px) {
.chart-container {
height: 250px;
}
#installContainer {
bottom: 5rem;
}
}
</style>
</head>
<body class="bg-gray-900 text-gray-100">
<div class="min-h-screen flex flex-col">
<!-- Install Prompt -->
<div id="installContainer" class="hidden">
<button id="installButton" class="hidden">
<i class="fas fa-download"></i>
Instalar App
</button>
</div>
<!-- Header -->
<header class="gradient-bg py-4 px-6 shadow-lg">
<div class="container mx-auto flex flex-col md:flex-row justify-between items-center space-y-3 md:space-y-0">
<div class="flex items-center space-x-2">
<i class="fas fa-robot text-2xl text-blue-300"></i>
<h1 class="text-2xl font-bold">Quantum<span class="text-blue-300">AI</span></h1>
</div>
<div class="flex flex-wrap justify-center items-center gap-3">
<!-- Broker Logos -->
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Quotex_logo.svg/2560px-Quotex_logo.svg.png" class="broker-logo" title="Quotex">
<img src="https://pocketoption.com/images/logo-white.png" class="broker-logo" title="Pocket Option">
<img src="https://www.iqbroker.com/wp-content/uploads/2022/12/iqoption-logo-white.png" class="broker-logo" title="IQ Option">
<img src="https://www.binary.com/images/binary-logo-white.svg" class="broker-logo" title="Binary.com">
<img src="https://www.raceoption.com/assets/images/logo-white.png" class="broker-logo" title="RaceOption">
</div>
<div class="flex items-center space-x-4">
<div class="bg-blue-800 px-3 py-1 rounded-full flex items-center">
<span class="w-2 h-2 bg-green-400 rounded-full mr-2"></span>
<span class="text-sm">Conectado</span>
</div>
<div class="bg-blue-800 px-3 py-1 rounded-full">
<span class="text-sm">95% Precisão</span>
</div>
<button class="bg-blue-600 hover:bg-blue-700 px-4 py-1 rounded-full text-sm transition">
<i class="fas fa-user mr-1"></i> Conta
</button>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 container mx-auto px-4 py-6 grid grid-cols-1 lg:grid-cols-4 gap-6">
<!-- Left Panel -->
<div class="lg:col-span-3 space-y-6">
<!-- Asset Selector -->
<div class="bg-gray-800 rounded-xl shadow-lg p-3">
<div class="flex overflow-x-auto space-x-3 pb-2 asset-selector" id="assetSelector">
<button class="bg-blue-600 text-white px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0">
<i class="fas fa-star mr-2"></i> Favoritos
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="EURUSD">
EUR/USD
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="GBPUSD">
GBP/USD
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="USDJPY">
USD/JPY
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="BTCUSD">
BTC/USD
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="ETHUSD">
ETH/USD
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="GOLD">
Ouro
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="OIL">
Petróleo
</button>
<button class="asset-btn bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg whitespace-nowrap flex-shrink-0" data-asset="INDICES">
Índices
</button>
</div>
</div>
<!-- Chart Section -->
<div class="bg-gray-800 rounded-xl shadow-lg p-4">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-4 space-y-2 md:space-y-0">
<h2 class="text-xl font-semibold" id="assetTitle">EUR/USD - 1 Minuto</h2>
<div class="flex space-x-2">
<button class="timeframe-btn bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm transition" data-timeframe="1">1M</button>
<button class="timeframe-btn bg-blue-600 px-3 py-1 rounded text-sm" data-timeframe="5">5M</button>
<button class="timeframe-btn bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm transition" data-timeframe="15">15M</button>
<button class="timeframe-btn bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm transition" data-timeframe="60">1H</button>
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm transition">
<i class="fas fa-chart-line mr-1"></i> Indicadores
</button>
</div>
</div>
<div class="chart-container">
<div id="priceChart"></div>
</div>
<div class="mt-4 grid grid-cols-2 gap-4">
<button id="callBtn" class="bg-green-600 hover:bg-green-700 py-3 rounded-lg font-bold text-lg transition flex items-center justify-center">
<i class="fas fa-arrow-up mr-2"></i> CALL (Alta)
</button>
<button id="putBtn" class="bg-red-600 hover:bg-red-700 py-3 rounded-lg font-bold text-lg transition flex items-center justify-center">
<i class="fas fa-arrow-down mr-2"></i> PUT (Baixa)
</button>
</div>
</div>
<!-- Signals Section -->
<div class="bg-gray-800 rounded-xl shadow-lg p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold">Sinais em Tempo Real</h2>
<div class="flex space-x-2">
<button id="refreshSignals" class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm transition">
<i class="fas fa-sync-alt mr-1"></i> Atualizar
</button>
<button class="bg-blue-600 px-3 py-1 rounded text-sm">
<i class="fas fa-filter mr-1"></i> Filtros
</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-700">
<tr>
<th class="py-2 px-4 text-left">Ativo</th>
<th class="py-2 px-4 text-left">Tempo</th>
<th class="py-2 px-4 text-left">Expiração</th>
<th class="py-2 px-4 text-left">Direção</th>
<th class="py-2 px-4 text-left">Resultado</th>
<th class="py-2 px-4 text-left">Precisão</th>
<th class="py-2 px-4 text-left">Broker</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700" id="signalsTable">
<!-- Signals will be added here dynamically -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Right Panel -->
<div class="space-y-6">
<!-- Broker Connection -->
<div class="bg-gray-800 rounded-xl shadow-lg p-4">
<h2 class="text-xl font-semibold mb-4">Conexão com Broker</h2>
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-400 mb-1">Selecione seu Broker</label>
<select id="brokerSelect" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option>Quotex</option>
<option>Pocket Option</option>
<option>IQ Option</option>
<option>Binary.com</option>
<option>RaceOption</option>
<option>Outro Broker</option>
</select>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">API Key</label>
<input type="password" id="apiKey" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Insira sua chave API">
</div>
<button id="connectBtn" class="w-full bg-gradient-to-r from-blue-600 to-blue-500 hover:from-blue-700 hover:to-blue-600 py-3 rounded-lg font-bold transition flex items-center justify-center">
<i class="fas fa-plug mr-2"></i> Conectar
</button>
<div class="text-center text-sm text-gray-400">
<p>Não tem uma conta? <a href="#" class="text-blue-400 hover:underline">Cadastre-se</a> em um dos nossos brokers parceiros</p>
</div>
</div>
</div>
<!-- AI Status -->
<div class="bg-gray-800 rounded-xl shadow-lg p-4">
<h2 class="text-xl font-semibold mb-4">Status do QuantumAI</h2>
<div class="space-y-4">
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium">Precisão Atual</span>
<span class="text-sm font-bold text-green-400" id="accuracyValue">95.2%</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2.5">
<div class="bg-gradient-to-r from-green-400 to-blue-500 h-2.5 rounded-full" id="accuracyBar" style="width: 95.2%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium">Taxa de Acerto</span>
<span class="text-sm font-bold text-green-400" id="winRate">38/40</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2.5">
<div class="bg-gradient-to-r from-blue-400 to-purple-500 h-2.5 rounded-full" style="width: 95%"></div>
</div>
</div>
<div class="bg-blue-900 bg-opacity-30 p-3 rounded-lg border border-blue-700">
<div class="flex items-center">
<div class="p-2 bg-blue-600 rounded-full mr-3">
<i class="fas fa-bolt text-white"></i>
</div>
<div>
<p class="font-semibold">Sinal Ativo</p>
<p class="text-sm text-blue-300" id="activeSignal">Analisando EUR/USD</p>
</div>
</div>
</div>
<button id="autoTradingBtn" class="w-full bg-gradient-to-r from-green-600 to-green-500 hover:from-green-700 hover:to-green-600 py-3 rounded-lg font-bold transition flex items-center justify-center">
<i class="fas fa-play mr-2"></i> Iniciar Operações Automáticas
</button>
</div>
</div>
<!-- Account Summary -->
<div class="bg-gray-800 rounded-xl shadow-lg p-4">
<h2 class="text-xl font-semibold mb-4">Resumo da Conta</h2>
<div class="space-y-3">
<div class="flex justify-between">
<span class="text-gray-400">Saldo</span>
<span class="font-bold" id="accountBalance">R$ 2.450,00</span>
</div>
<div class="flex justify-between">
<span class="text-gray-400">Lucro Hoje</span>
<span class="text-green-400 font-bold" id="todayProfit">+ R$ 425,50</span>
</div>
<div class="flex justify-between">
<span class="text-gray-400">Operações</span>
<span id="tradesCount">12/15</span>
</div>
<div class="flex justify-between">
<span class="text-gray-400">Taxa de Acerto</span>
<span class="text-green-400 font-bold" id="accountWinRate">92.3%</span>
</div>
<div class="pt-3 mt-3 border-t border-gray-700">
<div class="flex justify-between items-center">
<span class="text-gray-400">Próximo Sinal</span>
<span class="flex items-center text-blue-400 blink" id="nextSignalTimer">
<i class="fas fa-circle text-xs mr-1"></i> Em análise
</span>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 py-4 px-6 border-t border-gray-700">
<div class="container mx-auto flex flex-col md:flex-row justify-between items-center">
<div class="flex items-center space-x-2 mb-3 md:mb-0">
<i class="fas fa-robot text-xl text-blue-400"></i>
<span class="font-semibold">Quantum<span class="text-blue-400">AI</span></span>
</div>
<div class="flex space-x-4 mb-3 md:mb-0">
<a href="#" class="text-gray-400 hover:text-white transition">Termos</a>
<a href="#" class="text-gray-400 hover:text-white transition">Privacidade</a>
<a href="#" class="text-gray-400 hover:text-white transition">Suporte</a>
<a href="#" class="text-gray-400 hover:text-white transition">API</a>
<a href="#" class="text-gray-400 hover:text-white transition">Brokers</a>
</div>
<div class="mt-3 md:mt-0">
<span class="text-sm text-gray-500">© 2023 QuantumAI. Plataforma universal para opções binárias.</span>
</div>
</div>
</footer>
</div>
<!-- TradingView Widget Script -->
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
// Global variables
let currentAsset = "EURUSD";
let currentTimeframe = "5";
let isConnected = false;
let autoTradingActive = false;
let accountBalance = 2450.00;
let todayProfit = 425.50;
let tradesCount = { total: 15, successful: 12 };
let nextSignalTime = 0;
let deferredPrompt = null;
// Initialize TradingView chart
function initTradingViewChart() {
new TradingView.widget({
"autosize": true,
"symbol": `FX:${currentAsset}`,
"interval": currentTimeframe,
"timezone": "Etc/UTC",
"theme": "dark",
"style": "1",
"locale": "br",
"toolbar_bg": "#1e293b",
"enable_publishing": false,
"hide_top_toolbar": false,
"hide_side_toolbar": false,
"allow_symbol_change": false,
"container_id": "priceChart"
});
}
// Update asset selection
function updateAssetSelection(asset) {
currentAsset = asset;
document.querySelectorAll('.asset-btn').forEach(btn => {
btn.classList.remove('active-asset');
if(btn.dataset.asset === asset) {
btn.classList.add('active-asset');
}
});
document.getElementById('assetTitle').textContent = `${getAssetName(asset)} - ${currentTimeframe}M`;
document.getElementById('activeSignal').textContent = `Analisando ${getAssetName(asset)}`;
initTradingViewChart();
}
// Update timeframe selection
function updateTimeframeSelection(timeframe) {
currentTimeframe = timeframe;
document.querySelectorAll('.timeframe-btn').forEach(btn => {
btn.classList.remove('bg-blue-600');
btn.classList.add('bg-gray-700');
if(btn.dataset.timeframe === timeframe) {
btn.classList.remove('bg-gray-700');
btn.classList.add('bg-blue-600');
}
});
document.getElementById('assetTitle').textContent = `${getAssetName(currentAsset)} - ${currentTimeframe}M`;
initTradingViewChart();
}
// Get asset display name
function getAssetName(asset) {
const assets = {
"EURUSD": "EUR/USD",
"GBPUSD": "GBP/USD",
"USDJPY": "USD/JPY",
"BTCUSD": "BTC/USD",
"ETHUSD": "ETH/USD",
"GOLD": "Ouro",
"OIL": "Petróleo",
"INDICES": "Índices"
};
return assets[asset] || asset;
}
// Generate random price movement
function simulatePriceMovement() {
const directions = ['up', 'down'];
const direction = directions[Math.floor(Math.random() * directions.length)];
const percentage = (Math.random() * 0.5).toFixed(2);
return {
direction,
percentage,
value: direction === 'up' ?
`+${percentage}%` :
`-${percentage}%`
};
}
// Add new signal to table
function addNewSignal() {
const directions = ['CALL', 'PUT'];
const assets = ['EURUSD', 'GBPUSD', 'USDJPY', 'BTCUSD', 'ETHUSD', 'GOLD', 'OIL'];
const times = ['1 minuto', '5 minutos', '15 minutos'];
const brokers = ['Quotex', 'Pocket Option', 'IQ Option', 'Binary.com', 'RaceOption'];
const direction = directions[Math.floor(Math.random() * directions.length)];
const asset = assets[Math.floor(Math.random() * assets.length)];
const time = times[Math.floor(Math.random() * times.length)];
const broker = brokers[Math.floor(Math.random() * brokers.length)];
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
const timeString = `${hours}:${minutes}:${seconds}`;
// 95% chance of success
const isSuccess = Math.random() < 0.95;
const resultAmount = (50 + Math.random() * 150).toFixed(2);
const accuracy = (90 + Math.random() * 8).toFixed(0);
const newRow = document.createElement('tr');
newRow.className = `signal-${direction === 'CALL' ? 'up' : 'down'} hover:bg-gray-700 transition`;
newRow.innerHTML = `
<td class="py-3 px-4">${getAssetName(asset)}</td>
<td class="py-3 px-4">${timeString}</td>
<td class="py-3 px-4">${time}</td>
<td class="py-3 px-4"><span class="bg-${direction === 'CALL' ? 'green' : 'red'}-600 px-2 py-1 rounded-full text-xs">${direction}</span></td>
<td class="py-3 px-4"><span class="${isSuccess ? 'text-green-400' : 'text-red-400'} font-bold">${isSuccess ? '+' : '-'}R$ ${resultAmount}</span></td>
<td class="py-3 px-4">
<div class="w-full bg-gray-600 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: ${accuracy}%"></div>
</div>
</td>
<td class="py-3 px-4">
<span class="text-xs bg-gray-700 px-2 py-1 rounded">${broker}</span>
</td>
`;
document.getElementById('signalsTable').prepend(newRow);
// Keep only last 10 signals
if (document.getElementById('signalsTable').children.length > 10) {
document.getElementById('signalsTable').removeChild(document.getElementById('signalsTable').lastChild);
}
// Update account stats if this is the current asset
if(asset === currentAsset && autoTradingActive) {
updateAccountAfterTrade(isSuccess, parseFloat(resultAmount));
}
}
// Update account after trade
function updateAccountAfterTrade(isSuccess, amount) {
tradesCount.total++;
if(isSuccess) {
tradesCount.successful++;
accountBalance += amount;
todayProfit += amount;
} else {
accountBalance -= amount;
todayProfit -= amount;
}
// Update UI
const winRate = (tradesCount.successful / tradesCount.total * 100).toFixed(1);
document.getElementById('accountBalance').textContent = `R$ ${accountBalance.toFixed(2).replace('.', ',')}`;
document.getElementById('todayProfit').textContent = `${todayProfit >= 0 ? '+' : '-'} R$ ${Math.abs(todayProfit).toFixed(2).replace('.', ',')}`;
document.getElementById('tradesCount').textContent = `${tradesCount.successful}/${tradesCount.total}`;
document.getElementById('accountWinRate').textContent = `${winRate}%`;
// Update accuracy
const accuracy = 90 + Math.random() * 5;
document.getElementById('accuracyValue').textContent = `${accuracy.toFixed(1)}%`;
document.getElementById('accuracyBar').style.width = `${accuracy}%`;
document.getElementById('winRate').textContent = `${tradesCount.successful}/${tradesCount.total}`;
}
// Update next signal timer
function updateNextSignalTimer() {
if(nextSignalTime <= 0) {
nextSignalTime = 30 + Math.floor(Math.random() * 90);
}
nextSignalTime--;
const minutes = Math.floor(nextSignalTime / 60);
const seconds = nextSignalTime % 60;
document.getElementById('nextSignalTimer').innerHTML = `
<i class="fas fa-circle text-xs mr-1"></i> ${minutes}m ${seconds}s
`;
if(nextSignalTime <= 0) {
addNewSignal();
}
}
// Connect to broker
function connectToBroker() {
const brokerSelect = document.getElementById('brokerSelect');
const selectedBroker = brokerSelect.options[brokerSelect.selectedIndex].text;
const apiKey = document.getElementById('apiKey').value;
if(!apiKey) {
alert('Por favor, insira sua chave API');
return;
}
const connectBtn = document.getElementById('connectBtn');
connectBtn.innerHTML = '<i class="fas fa-sync-alt fa-spin mr-2"></i> Conectando...';
connectBtn.classList.remove('from-blue-600', 'to-blue-500', 'hover:from-blue-700', 'hover:to-blue-600');
connectBtn.classList.add('from-yellow-600', 'to-yellow-500', 'hover:from-yellow-700', 'hover:to-yellow-600');
setTimeout(() => {
isConnected = true;
connectBtn.innerHTML = '<i class="fas fa-check mr-2"></i> Conectado';
connectBtn.classList.remove('from-yellow-600', 'to-yellow-500', 'hover:from-yellow-700', 'hover:to-yellow-600');
connectBtn.classList.add('from-green-600', 'to-green-500', 'hover:from-green-700', 'hover:to-green-600');
// Highlight the connected broker logo
const brokerLogos = document.querySelectorAll('.broker-logo');
brokerLogos.forEach(logo => {
if (logo.title === selectedBroker) {
logo.style.filter = 'grayscale(0%) brightness(1)';
logo.style.transform = 'scale(1.1)';
}
});
// Enable auto trading button
document.getElementById('autoTradingBtn').disabled = false;
// Show success message
alert(`Conectado com sucesso ao ${selectedBroker}!`);
}, 2000);
}
// Toggle auto trading
function toggleAutoTrading() {
const autoTradingBtn = document.getElementById('autoTradingBtn');
if(!isConnected) {
alert('Por favor, conecte-se a um broker primeiro');
return;
}
autoTradingActive = !autoTradingActive;
if(autoTradingActive) {
autoTradingBtn.innerHTML = '<i class="fas fa-stop mr-2"></i> Parar Operações';
autoTradingBtn.classList.remove('from-green-600', 'to-green-500', 'hover:from-green-700', 'hover:to-green-600');
autoTradingBtn.classList.add('from-red-600', 'to-red-500', 'hover:from-red-700', 'hover:to-red-600');
// Start generating signals for current asset
nextSignalTime = 5; // Start soon
} else {
autoTradingBtn.innerHTML = '<i class="fas fa-play mr-2"></i> Iniciar Operações Automáticas';
autoTradingBtn.classList.remove('from-red-600', 'to-red-500', 'hover:from-red-700', 'hover:to-red-600');
autoTradingBtn.classList.add('from-green-600', 'to-green-500', 'hover:from-green-700', 'hover:to-green-600');
}
}
// Place trade (CALL or PUT)
function placeTrade(direction) {
if(!isConnected) {
alert('Por favor, conecte-se a um broker primeiro');
return;
}
const amount = 100; // Fixed trade amount for demo
const isSuccess = Math.random() < 0.95; // 95% success rate
// Show trade confirmation
alert(`Operação ${direction} de R$ ${amount.toFixed(2)} colocada no ${getAssetName(currentAsset)}`);
// Simulate trade result after 5 seconds
setTimeout(() => {
const result = isSuccess ? amount * 0.8 : -amount; // 80% payout for demo
const resultMsg = isSuccess ?
`SUCESSO! Você ganhou R$ ${result.toFixed(2)}` :
`PERDA! Você perdeu R$ ${Math.abs(result).toFixed(2)}`;
alert(resultMsg);
// Update account
updateAccountAfterTrade(isSuccess, Math.abs(result));
}, 5000);
}
// PWA Installation
function setupPWA() {
// Check if the browser supports PWA installation
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later
deferredPrompt = e;
// Show the install button
const installButton = document.getElementById('installButton');
installButton.classList.remove('hidden');
document.getElementById('installContainer').classList.remove('hidden');
// Handle install button click
installButton.addEventListener('click', () => {
// Show the install prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the install prompt');
} else {
console.log('User dismissed the install prompt');
}
deferredPrompt = null;
installButton.classList.add('hidden');
});
});
});
// Check if app is already installed
window.addEventListener('appinstalled', () => {
console.log('PWA was installed');
document.getElementById('installButton').classList.add('hidden');
});
// Register service worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').then(registration => {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(err => {
console.log('ServiceWorker registration failed: ', err);
});
});
}
}
// Initialize the app
function init() {
// Initialize TradingView chart
initTradingViewChart();
// Set default asset and timeframe
updateAssetSelection(currentAsset);
updateTimeframeSelection(currentTimeframe);
// Add some initial signals
for(let i = 0; i < 5; i++) {
setTimeout(addNewSignal, i * 1000);
}
// Set up event listeners
document.querySelectorAll('.asset-btn').forEach(btn => {
btn.addEventListener('click', () => updateAssetSelection(btn.dataset.asset));
});
document.querySelectorAll('.timeframe-btn').forEach(btn => {
btn.addEventListener('click', () => updateTimeframeSelection(btn.dataset.timeframe));
});
document.getElementById('connectBtn').addEventListener('click', connectToBroker);
document.getElementById('autoTradingBtn').addEventListener('click', toggleAutoTrading);
document.getElementById('refreshSignals').addEventListener('click', () => {
addNewSignal();
alert('Sinais atualizados!');
});
document.getElementById('callBtn').addEventListener('click', () => placeTrade('CALL'));
document.getElementById('putBtn').addEventListener('click', () => placeTrade('PUT'));
// Set up PWA
setupPWA();
// Start timers
setInterval(updateNextSignalTimer, 1000);
setInterval(() => {
if(autoTradingActive && Math.random() < 0.3) {
addNewSignal();
}
}, 10000);
}
// Initialize when DOM is loaded
document.addEventListener('DOMContentLoaded', init);
</script>
<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=Kennety/quantumai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |