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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
var index_list = [];
var bbg_map = {'CDX': ["IG", "HY"], 'ITRX': ["EUR", "XOVER"]};
var series_map = {'CDX': ["24", "25", "26", "27", "28", "29", "30", "31", "32"],
'ITRX': ["24", "25", "26", "27", "28", "29", "30", "31"]};
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']);
});
});
$('#folder').change(function() {
if ($('#swap_type').val() == 'CD_INDEX') {
switch ($(this).val()) {
case 'IGOPTDEL':
case 'HYOPTDEL':
$('#portfolio').val('OPTIONS');
break;
case 'SER_ITRXCURVE':
case 'SER_IGCURVE':
$('#portfolio').val('CURVE');
break;
case 'HYEQY':
case 'HYMEZ':
case 'HYSNR':
case 'HYINX':
case 'IGEQY':
case 'IGMEZ':
case 'IGSNR':
case 'IGINX':
case 'BSPK':
$('#portfolio').val('TRANCHE');
break;
case 'HEDGE_CLO':
$('#portfolio').val('CLO');
break;
case 'HEDGE_MAC':
$('#portfolio').val('HEDGE_MAC');
break;
case 'HEDGE_CSO':
$('#portfolio').val('STRUCTURED');
break;
case 'HEDGE_MBS':
case 'MBSCDS':
$('#portfolio').val('MORTGAGES');
break;
}
}
});
$('#swap_type').change(function() {
var to_hide, to_show;
switch ($(this).val()) {
case 'CD_INDEX_TRANCHE':
case 'BESPOKE':
to_show = ['orig_attach', 'orig_detach', 'initial_margin_percentage',
'index_ref', 'corr_attach', 'corr_detach'];
to_show.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'block');
});
$('#orig_attach').parent().parent().css('display', 'block');
$('#orig_detach').parent().parent().css('display', 'block');
$('#clearing_facility').parent().parent().css('display', 'none');
$('#clearing_facility').val('');
$('#initial_margin_percentage').parent().parent().css('display', 'block');
$('#account_code').parent().parent().css('display', 'none');
$('#portfolio').val('TRANCHE');
break;
case 'CD_INDEX':
to_hide = ['orig_attach', 'orig_detach', 'initial_margin_percentage',
'corr_attach', 'corr_detach', 'index_ref'];
to_hide.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'none');
});
$('#clearing_facility').parent().parent().css('display', 'block');
$('#clearing_facility').val('ICE-CREDIT');
$('#account_code').parent().parent().css('display', 'block');
$('#folder').change();
break;
case 'ABS_CDS':
to_hide = ['orig_attach', 'orig_detach',
'corr_attach', 'corr_detach', 'index_ref'];
to_hide.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'none');
});
$('#initial_margin_percentage').parent().parent().css('display', 'block');
$('#clearing_facility').parent().parent().css('display', 'none');
$('#clearing_facility').val('');
$('#portfolio').val('MORTGAGES');
break;
case 'CD_BASKET_TRANCHE':
to_show = ['orig_attach', 'orig_detach', 'initial_margin_percentage',
'corr_attach', 'corr_detach', 'index_ref'];
to_show.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'block');
});
$('#clearing_facility').parent().parent().css('display', 'none');
$('#clearing_facility').val('');
$('#portfolio').val('TRANCHE');
break;
case 'SWAPTION':
to_hide = ['fixed_rate', 'index_ref', 'security_desc',
'corr_attach', 'corr_detach'];
to_hide.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'none');
});
$('#portfolio').val('IR');
$('#settlement_type').val('Cash');
break;
case 'CD_INDEX_OPTION':
to_hide = ['orig_attach', 'orig_detach',
'corr_attach', 'corr_detach'];
to_hide.forEach(function(id) {
$('#' + id).parent().parent().css('display', 'none');
});
$('#fixed_rate').parent().parent().css('display', 'block');
$('#index_ref').parent().parent().css('display', 'block');
$('#security_desc').parent().parent().css('display', 'block');
$('#portfolio').val('OPTIONS');
$('#settlement_type').val('Delivery');
break;
}
});
$('#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();
$('#spot_rate').attr('data-toggle', 'tooltip');
$('#spot_rate').attr('title', 'Spot rate must be entered with pairs ordered by dominance. EUR > GBP > USD > CAD > CHF > YEN');
$('#spot_rate').tooltip();
});
|