|
|
|
@ -10,7 +10,7 @@ |
|
|
|
|
{% block title %}Strategy Page{% endblock%} |
|
|
|
|
{% block style %} |
|
|
|
|
|
|
|
|
|
.input-group > input { |
|
|
|
|
<!-- .input-group > input { |
|
|
|
|
border: 2px solid #8E8E8E; |
|
|
|
|
border-radius: 7px; |
|
|
|
|
} |
|
|
|
@ -21,10 +21,16 @@ |
|
|
|
|
.input-group-lg > select { |
|
|
|
|
border: 2px solid #8E8E8E; |
|
|
|
|
border-radius: 7px; |
|
|
|
|
} |
|
|
|
|
.input-group > span{ |
|
|
|
|
} --> |
|
|
|
|
<!-- .input-group > span{ |
|
|
|
|
bg-dark; |
|
|
|
|
font-bold; |
|
|
|
|
} --> |
|
|
|
|
div.input-group > * { |
|
|
|
|
border-radius: 0px; |
|
|
|
|
} |
|
|
|
|
div.card{ |
|
|
|
|
border-radius: 2px; |
|
|
|
|
} |
|
|
|
|
{% endblock style %} |
|
|
|
|
|
|
|
|
@ -35,51 +41,51 @@ |
|
|
|
|
<div class="card mb-3"> |
|
|
|
|
<!-- <img src="{{ url_for("static", filename="img/stock.jpeg") }}" class="card-img-top" alt="..."> --> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<h5 class="card-title text-xl font-bold">投資組合建立步驟 <i class="bi bi-arrow-down-right-circle-fill"></i></h5> |
|
|
|
|
<h5 class="card-title text-xl font-bold">{% if session.tw == 1 %}台股{% endif %}投資組合建立步驟 <i class="bi bi-arrow-down-right-circle-fill"></i></h5> |
|
|
|
|
<ol class="list-group list-group-flush list-group-numbered"> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">輸入投資組合名稱</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">選擇所參加的課程或競賽</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">選擇資產 (可使用搜索功能篩選)</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">確認資產後按下 "確認資產", 查看資產價格動態圖表</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">確認資產後按下<span class="badge bg-info">確認資產</span>, 查看資產價格動態圖表</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">選擇訓練 / 回測數據比例與最佳化目標函數</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">確認後按下 "建立投資組合", 查看回傳訊息</span></li> |
|
|
|
|
<li class="list-group-item"><span class="ps-2">確認後按下<span class="badge bg-danger">確認建立</span>, 查看回傳訊息</span></li> |
|
|
|
|
</ol> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="input-group-lg"> |
|
|
|
|
<label for="input1" class="form-label text-xl font-bold">投資組合名稱</label> |
|
|
|
|
<input if="imput1" name="portName" type="text" class="form-control" placeholder="EX. 空軍一號" required> |
|
|
|
|
</div> |
|
|
|
|
<div class="input-group-lg mb-3"> |
|
|
|
|
<label for="competition" class="form-label text-xl font-bold">請選擇所參加的課程/競賽</label> |
|
|
|
|
<select id="competition" class="form-select" size="1"> |
|
|
|
|
{% include 'competitions.html' %} |
|
|
|
|
</select> |
|
|
|
|
<div class="card"> |
|
|
|
|
<div class="card-header font-bold text-lg"> |
|
|
|
|
投資組合名稱 |
|
|
|
|
</div> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<input if="imput1" name="portName" type="text" class="form-control" placeholder="EX. " required> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<label for="stockAll" class="form-label text-xl font-bold">選擇資產:</label> |
|
|
|
|
<div class="mb-3 input-group d-flex"> |
|
|
|
|
<input name="assetSelect" class="form-control" list="datalistOptions" id="stockAll" placeholder="輸入資產名稱..."> |
|
|
|
|
<datalist id="datalistOptions"> |
|
|
|
|
{% if session.tw==0 %} |
|
|
|
|
{% for key, data in data_us.items() -%} |
|
|
|
|
<option value="{{ key|e }}">{{ key|e }} | {{ data|e }}</option> |
|
|
|
|
{% endfor %} |
|
|
|
|
{% endif %} |
|
|
|
|
{% for key, data in data_tw.items() -%} |
|
|
|
|
<option value="{{ key|e }}">{{ key|e }} | {{ data|e }} </option> |
|
|
|
|
{% endfor %} |
|
|
|
|
</datalist> |
|
|
|
|
<button class="btn btn-secondary" |
|
|
|
|
type="button btn-lg" |
|
|
|
|
id="addStockBtn"> |
|
|
|
|
加入 |
|
|
|
|
</button> |
|
|
|
|
<div class="card"> |
|
|
|
|
<div class="card-header font-bold text-lg"> |
|
|
|
|
請選擇所參加的課程/競賽 |
|
|
|
|
</div> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<select id="competition" class="form-select" size="1"> |
|
|
|
|
{% include 'competitions.html' %} |
|
|
|
|
</select> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<hr class="my-3"> |
|
|
|
|
|
|
|
|
|
<div class="card"> |
|
|
|
|
<div class="card-header "> |
|
|
|
|
<div class="py-2 font-bold text-lg"> |
|
|
|
|
價格動態圖表 |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<div id="graph"></div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="card"> |
|
|
|
|
<div class="card-header d-flex"> |
|
|
|
|
<div class="py-2 font-bold"> |
|
|
|
|
<div class="py-2 font-bold text-lg-center"> |
|
|
|
|
已選擇的資產 |
|
|
|
|
</div> |
|
|
|
|
<div class="btn-group ms-auto"> |
|
|
|
@ -91,35 +97,57 @@ |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<div class="input-group mb-3"> |
|
|
|
|
<!-- <span class="input-group-text me-auto bg-info" id="inputGroup3">請選擇訓練/回測數據比例</span> --> |
|
|
|
|
<select id="ratio-select" class="form-select"> |
|
|
|
|
<option value="0.5">5:5</option> |
|
|
|
|
<option value="0.6">6:4</option> |
|
|
|
|
<option selected value="0.7">7:3</option> |
|
|
|
|
<option value="0.8">8:2</option> |
|
|
|
|
<option value="0.9">9:1</option> |
|
|
|
|
</select> |
|
|
|
|
<select id="role-select" class="form-select"> |
|
|
|
|
<option selected value="max_sharpe">最大化夏普比率</option> |
|
|
|
|
<option value="max_sortino">最大化索提諾比率</option> |
|
|
|
|
<option value="min_volatility">最小化波動率</option> |
|
|
|
|
</select> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<ol class="list-group list-group-numbered" id="stock-list" type="1"> |
|
|
|
|
<div class="card-body d-flex mb-0"> |
|
|
|
|
<input name="assetSelect" class="form-control" list="datalistOptions" id="stockAll" placeholder="輸入資產名稱..."> |
|
|
|
|
<datalist id="datalistOptions"> |
|
|
|
|
{% if session.tw==0 %} |
|
|
|
|
{% for key, data in data_us.items() -%} |
|
|
|
|
<option value="{{ key|e }}">{{ key|e }} | {{ data|e }}</option> |
|
|
|
|
{% endfor %} |
|
|
|
|
{% endif %} |
|
|
|
|
{% for key, data in data_tw.items() -%} |
|
|
|
|
<option value="{{ key|e }}">{{ key|e }} | {{ data|e }} </option> |
|
|
|
|
{% endfor %} |
|
|
|
|
</datalist> |
|
|
|
|
<button class="btn btn-secondary" |
|
|
|
|
type="button btn-lg" |
|
|
|
|
id="addStockBtn"> |
|
|
|
|
加入 |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<hr class="mb-3"> |
|
|
|
|
<div> |
|
|
|
|
<ol class="list-group list-group-numbered px-3 pb-3" id="stock-list" type="1"> |
|
|
|
|
<li class="list-group-item"> |
|
|
|
|
<span class="px-2">2330.TW | 台積電 | 2000-01-05 ~</span> |
|
|
|
|
<span class="px-2">2330.TW | 台積電</span> |
|
|
|
|
<a class="btn btn-sm btn-danger float-right delete-btn"> |
|
|
|
|
<i class="fas fa-trash-alt"></i> |
|
|
|
|
</a> |
|
|
|
|
</li> |
|
|
|
|
</ol> |
|
|
|
|
</div> |
|
|
|
|
<hr class="my-3"> |
|
|
|
|
<div id="graph" style="border-radius: 10px;"></div> |
|
|
|
|
<div class="input-group mt-3"> |
|
|
|
|
<span class="input-group-text bg-info">訓練 / 回測數據比</span> |
|
|
|
|
<select id="ratio-select" class="form-select"> |
|
|
|
|
<option value="0.5">5:5</option> |
|
|
|
|
<option value="0.6">6:4</option> |
|
|
|
|
<option selected value="0.7">7:3</option> |
|
|
|
|
<option value="0.8">8:2</option> |
|
|
|
|
<option value="0.9">9:1</option> |
|
|
|
|
</select> |
|
|
|
|
</div> |
|
|
|
|
<div class="input-group"> |
|
|
|
|
<span class="input-group-text bg-info">最佳化目標函數</span> |
|
|
|
|
<select id="role-select" class="form-select"> |
|
|
|
|
<option selected value="max_sharpe">最大化夏普比率</option> |
|
|
|
|
<option value="max_sortino">最大化索提諾比率</option> |
|
|
|
|
<option value="min_volatility">最小化波動率</option> |
|
|
|
|
</select> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="modal" id="portModal" tabindex="-1"> |
|
|
|
|
<div class="modal-dialog"> |
|
|
|
|
<div class="modal-content"> |
|
|
|
|