11 lines
290 B
Python
11 lines
290 B
Python
|
|
from __future__ import annotations
|
||
|
|
from pathlib import Path
|
||
|
|
import pandas as pd
|
||
|
|
|
||
|
|
|
||
|
|
def write_trade_log(trades: list[dict], path: Path) -> None:
|
||
|
|
if not trades:
|
||
|
|
return
|
||
|
|
df = pd.DataFrame(trades)
|
||
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||
|
|
df.to_csv(path, index=False)
|