blob: 26e97dc0b17c4e9d9892ca5667a8317aad081c94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import logging
from .api import MarkitAPI
from .quotes import MarkitQuoteKind
logger = logging.getLogger(__name__)
if __name__ == "__main__":
for asset_class in (
"CD",
"ABS",
"TRS",
):
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
|