blob: 53a88ac9ee8b27fe7d203d1031cb5374b222e8cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import logging
from .api import MarkitAPI
from .quotes import MarkitQuoteKind
logger = logging.getLogger(__name__)
if __name__ == "__main__":
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
|