aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/api_quotes/__main__.py6
-rw-r--r--python/api_quotes/quotes.py34
2 files changed, 36 insertions, 4 deletions
diff --git a/python/api_quotes/__main__.py b/python/api_quotes/__main__.py
index 53a88ac9..26e97dc0 100644
--- a/python/api_quotes/__main__.py
+++ b/python/api_quotes/__main__.py
@@ -6,7 +6,11 @@ from .quotes import MarkitQuoteKind
logger = logging.getLogger(__name__)
if __name__ == "__main__":
- for asset_class in ("ABS", "CD"):
+ for asset_class in (
+ "CD",
+ "ABS",
+ "TRS",
+ ):
after = None
while True:
if data := MarkitAPI.get_data(asset_class, after):
diff --git a/python/api_quotes/quotes.py b/python/api_quotes/quotes.py
index 04b6da09..daa3decb 100644
--- a/python/api_quotes/quotes.py
+++ b/python/api_quotes/quotes.py
@@ -26,6 +26,8 @@ class MarkitQuoteKind:
return SingleNameQuote
case "ABS":
return BondQuote
+ case "TRS":
+ return TRSQuote
class MarkitQuote(Deal, table_name=None, deal_type=None):
@@ -114,6 +116,32 @@ class BondQuote(MarkitQuote, table_name="markit_bond_quotes", deal_type=None):
d.update(base_attributes | additional_attributes)
return cls.from_dict(**d)
- @property
- def message(self):
- return QuoteDetails.from_tradeid(self.msg_id)
+
+@dataclass
+class TRSQuote(MarkitQuote, table_name="markit_trs_quotes", deal_type=None):
+ quoteid: int
+ msg_id: str
+ quotesource: str
+ confidence: int
+ maturity: datetime.date
+ identifier: str = None
+ bidlevel: float = None
+ asklevel: float = None
+ nav: float = None
+ ref: float = None
+ firmness: firmness = None
+ funding_benchmark: str = None
+ quotedate: datetime.datetime = None
+
+ @classmethod
+ def from_markit_line(cls, d):
+ base_attributes = super().from_markit_line(d)
+ additional_attributes = {
+ "identifier": d["ticker"],
+ "ref": d.get("reference"),
+ "nav": d.get("inavparsed"),
+ "funding_benchmark": d.get("parsedbenchmark"),
+ "maturity": maturity_dt(d),
+ }
+ d.update(base_attributes | additional_attributes)
+ return cls.from_dict(**d)