aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/cds_curve.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/cds_curve.py b/python/cds_curve.py
index e11327a5..c9256be9 100644
--- a/python/cds_curve.py
+++ b/python/cds_curve.py
@@ -57,8 +57,9 @@ if __name__=="__main__":
parser.add_argument('--latest', required=False, action="store_true")
args = parser.parse_args()
index, series = args.index, args.series
+ conn = dbconn('serenitasdb')
+
if args.latest:
- conn = dbconn('serenitasdb')
with conn.cursor() as c:
c.execute("SELECT min(date) FROM index_quotes WHERE index=%s AND series=%s "
"AND duration2 is NULL", (index, series))
@@ -70,6 +71,7 @@ if __name__=="__main__":
df = calibrate_portfolio(index, series, ['3yr', '5yr', '7yr', '10yr'],
start_date)
+
with conn.cursor() as c:
for k, s in df.iterrows():
c.execute("UPDATE index_quotes SET duration2=%s, theta2=%s "\