mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-28 11:17:44 +00:00
f930f26839
- CLAUDE.md: project overview, architecture, conventions, key files - Dark mode now covers: trading_bots, portfolio, backtesting, history, bot_detail, backtest_history, settings, notifications, profile, ramadan, forex, stocks — all 12 templates - Consistent dark:bg-slate-800/700/900 + dark:text-gray-*/white patterns Co-Authored-By: Claude <noreply@anthropic.com>
104 lines
6.7 KiB
HTML
104 lines
6.7 KiB
HTML
<!-- templates/backtesting.html (Setelah Refactor) -->
|
|
{% extends "base.html" %}
|
|
|
|
{% block title_key %}nav.backtest{% endblock %}
|
|
{% block title %}Strategy Backtester{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-white" data-i18n="nav.backtest">Strategy Backtester</h2>
|
|
<div class="flex space-x-2">
|
|
<a href="{{ url_for('backtest_history_page') }}" class="bg-gray-200 dark:bg-slate-700 text-gray-800 dark:text-white py-2 px-4 rounded-lg font-medium hover:bg-gray-300 dark:hover:bg-slate-600">
|
|
<i class="fas fa-history mr-2"></i><span data-i18n="action.view">Lihat Riwayat</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Enhanced Engine Info -->
|
|
<div class="mb-6 p-4 bg-blue-50 dark:bg-slate-700 border border-blue-200 dark:border-slate-600 rounded-lg">
|
|
<div class="flex items-start">
|
|
<div class="flex-shrink-0">
|
|
<i class="fas fa-rocket text-blue-600 text-xl"></i>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-blue-800 dark:text-blue-300" data-i18n="backtest.enhanced_engine_active">🚀 Enhanced Backtesting Engine Active</h3>
|
|
<div class="mt-1 text-sm text-blue-700 dark:text-blue-200">
|
|
<p data-i18n="backtest.includes">Your backtesting now includes:</p>
|
|
<ul class="mt-1 list-disc list-inside text-xs space-y-1">
|
|
<li>✅ <strong data-i18n="backtest.realistic_spread">Realistic spread costs</strong> - <span data-i18n="backtest.actual_costs">Actual trading costs deducted</span></li>
|
|
<li>✅ <strong data-i18n="backtest.atr_risk">ATR-based risk management</strong> - <span data-i18n="backtest.dynamic_sizing">Dynamic position sizing</span></li>
|
|
<li>✅ <strong data-i18n="backtest.instrument_protection">Instrument protection</strong> - <span data-i18n="backtest.gold_safeguards">Gold trading safeguards</span></li>
|
|
<li>✅ <strong data-i18n="backtest.slippage">Slippage simulation</strong> - <span data-i18n="backtest.accurate_modeling">More accurate execution modeling</span></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
<!-- Kolom Konfigurasi -->
|
|
<div class="lg:col-span-1 bg-white dark:bg-slate-800 p-6 rounded-lg shadow">
|
|
<form id="backtest-form">
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label for="strategy-select" class="block text-sm font-medium text-gray-700 dark:text-gray-200" data-i18n="label.strategy">Pilih Strategi</label>
|
|
<select id="strategy-select" name="strategy" class="mt-1 block w-full rounded-md border-gray-300 dark:border-slate-600 shadow-sm"></select>
|
|
</div>
|
|
<div>
|
|
<label for="data-file" class="block text-sm font-medium text-gray-700 dark:text-gray-200" data-i18n="backtest.upload_data">Unggah Data Historis (CSV)</label>
|
|
<input type="file" id="data-file" name="file" accept=".csv" class="mt-1 block w-full text-sm text-gray-500 dark:text-gray-400 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 dark:file:bg-slate-600 file:text-blue-700 dark:file:text-blue-300 hover:file:bg-blue-100 dark:hover:file:bg-slate-500" required>
|
|
</div>
|
|
|
|
<!-- Risk Management Inputs (Enhanced Engine) -->
|
|
<div class="grid grid-cols-2 gap-4 pt-4 border-t border-gray-200 dark:border-slate-700">
|
|
<div>
|
|
<label for="sl_atr_multiplier" class="block text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
<span data-i18n="label.sl_atr">SL (ATR Multiplier)</span>
|
|
<span class="text-xs text-blue-600" data-i18n="backtest.enhanced">🚀 Enhanced</span>
|
|
</label>
|
|
<input type="number" name="sl_atr_multiplier" id="sl_atr_multiplier" value="2.0" step="0.1" min="0.5" max="5.0"
|
|
class="mt-1 block w-full rounded-md border-gray-300 dark:border-slate-600 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1" data-i18n="backtest.dynamic_sl">Dynamic SL based on volatility</p>
|
|
</div>
|
|
<div>
|
|
<label for="tp_atr_multiplier" class="block text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
<span data-i18n="label.tp_atr">TP (ATR Multiplier)</span>
|
|
<span class="text-xs text-blue-600" data-i18n="backtest.enhanced">🚀 Enhanced</span>
|
|
</label>
|
|
<input type="number" name="tp_atr_multiplier" id="tp_atr_multiplier" value="4.0" step="0.1" min="1.0" max="10.0"
|
|
class="mt-1 block w-full rounded-md border-gray-300 dark:border-slate-600 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1" data-i18n="backtest.dynamic_tp">Dynamic TP based on volatility</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="params-container" class="space-y-4 pt-4 border-t border-gray-200 dark:border-slate-700">
|
|
<!-- Parameter akan dimuat di sini -->
|
|
<span data-i18n="bots.strategy_params_loaded">Parameter strategi akan dimuat di sini</span>
|
|
</div>
|
|
<button type="submit" id="run-backtest-btn" class="w-full bg-blue-600 text-white py-2 px-4 rounded-lg font-medium hover:bg-blue-700" data-i18n="backtest.run">
|
|
Jalankan Backtest
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Kolom Hasil -->
|
|
<div id="results-container" class="lg:col-span-2 bg-white dark:bg-slate-800 p-6 rounded-lg shadow hidden">
|
|
<h3 class="text-xl font-bold mb-4" data-i18n="backtest.results">Hasil Backtest</h3>
|
|
<div id="results-summary" class="grid grid-cols-2 md:grid-cols-3 gap-4 mb-6"></div>
|
|
<div class="mb-6">
|
|
<canvas id="equity-chart"></canvas>
|
|
</div>
|
|
<div id="results-log"></div>
|
|
</div>
|
|
<div id="loading-spinner" class="lg:col-span-2 flex items-center justify-center hidden">
|
|
<i class="fas fa-spinner fa-spin text-blue-500 text-4xl"></i>
|
|
<p class="ml-4 text-gray-600 dark:text-gray-300" data-i18n="backtest.running">Menjalankan simulasi...</p>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{{ url_for('static', filename='js/backtesting.js') }}"></script>
|
|
{% endblock %}
|