diff options
Diffstat (limited to 'risk_insight/insight.py')
| -rw-r--r-- | risk_insight/insight.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/risk_insight/insight.py b/risk_insight/insight.py index 37cb15ea..533ba2ac 100644 --- a/risk_insight/insight.py +++ b/risk_insight/insight.py @@ -51,20 +51,19 @@ def get_risk_numbers(): data=data) @app.route("/_data_indices") -def get_risk_numbers(): +def get_indices_quotes(): index = request.args.get("i") series = request.args.get("s", 0, int) tenor = request.args.get("t") data = [] db = get_db() - attach = get_attach_from_name(index, series) sqlstr = "SELECT date, closeprice, modelprice, adjcloseprice, adjmodelprice " \ "from index_quotes WHERE index=%s and series=%s " \ "and tenor=%s ORDER BY date" with db.cursor() as c: c.execute(sqlstr, (index.upper(), series, tenor)) - data = [["%s/%s/%s" % (date.year, date.month, date.day)] + val for date, val in c] - return jsonify(labels=["Date"] + ["{0}-{1} {2}".format(l, u, greek) for l, u in zip(attach[:-1], attach[1:])], + data = [["%s/%s/%s" % (date.year, date.month, date.day)] + val for date, *val in c] + return jsonify(labels=["Date", "Close", "FV", "AdjClose", "AdjFV"], data=data) @app.route("/tranches.html") @@ -76,9 +75,9 @@ def tranches(): @app.route("/indices.html") def indices(): - return render_template("indices.html") + return render_template("indices.html", series=[9, 10, 11, 13, 15, 17, 19, 21, 23]) -@app.route("/index.html") +@app.route("/") def main(): return render_template("index.html") |
