| {% extends 'base.html' %} |
| {% block content %} |
| <article class="card"> |
| <h2>Hasil - {{ result.commodity }} ({{ result.symbol }})</h2> |
| <p> |
| Harga terakhir ({{ result.last_date }}): <b>{{ '{:,.4f}'.format(result.last_close) }}</b><br/> |
| Regime saat ini: <b>Cluster {{ result.current_cluster }}</b> dari k={{ result.k }}<br/> |
| Ekspektasi return hari berikutnya (berdasarkan cluster): <b>{{ '{:.4%}'.format(result.pred_next_ret) }}</b><br/> |
| Prediksi harga besok: <b>{{ '{:,.4f}'.format(result.pred_price) }}</b> |
| </p> |
|
|
|
|
| <h3>Grafik 1 Tahun</h3> |
| <div id="chart" style="height:360px;"></div> |
| <script> |
| const data = [{ x: {{ chart_json['Date']|tojson }}, y: {{ chart_json['close']|tojson }}, mode: 'lines', name: 'Close' }]; |
| const layout = { margin: {l:40, r:20, t:10, b:40} }; |
| Plotly.newPlot('chart', data, layout, {displayModeBar:false}); |
| </script> |
|
|
|
|
| <h3>Ringkasan Cluster</h3> |
| <table> |
| <thead> |
| <tr> |
| <th>Cluster</th> |
| <th>n</th> |
| <th>Avg Next-Day Return</th> |
| <th>Avg Vol(14)</th> |
| <th>Avg Return 5d</th> |
| </tr> |
| </thead> |
| <tbody> |
| {% for row in cluster_table %} |
| <tr {% if row.cluster == result.current_cluster %}class="highlight"{% endif %}> |
| <td>{{ row.cluster }}</td> |
| <td>{{ row.n }}</td> |
| <td>{{ '{:.4%}'.format(row.avg_next_day_return) }}</td> |
| <td>{{ '{:.4%}'.format(row.avg_vol14) }}</td> |
| <td>{{ '{:.4%}'.format(row.avg_return_5d) }}</td> |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
|
|
|
|
| <p class="muted small">Catatan: K-Means mengelompokkan pola (regime) berdasarkan fitur return & volatilitas. Prediksi sederhana = harga terakhir x (1 + rata-rata return esok dari regime yang sama). Ini bukan nasihat keuangan.</p> |
| </article> |
| <p><a href="{{ url_for('index') }}"><- Kembali</a></p> |
| {% endblock %} |