add effective user&strategy and strategy result show time interval to second

data-init-fixes
joseph 2 years ago
parent 7068b546bd
commit 8cb0ea7b6d
  1. 13
      main.py
  2. 1
      templates/base.html
  3. 2
      templates/result.html

@ -95,7 +95,18 @@ def rolling_optimize(ret, lookback=126, backtest=126, role="max_sharpe", gamma=N
@app.route('/') @app.route('/')
# @cache.cached(timeout=300) # @cache.cached(timeout=300)
def index(): def index():
return render_template('base.html') conn = psycopg2.connect(**SQL_CONFIG)
cur = conn.cursor()
# Number of effective users
cur.execute("select count(b.a) as num_effective_users from (select min(id) as a from strategy group by username) as b")
num_effective_users = cur.fetchone()[0]
# Number of effective strategies
cur.execute("select count(id) as num_effective_strategies from strategy where annual_sr!=0")
num_effective_strategies = cur.fetchone()[0]
cur.close()
conn.close()
return render_template('base.html',num_effective_users=num_effective_users, num_effective_strategies=num_effective_strategies)
# Login Page # Login Page
@app.route('/login') @app.route('/login')

@ -184,6 +184,7 @@
{% endwith %} {% endwith %}
{% cache 300 %} {% cache 300 %}
<div class="prose lg:prose-xl p-3"> <div class="prose lg:prose-xl p-3">
<h2 class="text-xl font-bold mb-4">有效使用者數:{{num_effective_users}}、有效策略數:{{num_effective_strategies}}</h2>
<h2 class="text-xl font-bold mb-4">平台簡介</h2> <h2 class="text-xl font-bold mb-4">平台簡介</h2>
<hr class="mt-0 mb-2"> <hr class="mt-0 mb-2">
<p class="font-bold"> <p class="font-bold">

@ -81,7 +81,7 @@
<td>{{ info[6] }}</td> <td>{{ info[6] }}</td>
<td>{{ info[5] }}</td> <td>{{ info[5] }}</td>
<td>{{ info[7] }}</td> <td>{{ info[7] }}</td>
<td>{{ info[1]|truncate(16, False, '', 0) }}</td> <td>{{ info[1]|truncate(32, False, '', 0) }}</td>
</tr> </tr>
</thead> </thead>
{% endfor %} {% endfor %}

Loading…
Cancel
Save