noranisa commited on
Commit
e3032d2
·
verified ·
1 Parent(s): 31c402c

Create result.html

Browse files
Files changed (1) hide show
  1. templates/result.html +50 -0
templates/result.html ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %}
2
+ {% block content %}
3
+ <article class="card">
4
+ <h2>Hasil - {{ result.commodity }} ({{ result.symbol }})</h2>
5
+ <p>
6
+ Harga terakhir ({{ result.last_date }}): <b>{{ '{:,.4f}'.format(result.last_close) }}</b><br/>
7
+ Regime saat ini: <b>Cluster {{ result.current_cluster }}</b> dari k={{ result.k }}<br/>
8
+ Ekspektasi return hari berikutnya (berdasarkan cluster): <b>{{ '{:.4%}'.format(result.pred_next_ret) }}</b><br/>
9
+ Prediksi harga besok: <b>{{ '{:,.4f}'.format(result.pred_price) }}</b>
10
+ </p>
11
+
12
+
13
+ <h3>Grafik 1 Tahun</h3>
14
+ <div id="chart" style="height:360px;"></div>
15
+ <script>
16
+ const data = [{ x: {{ chart_json['Date']|tojson }}, y: {{ chart_json['close']|tojson }}, mode: 'lines', name: 'Close' }];
17
+ const layout = { margin: {l:40, r:20, t:10, b:40} };
18
+ Plotly.newPlot('chart', data, layout, {displayModeBar:false});
19
+ </script>
20
+
21
+
22
+ <h3>Ringkasan Cluster</h3>
23
+ <table>
24
+ <thead>
25
+ <tr>
26
+ <th>Cluster</th>
27
+ <th>n</th>
28
+ <th>Avg Next-Day Return</th>
29
+ <th>Avg Vol(14)</th>
30
+ <th>Avg Return 5d</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ {% for row in cluster_table %}
35
+ <tr {% if row.cluster == result.current_cluster %}class="highlight"{% endif %}>
36
+ <td>{{ row.cluster }}</td>
37
+ <td>{{ row.n }}</td>
38
+ <td>{{ '{:.4%}'.format(row.avg_next_day_return) }}</td>
39
+ <td>{{ '{:.4%}'.format(row.avg_vol14) }}</td>
40
+ <td>{{ '{:.4%}'.format(row.avg_return_5d) }}</td>
41
+ </tr>
42
+ {% endfor %}
43
+ </tbody>
44
+ </table>
45
+
46
+
47
+ <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>
48
+ </article>
49
+ <p><a href="{{ url_for('index') }}"><- Kembali</a></p>
50
+ {% endblock %}