diff options
| -rw-r--r-- | python/api_quotes/__main__.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/python/api_quotes/__main__.py b/python/api_quotes/__main__.py index f2a932fc..53a88ac9 100644 --- a/python/api_quotes/__main__.py +++ b/python/api_quotes/__main__.py @@ -1,23 +1,23 @@ -from .api import MarkitAPI -from .quotes import BondQuote -import pandas as pd import logging +from .api import MarkitAPI +from .quotes import MarkitQuoteKind + logger = logging.getLogger(__name__) if __name__ == "__main__": - asset_class = "ABS" - after = None - while True: - if data := MarkitAPI.get_data(asset_class, after): - for row in data: - try: - quote = BondQuote.from_markit_line(row) - except ValueError as e: - logger.error(f"Couldn't pase {row['quoteid']}: {e}") - else: - quote.stage() - quote.commit() - after = f"{row['receiveddatetime']},{asset_class}-9480-{row['quoteid']}" - else: - break + for asset_class in ("ABS", "CD"): + after = None + while True: + if data := MarkitAPI.get_data(asset_class, after): + for row in data: + try: + quote = MarkitQuoteKind[asset_class].from_markit_line(row) + except ValueError as e: + logger.error(f"Couldn't pase {row['quoteid']}: {e}") + else: + quote.stage() + quote.commit() + after = f"{row['receiveddatetime']},{asset_class}-9480-{row['quoteid']}" + else: + break |
