blob: e0cf8708c3f53b00d4ab195de82c6584c7f9923a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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
while True:
if data := MarkitAPI.get_data(asset_class, after):
for row in data:
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
|