aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/test_index.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/test_index.py')
-rw-r--r--python/tests/test_index.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/tests/test_index.py b/python/tests/test_index.py
index 89677bbe..c21ad371 100644
--- a/python/tests/test_index.py
+++ b/python/tests/test_index.py
@@ -4,6 +4,7 @@ import datetime
from serenitas.analytics.index import CreditIndex, ForwardIndex
from serenitas.analytics.basket_index import BasketIndex
from serenitas.analytics.index import g
+from serenitas.utils.db import dbconn
import pickle
@@ -79,5 +80,16 @@ class TestForwardIndex(unittest.TestCase):
self.assertAlmostEqual(fi.forward_pv, self.index.clean_pv / self.index.notional)
+class TestIndexTrade(unittest.TestCase):
+ def test_traded_level(self):
+ trade = CreditIndex.from_tradeid(3436)
+ dawndb = dbconn("dawndb")
+ with dawndb.cursor() as c:
+ c.execute("SELECT traded_level FROM cds WHERE id=%s", (3436,))
+ (spread,) = c.fetchone()
+ dawndb.commit()
+ self.assertAlmostEqual(trade.spread, float(spread))
+
+
if __name__ == "__main__":
unittest.main()