aboutsummaryrefslogtreecommitdiffstats
path: root/python/task_server
diff options
context:
space:
mode:
Diffstat (limited to 'python/task_server')
-rw-r--r--python/task_server/insert_tranche_quotes.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/python/task_server/insert_tranche_quotes.py b/python/task_server/insert_tranche_quotes.py
index b4053306..7531c32a 100644
--- a/python/task_server/insert_tranche_quotes.py
+++ b/python/task_server/insert_tranche_quotes.py
@@ -13,15 +13,21 @@ quotes = Table('tranche_quotes', metadata, autoload = True)
ins = quotes.insert()
def convert(x):
- try:
- return float(x)
- except ValueError:
+ if x:
+ try:
+ return float(x)
+ except ValueError:
+ logger.info("couldn't convert {0} to float".format(x))
+ else:
return None
def convert_int(x):
- try:
- return int(x)
- except ValueError:
+ if x:
+ try:
+ return int(float(x))
+ except ValueError:
+ logger.info("couldn't convert {0} to int".format(x))
+ else:
return None
tenordict = {'3': '3yr', '5': '5yr', '7':'7yr', '10':'10yr'}