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.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/tests/test_index.py b/python/tests/test_index.py
index 3b15cce8..6f127fcd 100644
--- a/python/tests/test_index.py
+++ b/python/tests/test_index.py
@@ -5,6 +5,7 @@ import numpy as np
from pyisda.cdsone import upfront_charge
from analytics import CreditIndex, ForwardIndex
+from analytics.basket_index import BasketIndex
from analytics.index import g
import pickle
@@ -18,6 +19,14 @@ class TestPickle(unittest.TestCase):
a = pickle.loads(pickle.dumps(self.index))
self.assertTrue(hash(a) == hash(self.index))
+ def test_pickle_basket(self):
+ a = BasketIndex("IG", 31, ["5yr"], value_date=datetime.date(2019, 2, 19))
+ self.assertTrue(hash(pickle.loads(pickle.dumps(a))), hash(a))
+
+ def test_from_tradeid(self):
+ ig28 = CreditIndex.from_tradeid(874)
+ self.assertTrue(ig28.spread, 68.)
+
class TestStrike(unittest.TestCase):
index = CreditIndex("ig", 26, "5yr", value_date=datetime.date(2016, 7, 1))