aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--risk_insight/risk_insight/static/indices.css16
-rw-r--r--risk_insight/risk_insight/static/indices.js30
-rw-r--r--risk_insight/risk_insight/static/insight.css23
-rw-r--r--risk_insight/risk_insight/static/tranches.js51
-rw-r--r--risk_insight/risk_insight/templates/indices.html4
-rw-r--r--risk_insight/risk_insight/templates/tranches.html79
6 files changed, 102 insertions, 101 deletions
diff --git a/risk_insight/risk_insight/static/indices.css b/risk_insight/risk_insight/static/indices.css
deleted file mode 100644
index e39c79c6..00000000
--- a/risk_insight/risk_insight/static/indices.css
+++ /dev/null
@@ -1,16 +0,0 @@
-body{
- margin: 1em auto;
- width: 1280px;
-}
-
-#graph{
- width:800px;
- height:500px;
- margin: 0 0;
- float: left;
-}
-
-#select-box{
- margin-top: 5em;
- padding-bottom: 1em;
-}
diff --git a/risk_insight/risk_insight/static/indices.js b/risk_insight/risk_insight/static/indices.js
index 4a019b18..d3cc002a 100644
--- a/risk_insight/risk_insight/static/indices.js
+++ b/risk_insight/risk_insight/static/indices.js
@@ -1,10 +1,3 @@
-g = new Dygraph(document.getElementById("graph"),
- [], // path to CSV file
- { labels: [],
- title: "Index quotes",
- showRoller: true,
- legend: "always"});
-
function update_graph(g) {
return function(e) {
var payload = {i: document.getElementById('index').value,
@@ -23,14 +16,17 @@ function update_graph(g) {
}
};
+document.addEventListener("DOMContentLoaded", function(event) {
+ var g = new Dygraph(document.getElementById("graph"),
+ [], // path to CSV file
+ { labels: [],
+ title: "Index quotes",
+ showRoller: true,
+ legend: "always"});
+ ["index", "series", "tenor", "what"].forEach(function(id) {
+ document.getElementById(id).addEventListener('change',
+ update_graph(g))});
+ var event = new Event('change');
+ document.getElementById('index').dispatchEvent(event);
-document.getElementById('index').
- addEventListener('change', update_graph(g));
-document.getElementById('series').
- addEventListener('change', update_graph(g));
-document.getElementById('tenor').
- addEventListener('change', update_graph(g));
-document.getElementById('what').
- addEventListener('change', update_graph(g));
-var event = new Event('change');
-document.getElementById('index').dispatchEvent(event);
+});
diff --git a/risk_insight/risk_insight/static/insight.css b/risk_insight/risk_insight/static/insight.css
new file mode 100644
index 00000000..30cb1768
--- /dev/null
+++ b/risk_insight/risk_insight/static/insight.css
@@ -0,0 +1,23 @@
+/* body{ */
+/* margin: 1em auto; */
+/* width: 1280px; */
+/* } */
+
+.graph{
+ width:800px;
+ height:500px;
+ /* display: inline-block; */
+ margin-right: 5em;
+ float: left;
+}
+
+#select-box{
+ margin-top: 5em;
+ padding-bottom: 1em;
+}
+
+.select-box2{
+ clear: left;
+ margin-left:3em;
+ padding-top: 2em;
+} \ No newline at end of file
diff --git a/risk_insight/risk_insight/static/tranches.js b/risk_insight/risk_insight/static/tranches.js
index 4fe35df4..f7809884 100644
--- a/risk_insight/risk_insight/static/tranches.js
+++ b/risk_insight/risk_insight/static/tranches.js
@@ -1,18 +1,3 @@
-g1 = new Dygraph(document.getElementById("graph1"),
- [], // path to CSV file
- { labels: [],
- title: "Correlation numbers",
- showRoller: true,
- legend: "always"});
-
-g2 = new Dygraph(document.getElementById("graph2"),
- [], // path to CSV file
- { labels: [],
- title: "Risk numbers",
- showRoller: true,
- legend: 'always'})
-;
-
function update_graph(g) {
return function(e) {
var payload = {i: document.getElementById('index').value,
@@ -34,16 +19,30 @@ function update_graph(g) {
}
};
+document.addEventListener("DOMContentLoaded", function(event) {
+ var g1 = new Dygraph(document.getElementById("graph1"),
+ [], // path to CSV file
+ { labels: [],
+ title: "Correlation numbers",
+ showRoller: true,
+ legend: "always"});
-document.getElementById('index').
- addEventListener('change', update_graph(g1));
-document.getElementById('series').
- addEventListener('change', update_graph(g1));
-document.getElementById('tenor').
- addEventListener('change', update_graph(g1));
-document.getElementById('greek').
- addEventListener('change', update_graph(g2));
+ var g2 = new Dygraph(document.getElementById("graph2"),
+ [], // path to CSV file
+ { labels: [],
+ title: "Risk numbers",
+ showRoller: true,
+ legend: 'always'});
-var event = new Event('change');
-document.getElementById('index').dispatchEvent(event);
-document.getElementById('greek').dispatchEvent(event);
+ document.getElementById('index').
+ addEventListener('change', update_graph(g1));
+ document.getElementById('series').
+ addEventListener('change', update_graph(g1));
+ document.getElementById('tenor').
+ addEventListener('change', update_graph(g1));
+ document.getElementById('greek').
+ addEventListener('change', update_graph(g2));
+ var event = new Event('change');
+ document.getElementById('index').dispatchEvent(event);
+ document.getElementById('greek').dispatchEvent(event);
+});
diff --git a/risk_insight/risk_insight/templates/indices.html b/risk_insight/risk_insight/templates/indices.html
index 0b06235b..11950694 100644
--- a/risk_insight/risk_insight/templates/indices.html
+++ b/risk_insight/risk_insight/templates/indices.html
@@ -1,10 +1,10 @@
<!doctype html>
<html>
<head>
- <link href="{{url_for('static',filename='indices.css')}}" rel="stylesheet">
+ <link href="{{url_for('static',filename='insight.css')}}" rel="stylesheet">
</head>
<body>
- <div id="graph">
+ <div id="graph" class="graph">
</div>
<div id="select-box">
<select id="index">
diff --git a/risk_insight/risk_insight/templates/tranches.html b/risk_insight/risk_insight/templates/tranches.html
index d40a7d20..9cec5653 100644
--- a/risk_insight/risk_insight/templates/tranches.html
+++ b/risk_insight/risk_insight/templates/tranches.html
@@ -1,45 +1,44 @@
<!doctype html>
<html>
-<head>
- <script type="text/javascript" src="{{ url_for('static', filename='dygraph-combined.js') }}"></script>
- <script type="text/javascript" src="{{ url_for('static', filename='jquery-2.1.1.min.js') }}"></script>
-</head>
-<body>
- <div id="graph1"
- style="width:800px; height:500px;float:left;margin:auto">
- </div>
- <div id="graph2"
- style="width:800px; height:500px;float:left;padding-left:5em">
- </div>
- <div style="margin-top:5em;display:inline-block">
- <select id="index">
- <option value="ig">IG</option>
- <option value="hy">HY</option>
- <option value="xo">XO</option>
- <option value="eu">EU</option>
+ <head>
+ <link href="{{url_for('static',filename='insight.css')}}" rel="stylesheet">
+ </head>
+ <body>
+ <div id="graph1" class="graph"></div>
+ <div id="graph2" class="graph"></div>
+ <div class="select-box2">
+ <select id="index">
+ <option value="ig">IG</option>
+ <option value="hy">HY</option>
+ <option value="xo">XO</option>
+ <option value="eu">EU</option>
+ </select>
+ <select id="series">
+ {% for s in series %}
+ <option value="{{s}}">{{s}}</option>
+ {% endfor %}
</select>
- <select id="series">
- {% for s in series %}
- <option value="{{s}}">{{s}}</option>
- {% endfor %}
+ <select id="tenor">
+ <option value="3yr">3yr</option>
+ <option value="5yr">5yr</option>
+ <option value="7yr">7yr</option>
+ <option value="10yr">10yr</option>
</select>
- <select id="tenor">
- <option value="3yr">3yr</option>
- <option value="5yr">5yr</option>
- <option value="7yr">7yr</option>
- <option value="10yr">10yr</option>
- </select>
- <select id="greek">
- <option value="Dealer Deltas">Dealer Delta</option>
- <option value="Model Deltas">Model Delta</option>
- <option value="Forward Deltas">Forward Delta</option>
- <option value="gammas">Gamma</option>
- <option value="thetas">Theta</option>
- <option value="corr01">Corr01</option>
- <option value="durations">Duration</option>
- <option value="el">Expected Loss</option>
- </select>
- </div>
- <script type="text/javascript" src="{{ url_for('static', filename='tranches.js') }}"></script>
-</body>
+ </div>
+ <div class="select-box2">
+ <select id="greek">
+ <option value="Dealer Deltas">Dealer Delta</option>
+ <option value="Model Deltas">Model Delta</option>
+ <option value="Forward Deltas">Forward Delta</option>
+ <option value="gammas">Gamma</option>
+ <option value="thetas">Theta</option>
+ <option value="corr01">Corr01</option>
+ <option value="durations">Duration</option>
+ <option value="el">Expected Loss</option>
+ </select>
+ </div>
+ <script type="text/javascript" src="{{ url_for('static', filename='tranches.js') }}"></script>
+ <script type="text/javascript" src="{{ url_for('static', filename='dygraph-combined.js') }}"></script>
+ <script type="text/javascript" src="{{ url_for('static', filename='jquery-2.1.1.min.js') }}"></script>
+ </body>
</html>