SeanChenTaipei 2 years ago
parent 18e401c4db
commit 250c15d384
  1. 8
      main.py
  2. 2
      templates/result.html

@ -35,7 +35,7 @@ SQL_CONFIG = dict(
)
# SQL_CONFIG = dict(
# database="railway",
# user="postgres",
# user="postgres",
# host="containers-us-west-103.railway.app",
# port="5913",
# password="gv5Mh7cPjCm9YTjAmsYD"
@ -388,7 +388,7 @@ def result():
elif request.method=='POST':
role = request.form.get('role')
comp = request.form.get('competition')
if role in ['id', 'annual_ret', 'annual_sr', 'volatility']:
if role in ['id', 'annual_ret', 'annual_sr', 'vol']:
pass
else:
role='id'
@ -403,6 +403,10 @@ def result():
sql="select id, date, name, username, annual_ret, vol, annual_sr, mdd\
from strategy order by id desc limit 50"
curs.execute(sql)
elif role=='vol':
sql=f"select id, date, name, username, annual_ret, vol, annual_sr, mdd\
from strategy order by {role} asc limit 50"
curs.execute(sql)
else:
sql=f"select id, date, name, username, annual_ret, vol, annual_sr, mdd\
from strategy order by {role} desc limit 50"

@ -33,7 +33,7 @@
<option value="id">時間排序</option>
<option value="annual_ret">報酬率排序</option>
<option value="annual_sr">夏普率排序</option>
<option value="volatility">波動率排序</option>
<option value="vol">波動率排序</option>
</select>
</div>
<div class="d-flex flex-column-reverse">

Loading…
Cancel
Save