diff --git a/main.py b/main.py
index 107895c..6509069 100644
--- a/main.py
+++ b/main.py
@@ -251,11 +251,13 @@ def submit_stock_list():
## Query DB
conn = psycopg2.connect(**SQL_CONFIG)
port = get_stock(conn, stock_list, session['tw'])
- if len(port.index) > 750:
- port = port.iloc[-750:, :]
+ if len(port.index) > 908:
+ port = port.iloc[-908:, :]
conn.close()
+ port = port.iloc[::3, :]
+ port = port/port.iloc[0, :]
- fig = port.plot(title='資產價格走勢', labels=dict(index="Date", value="Price", variable="Assets"))
+ fig = port.plot(title='資產價格變化', labels=dict(index="Date", value="Price", variable="Assets"))
fig['layout'] = {}
# 序列化
@@ -277,7 +279,7 @@ def buildPort():
if not 'tw' in session:
return redirect(url_for('index'))
# Stop frequently building strategy
- if time.time() - session['lastCreateTime'] < 10:
+ if time.time() - session['lastCreateTime'] < 60:
print("UNTIL: ", time.time()-session['lastCreateTime'])
return '''投資組合建立時間間隔(或與登入時間間隔)必須大於60秒!'''
# print('last_creation', time.time() - session['lastCreateTime'])
@@ -305,8 +307,6 @@ def buildPort():
stock_list = json.loads(request.form.get('stockList'))
- ratio=0.7
-
# Algorithm MVO
print("-"*10)
print("Enter Algorithms")
@@ -325,9 +325,9 @@ def buildPort():
n = len(port.index)
if n < lookback+backtest+63:
return f'''投資組合無法建立,資料長度與所選參數不符。'''
- elif n > 757+lookback:
- port = port.iloc[-(757+lookback):, :]
- market = market.iloc[-757:]
+ elif n > 909+lookback:
+ port = port.iloc[-(909+lookback):, :]
+ market = market.iloc[-909:]
else:
market = market.iloc[lookback:]
diff --git a/static/js/addStock.js b/static/js/addStock.js
index 912362e..a5472e4 100644
--- a/static/js/addStock.js
+++ b/static/js/addStock.js
@@ -4,7 +4,7 @@ let currentList = [];
const layout={'autosize': true, 'markers':true,
'title': {'text': ''},
'xaxis': {'anchor': 'y', 'domain': [0.0, 1.0], 'rangeslider': {'visible': true}},
-'yaxis': {'anchor': 'x', 'domain': [0.0, 1.0], 'fixedrange': false},
+'yaxis': {'anchor': 'x', 'domain': [0.0, 1.0]},
'legend': {'yanchor': 'top', 'y': 1.1, 'xanchor': 'left', 'x': 0.01, 'orientation':'h'},
'margin': {'l': 25, 'r': 5, 't': 10, 'b': 5},
}
diff --git a/templates/base.html b/templates/base.html
index d892d4b..9603407 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -23,8 +23,8 @@
{% endblock %}