aboutsummaryrefslogtreecommitdiffstats
path: root/risk_insight/static
diff options
context:
space:
mode:
Diffstat (limited to 'risk_insight/static')
-rw-r--r--risk_insight/static/indices.js35
-rw-r--r--risk_insight/static/tranches.js (renamed from risk_insight/static/main.js)2
2 files changed, 36 insertions, 1 deletions
diff --git a/risk_insight/static/indices.js b/risk_insight/static/indices.js
new file mode 100644
index 00000000..ea5786af
--- /dev/null
+++ b/risk_insight/static/indices.js
@@ -0,0 +1,35 @@
+g = new Dygraph(document.getElementById("graph"),
+ [], // path to CSV file
+ { labels: [],
+ title: "Index quotes",
+ showRoller: true,
+ legend: "always"} // options
+ );
+
+function update_graph(g) {
+ return function(e) {
+ var payload = {i: document.getElementById('index').value,
+ s: document.getElementById('series').value,
+ t: document.getElementById('tenor').value};
+ $.getJSON("_data_indices",
+ payload,
+ function(data){
+ var newdata = data["data"].map(function(e){
+ f = e.slice(1);
+ f.unshift(new Date(e[0]));
+ return f});
+ g.updateOptions({'file': newdata, 'labels': data['labels']});
+ });
+ }
+};
+
+
+document.getElementById('index').
+ addEventListener('change', update_graph(g));
+document.getElementById('series').
+ addEventListener('change', update_graph(g));
+document.getElementById('tenor').
+ addEventListener('change', update_graph(g));
+
+var event = new Event('change');
+document.getElementById('index').dispatchEvent(event);
diff --git a/risk_insight/static/main.js b/risk_insight/static/tranches.js
index f4fe9b57..23493461 100644
--- a/risk_insight/static/main.js
+++ b/risk_insight/static/tranches.js
@@ -22,7 +22,7 @@ function update_graph(g) {
if( g.maindiv_.id == "graph1"){
payload['g'] = "skew";
}
- $.getJSON("_data",
+ $.getJSON("_data_tranches",
payload,
function(data){
var newdata = data["data"].map(function(e){