diff options
Diffstat (limited to 'python/api_quotes/quotes.py')
| -rw-r--r-- | python/api_quotes/quotes.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/api_quotes/quotes.py b/python/api_quotes/quotes.py index bc951aa8..dc5d856c 100644 --- a/python/api_quotes/quotes.py +++ b/python/api_quotes/quotes.py @@ -3,6 +3,7 @@ from dataclasses import dataclass, field import datetime from typing import Literal from serenitas.utils.db2 import dbconn +import datetime firmness = Literal["FIRM", "INDICATIVE"] asset_class = Literal["CD"] @@ -33,7 +34,7 @@ class Quote(Deal, table_name="markit_quotes", deal_type=None): asksize: float firmness: firmness msg_id: str - quotedate: datetime + quotedate: datetime.datetime quotesource: str @classmethod @@ -43,7 +44,7 @@ class Quote(Deal, table_name="markit_quotes", deal_type=None): int(d["maturityyear"]), int(d["maturitymonth"]), int(d["maturityday"]) ), "msg_id": d["message"]["id"], - "quotedate": d["receiveddatetime"], + "quotedate": datetime.datetime.fromtimestamp(d["receiveddatetime"] / 1000), "quotesource": d["sourceshortname"], "tenor": f"{d['tenor']}Y", } @@ -57,5 +58,5 @@ class Quote(Deal, table_name="markit_quotes", deal_type=None): Quote.init_dbconn(dbconn("serenitasdb")) Quote._sql_insert = Quote._sql_insert.replace( - "RETURNING *", "ON CONFLICT DO NOTHING RETURNING *" + "RETURNING *", "ON CONFLICT (quoteid) DO NOTHING RETURNING *" ) |
