У меня есть асинхронное приложение FastAPI по умолчанию, в котором есть функция синхронизации
Код: Выделить всё
@classmethod
def make_values(
cls,
records: list,
symbol: str = None,
) -> list:
values = []
for record in records:
new_row = SomePydanticModel(
timestamp=record._mapping.get("time"),
close=record._mapping.get("close"),
value=record._mapping.get("value"),
)
if symbol in EXTRA_SYMBOLS:
new_row = split_row(new_row, symbol)
values.append(new_row)
return values
Код: Выделить всё
async def split_row(
row,
symbol,
):
adjusted_datetime = datetime.timestamp(datetime.strptime("01/01/19", "%m/%d/%y"))
splits = await get_splits(symbol)
# some big part with business logic with other async calls
return row
Подробнее здесь: https://stackoverflow.com/questions/778 ... pplication