Files
trading-agent/state/sandbox/tmps_0krww5/script.py
T

7 lines
290 B
Python

import yfinance as yf, matplotlib.pyplot as plt
df = yf.download("AAPL", period="3mo", progress=False)
df["SMA20"] = df["Close"].rolling(20).mean()
print("rows", len(df), "last close", round(float(df["Close"].iloc[-1]),2))
df[["Close","SMA20"]].plot(title="AAPL"); plt.savefig("aapl.png")