aboutsummaryrefslogtreecommitdiffstats
path: root/python/Dawn/static/dawn.js
blob: 2d6f03835e1d0bfd471e37e15f0039ec15fdd34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var index_list = [];
var bbg_map = {'CDX': ["IG", "HY"], 'ITRX': ["EUR", "XOVER"]}
var series_map = {'CDX': ["23", "24", "25", "26", "27", "28", "29"],
                  'ITRX': ["22", "24", "25", "26", "27", "28"]};
var index_tenor = ["3Y", "5Y", "7Y", "10Y"];
for(var begin_index in bbg_map){
    for(var i=0; i<bbg_map[begin_index].length; i++){
        for(var j=0; j < series_map[begin_index].length; j++){
            for(var k = 0; k<index_tenor.length; k++){
                index_list.push([begin_index, bbg_map[begin_index][i], 'CDSI',
                                 'S'+series_map[begin_index][j], index_tenor[k]].join(' '));
            }
        }
    }
};

$(function() {
    $('#security_desc').attr('list', 'index_list');
    $('#security_desc').change(function(){
        $.getJSON('../../_ajax', {bbg_id: $(this).val(),
                               trade_date: $('#trade_date').val()}).
            done(function(data) {
                $('#fixed_rate').val(data['coupon']/100);
                $('#security_id').val(data['redcode']);
                $('#maturity').val(data['maturity']);
            });
    });
    $('#swap_type').change(function(){
        if($(this).val()=='CD_INDEX_TRANCHE'){
            $('#attach').parent().parent().css('display','block');
            $('#detach').parent().parent().css('diplay','block');
        }else{
            $('#attach').parent().parent().css('display', 'none');
            $('#detach').parent().parent().css('display', 'none');
        }
    });
    $('#swap_type').change();
    var datalist = $('#index_list');
    index_list.forEach(function(item){
        var option = document.createElement('option');
        option.value = item;
        datalist.append(option);
    });
    //change default value to Following
    $('#payment_rolldate').val('Following');
    $('#upfront').attr('data-toggle', 'tooltip');
    $('#upfront').attr('title', 'This is Cash Amount on the bloomberg ticket, i.e. the net amount we receive.');
    $('#upfront').tooltip();
});