mev-inspect-py/mev_inspect/crud/total_profits.py
Eru Ilúvatar 880992362b
feat: save profit to db (#17)
* feat: save profit to db

Signed-off-by: Arthurim <arthurbdauphine@gmail.com>

* fix: update total profit table and related crud

Signed-off-by: Luca Georges Francois <luca@quartz.technology>

Signed-off-by: Arthurim <arthurbdauphine@gmail.com>
Signed-off-by: Luca Georges Francois <luca@quartz.technology>
Co-authored-by: Luca Georges Francois <luca@quartz.technology>
2022-12-30 07:43:43 +00:00

19 lines
483 B
Python

import json
from typing import List
from mev_inspect.models.total_profits import TotalProfitsModel
from mev_inspect.schemas.total_profits import TotalProfits
def write_total_profits_for_blocks(
inspect_db_session,
total_profits_for_blocks: List[TotalProfits],
) -> None:
models = [
TotalProfitsModel(**json.loads(swap.json()))
for swap in total_profits_for_blocks
]
inspect_db_session.bulk_save_objects(models)
inspect_db_session.commit()