Adwizard/optimization_web_app/templates/task_detail.html

165 Zeilen
Kein EOL
8,2 KiB
HTML

{% extends "base.html" %}
{% block title %}Задача {{ task.id_task }} - Веб-приложение для оптимизации Adwizard{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
<h2>Задача: {{ task.id_task }}</h2>
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">Информация о задаче</h5>
<table class="table table-borderless">
<tr>
<th width="200">ID задачи:</th>
<td>{{ task.id_task }}</td>
</tr>
<tr>
<th>Критерий оптимизации:</th>
<td>{{ task.optimization_criterion }}</td>
</tr>
<tr>
<th>Статус:</th>
<td>
<span class="badge
{% if task.status == 'Queued' %}bg-warning
{% elif task.status == 'Process' %}bg-info
{% else %}bg-success{% endif %}">
{{ task.status }}
</span>
</td>
</tr>
<tr>
<th>Дата начала:</th>
<td>{{ task.start_date if task.start_date else 'Не указана' }}</td>
</tr>
<tr>
<th>Дата окончания:</th>
<td>{{ task.finish_date if task.finish_date else 'Не указана' }}</td>
</tr>
<tr>
<th>Максимальная длительность:</th>
<td>{{ task.max_duration }}</td>
</tr>
<tr>
<th>Работа:</th>
<td><a href="{{ url_for('job_detail', job_id=task.id_job) }}">Работа {{ task.id_job }}</a></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>Результаты задачи (проходы)</h3>
{% if passes %}
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Проход</th>
<th>Прибыль</th>
<th>Фактор прибыли</th>
<th>Коэффициент Шарпа</th>
<th>Дата прохода</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for pass in passes %}
<tr>
<td>{{ pass.id_pass }}</td>
<td>{{ pass.id_pass or 'N/A' }}</td>
<td>{{ "%.2f"|format(pass.profit|float) if pass.profit else 'N/A' }}</td>
<td>{{ "%.2f"|format(pass.profit_factor|float) if pass.profit_factor else 'N/A' }}</td>
<td>{{ "%.2f"|format(pass.sharpe_ratio|float) if pass.sharpe_ratio else 'N/A' }}</td>
<td>{{ pass.pass_date if pass.pass_date else 'N/A' }}</td>
<td>
<button type="button" class="btn btn-sm btn-outline-secondary"
data-bs-toggle="modal" data-bs-target="#passModal{{ pass.id_pass }}">
Подробнее
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="alert alert-info">
<p>У этой задачи пока нет результатов (проходов).</p>
</div>
{% endif %}
</div>
</div>
<!-- Модальные окна для деталей проходов -->
{% for pass in passes %}
<div class="modal fade" id="passModal{{ pass.id_pass }}" tabindex="-1" aria-labelledby="passModalLabel{{ pass.id_pass }}" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="passModalLabel{{ pass.id_pass }}">Детали прохода {{ pass.id_pass }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-sm">
<tr>
<th width="200">Прибыль:</th>
<td>{{ "%.2f"|format(pass.profit|float) if pass.profit else 'N/A' }}</td>
<th width="200">Фактор прибыли:</th>
<td>{{ "%.2f"|format(pass.profit_factor|float) if pass.profit_factor else 'N/A' }}</td>
</tr>
<tr>
<th>Коэффициент Шарпа:</th>
<td>{{ "%.2f"|format(pass.sharpe_ratio|float) if pass.sharpe_ratio else 'N/A' }}</td>
<th>Восстановительный фактор:</th>
<td>{{ "%.2f"|format(pass.recovery_factor|float) if pass.recovery_factor else 'N/A' }}</td>
</tr>
<tr>
<th>Объем сделок:</th>
<td>{{ "%.2f"|format(pass.deals|float) if pass.deals else 'N/A' }}</td>
<th>Сделки:</th>
<td>{{ "%.2f"|format(pass.trades|float) if pass.trades else 'N/A' }}</td>
</tr>
<tr>
<th>Прибыльные сделки:</th>
<td>{{ "%.2f"|format(pass.profit_trades|float) if pass.profit_trades else 'N/A' }}</td>
<th>Убыточные сделки:</th>
<td>{{ "%.2f"|format(pass.loss_trades|float) if pass.loss_trades else 'N/A' }}</td>
</tr>
<tr>
<th>Прибыль с коротких:</th>
<td>{{ "%.2f"|format(pass.profit_shorttrades|float) if pass.profit_shorttrades else 'N/A' }}</td>
<th>Прибыль с длинных:</th>
<td>{{ "%.2f"|format(pass.profit_longtrades|float) if pass.profit_longtrades else 'N/A' }}</td>
</tr>
<tr>
<th>Макс. просадка баланса:</th>
<td>{{ "%.2f"|format(pass.balance_dd|float) if pass.balance_dd else 'N/A' }}</td>
<th>Макс. просадка капитала:</th>
<td>{{ "%.2f"|format(pass.equity_dd|float) if pass.equity_dd else 'N/A' }}</td>
</tr>
<tr>
<th>Пользовательский критерий:</th>
<td colspan="3">{{ "%.2f"|format(pass.custom_ontester|float) if pass.custom_ontester else 'N/A' }}</td>
</tr>
<tr>
<th>Дата прохода:</th>
<td colspan="3">{{ pass.pass_date if pass.pass_date else 'N/A' }}</td>
</tr>
<tr>
<th>Параметры:</th>
<td colspan="3">{{ pass.params[:200] if pass.params else 'N/A' }}{% if pass.params and pass.params|length > 200 %}...{% endif %}</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>
{% endfor %}
{% endblock %}