INNER CODE UNIT · Python

_table

renee-jia/trading-bot · ai_portfolio.py:181

def _table(headers, rows):
    lines = ["| " + " | ".join(headers) + " |", "|" + "|".join(["---"] * len(headers)) + "|"]
    for row in rows:
        lines.append("| " + " | ".join(row) + " |")
    return "\n".join(lines) + "\n"


def _put_cell(x):
    k = x.get("pick")
    if k and x.get("expiry"):
        return f"{x['expiry']} ${k['strike']:.0f}P @ ${k['mid']:.2f}(Δ{k['delta']:.2f},年化 {k['ann_pct']:.0f}%)"
    if x.get("entry_label"):
        return x["entry_label"]
    return "—"


def _levels_cell(x):
    lv = x.get("buy_levels")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…