diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/api_quotes/__main__.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/python/api_quotes/__main__.py b/python/api_quotes/__main__.py new file mode 100644 index 00000000..abe65fda --- /dev/null +++ b/python/api_quotes/__main__.py @@ -0,0 +1,24 @@ +from .api import MarkitAPI +from .quotes import Quote +import pandas as pd +import logging + +logger = logging.getLogger(__name__) + +if __name__ == "__main__": + asset_class = "CD" + after = None + for i in range(1000): + if data := MarkitAPI.get_data(asset_class, after): + for row in data: + if row["confidence"] == 10: + try: + quote = Quote.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 |
