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
|
import psycopg2
import datetime
import pdb
conn = psycopg2.connect(database="mlpdb")
cursor = conn.cursor()
# offset=182950
# index = [[offset, 'EU', 19, psycopg2.Date(2016, 06, 20), 'Y3', 100, 0],
# [offset, 'EU', 19, psycopg2.Date(2018, 06, 20), 'Y5', 100, 0],
# [offset, 'EU', 19, psycopg2.Date(2020, 06, 20), 'Y7', 100, 0],
# [offset, 'EU', 19, psycopg2.Date(2023, 06, 20), 'Y10', 100, 0]]
# index = [[offset, 'HY', 17, psycopg2.Date(2014, 12, 20), 'Y3', 96, 0.027075],
# [offset, 'HY', 17, psycopg2.Date(2016, 12, 20), 'Y5', 96, 0.027075],
# [offset, 'HY', 17, psycopg2.Date(2018, 12, 20), 'Y7', 96, 0.027075],
# [offset+10, 'HY', 19, psycopg2.Date(2015, 12, 20), 'Y3', 100, 0],
# [offset+10, 'HY', 19, psycopg2.Date(2017, 12, 20), 'Y5', 100, 0],
# [offset+10, 'HY', 19, psycopg2.Date(2019, 12, 20), 'Y7', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2015, 12, 20), 'Y3', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2017, 12, 20), 'Y5', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2019, 12, 20), 'Y7', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2022, 12, 20), 'Y10', 100, 0],
# [offset+30, 'HY', 15, psycopg2.Date(2015, 12, 20), 'Y3', 96, 0.026375],
# [offset+30, 'HY', 15, psycopg2.Date(2013, 12, 20), 'Y5', 96, 0.026375],
# [offset+30, 'HY', 15, psycopg2.Date(2013, 12, 20), 'Y7', 96, 0.026375],
# ];
# for line in index:
# cursor.execute("INSERT INTO index_desc VALUES({0})".format(",".join(["%s"] * 7)), line)
# conn.commit()
# cursor.close()
# conn.close()
# index = [[offset, 'HY', 17, psycopg2.Date(2014, 12, 20), 'Y3', 96, 0.027075],
# [offset, 'HY', 17, psycopg2.Date(2016, 12, 20), 'Y5', 96, 0.027075],
# [offset, 'HY', 17, psycopg2.Date(2016, 12, 20), 'Y7', 96, 0.027075],
# [offset+10, 'HY', 19, psycopg2.Date(2015, 12, 20), 'Y3', 100, 0],
# [offset+10, 'HY', 19, psycopg2.Date(2017, 12, 20), 'Y5', 100, 0],
# [offset+10, 'HY', 19, psycopg2.Date(2017, 12, 20), 'Y7', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2017, 12, 20), 'Y3', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2017, 12, 20), 'Y5', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2019, 12, 20), 'Y7', 100, 0],
# [offset+20, 'IG', 19, psycopg2.Date(2022, 12, 20), 'Y10', 100, 0],
# [offset+30, 'HY', 15, psycopg2.Date(2015, 12, 20), 'Y3', 96, 0.026375],
# [offset+30, 'HY', 15, psycopg2.Date(2013, 12, 20), 'Y5', 96, 0.026375],
# [offset+30, 'HY', 15, psycopg2.Date(2013, 12, 20), 'Y7', 96, 0.026375],
# ];
# igbasketid = 182920
# igattach = [0, 3, 7, 15, 100]
# igtenors = ['Y3', 'Y5', 'Y7', 'Y10']
# for tenor in igtenors:
# for i, (attach, detach) in enumerate(zip(igattach[:-1], igattach[1:])):
# tranche = [igbasketid+i, igbasketid, tenor, attach, detach]
# cursor.execute("INSERT INTO tranche_desc VALUES(%s, %s, %s, %s, %s)", tranche)
# hyattach = [0, 15, 25, 35, 100]
# hytenors = ['Y3', 'Y5', 'Y7']
# for basketid in [182900, 182930, 182910]:
# for tenor in hytenors:
# for i, (attach, detach) in enumerate(zip(hyattach[:-1], hyattach[1:])):
# tranche = [basketid+i, basketid, tenor, attach, detach]
# cursor.execute("INSERT INTO tranche_desc VALUES(%s, %s, %s, %s, %s)", tranche)
euattach = [0, 3, 6, 9, 12, 22, 100]
eutenors = ['Y3', 'Y5', 'Y7']
eubasketid = 182950
for tenor in eutenors:
for i, (attach, detach) in enumerate(zip(euattach[:-1], euattach[1:])):
tranche = [eubasketid+i, eubasketid, tenor, attach, detach]
cursor.execute("INSERT INTO tranche_desc VALUES(%s, %s, %s, %s, %s)", tranche)
conn.commit()
cursor.close()
conn.close()
|