-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsecurity.py
More file actions
84 lines (79 loc) · 1.83 KB
/
security.py
File metadata and controls
84 lines (79 loc) · 1.83 KB
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
import datetime
from dateutil.parser import parse
class SecurityRef:
securities = [ {
'securityid' : 12345,
'securityidtype' : 'CUSIP',
'assetclass' : 1,
'securityclass' : 5,
'securitytype' : 2,
'country': 'USA',
'countryoforigin': 'USA',
'currency': 'USD',
'settlement': 3,
'daycount': 0,
'fixedcoupon': 1,
'coupon': 2.25,
'frequency': 4,
'issuedate' : parse('2015-10-02'),
'firstcoupondate' : parse('2015-10-19'),
'maturitydate': parse('2025-10-02')
},
{
'securityid' : 12346,
'securityidtype' : 'CUSIP',
'assetclass' : 1,
'securityclass' : 5,
'securitytype' : 2,
'country': 'USA',
'countryoforigin': 'USA',
'currency': 'USD',
'settlement': 3,
'daycount': 0,
'fixedcoupon': 1,
'coupon': 2.25,
'frequency': 4,
'issuedate' : parse('2015-6-25'),
'firstcoupondate' : parse('2015-06-25'),
'maturitydate': parse('2025-10-02')
},
{
'securityid' : 12347,
'securityidtype' : 'CUSIP',
'assetclass' : 1,
'securityclass' : 5,
'securitytype' : 2,
'country': 'USA',
'countryoforigin': 'USA',
'currency': 'USD',
'settlement': 3,
'daycount': 0,
'fixedcoupon': 1,
'coupon': 2.25,
'frequency': 4,
'issuedate' : parse('2015-10-02'),
'firstcoupondate' : parse('2015-10-19'),
'maturitydate': parse('2025-10-02')
},
{
'securityid' : 12348,
'securityidtype' : 'CUSIP',
'assetclass' : 1,
'securityclass' : 5,
'securitytype' : 2,
'country': 'USA',
'countryoforigin': 'USA',
'currency': 'USD',
'settlement': 3,
'daycount': 0,
'fixedcoupon': 1,
'coupon': 2.25,
'frequency': 4,
'issuedate' : parse('2015-10-02'),
'firstcoupondate' : parse('2015-10-19'),
'maturitydate': parse('2025-10-02')
}]
def __init__(self):
self.data = []
def get(self, securitytype, securityid):
return (security for security in self.securities if security['securityid'] == securityid and security['securityidtype'] == securitytype).next()