INNER CODE UNIT · Python
_item
renee-jia/trading-bot · ai_portfolio.py:93
def _item(n, row, card, plan):
ind = (row or {}).get("indicators") or {}
sr = (row or {}).get("score_result") or {}
price = _num(ind.get("price")) if row else _num((plan or {}).get("spot"))
levels = (plan or {}).get("levels") or {}
pick = (plan or {}).get("pick")
earnings = (plan or {}).get("earnings")
if hasattr(earnings, "strftime"):
earnings = earnings.strftime("%Y-%m-%d")
return {
"ticker": n,
"layer": LAYER.get(n, ""),
"name": (row or {}).get("name") or (plan or {}).get("name")
or (UNIVERSE.get(n) or {}).get("name") or n,
"in_run": row is not None,
"price": price,
"change_1d": _num(ind.get("change_1d")) if row else _num((plan or {}).get("change_1d")),
"change_5d": _num(ind.get("change_5d")),