diff --git a/main.py b/main.py index 26cbb0a..107895c 100644 --- a/main.py +++ b/main.py @@ -295,8 +295,8 @@ def buildPort(): # Opt Parameters comp = request.form.get('comp') - # ts = int(request.form.get('ts')) - ts = datetime.now().strftime("%Y-%m-%d, %H:%M:%S") + ts = request.form.get('ts') + # ts = datetime.now().strftime("%Y-%m-%d, %H:%M:%S") role = request.form.get('role') lookback = int(request.form.get('lookback')) backtest = int(request.form.get('frequency')) diff --git a/portfolio_builder.py b/portfolio_builder.py index e2ca465..4fdaec0 100644 --- a/portfolio_builder.py +++ b/portfolio_builder.py @@ -49,7 +49,7 @@ class MVO(object): @staticmethod def sharpe_ratio(w, ret): cov = np.cov(ret.T) - print(cov.shape, w.shape) + # print(cov.shape, w.shape) retPort = ret@w # T-dimensional array stdPort = np.std(retPort) return np.mean(retPort)/stdPort @@ -138,7 +138,6 @@ class MVO(object): result = minimize(loss, init, method="SLSQP",\ options=opts, bounds=bnds, tol = None, jac = grad, constraints=cons) sol = result['x'] - print(sol) return np.round(sol, 2) diff --git a/sql_script/create_strategy.sql b/sql_script/create_strategy.sql index f3918ab..98c938c 100644 --- a/sql_script/create_strategy.sql +++ b/sql_script/create_strategy.sql @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS strategy; CREATE TABLE strategy ( id SERIAL PRIMARY KEY, - date VARCHAR(24) NOT NULL, + date VARCHAR(64) NOT NULL, name VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, competition VARCHAR(32) NOT NULL, diff --git a/static/js/addStock.js b/static/js/addStock.js index c809e63..912362e 100644 --- a/static/js/addStock.js +++ b/static/js/addStock.js @@ -100,7 +100,7 @@ $sendPort.click(function(event) { method: 'POST', data: { name: $('input[name=portName]').val(), - ts: Date.now(), + ts: Date(Date.now()), comp: $('#competition').val(), lookback: $('#lookback').val(), frequency: $('#opt-frequency').val(), @@ -110,7 +110,7 @@ $sendPort.click(function(event) { stockList: JSON.stringify(stockList) }, success: function(response) { - console.log(response); + // console.log(response); // var res = JSON.parse(response); event.preventDefault(); // $('#modalTitle').text('完成建立') @@ -151,7 +151,7 @@ $submitBtn.click(function(event) { success: function(response) { $('#graph').html('') var graphs = JSON.parse(response); - console.log(graphs.data); + // console.log(graphs.data); Plotly.newPlot("graph", graphs.data, layout, {responsive: true}); // console.log(response.layout); diff --git a/templates/result.html b/templates/result.html index 7e793cd..5ac27db 100644 --- a/templates/result.html +++ b/templates/result.html @@ -36,12 +36,8 @@