b5bf689e72
- Add yfinance.org and defeatbeta-api.org reference docs - Fix defeatbeta_mapping.org: deprecated yfinance property names (quarterly_financials→quarterly_income_stmt, financials→income_stmt), longName vs longBusinessSummary conceptual mismatch, cashflow note typo - Add Mapping Limitations section with live verification results (AAPL): DuckDB 1.4.3 incompatibility, format differences, coverage gaps - Add docs/test_mapping.py as runnable mapping verification script - Add offline.py, persistent_cache.py, download_data.py, warmup_cache.py for offline/cached defeatbeta usage - Add aapl_yfinance.py exploration script and quant.py scaffold - Add .envrc (uv layout) and update pyproject.toml + uv.lock Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
280 lines
3.9 KiB
Python
280 lines
3.9 KiB
Python
import marimo
|
|
|
|
__generated_with = "0.23.2"
|
|
app = marimo.App(width="full")
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
import yfinance as yf
|
|
import marimo as mo
|
|
ticker = yf.Ticker("AAPL")
|
|
return mo, ticker
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
# AAPL — All Data via yfinance
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Price History
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(ticker):
|
|
history = ticker.history(period="max", interval="1d")
|
|
history
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Info
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
info = ticker.info
|
|
mo.ui.table([info])
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Dividends
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(ticker):
|
|
dividends = ticker.dividends
|
|
dividends
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Splits
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(ticker):
|
|
splits = ticker.splits
|
|
splits
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Income Statement
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
inc = ticker.get_income_stmt()
|
|
mo.ui.table(inc)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Balance Sheet
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
bal = ticker.get_balance_sheet()
|
|
mo.ui.table(bal)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Cash Flow
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
cf = ticker.get_cashflow()
|
|
mo.ui.table(cf)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Recommendations
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
recs = ticker.recommendations
|
|
mo.ui.table(recs)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Analyst Target Prices
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
target = ticker.target_prices
|
|
mo.ui.table([target] if isinstance(target, dict) else target)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Earnings Dates
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
earn_dates = ticker.earnings_dates
|
|
mo.ui.table(earn_dates)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Options
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
expirations = ticker.options
|
|
mo.md(f"Available expirations: {expirations}")
|
|
return (expirations,)
|
|
|
|
|
|
@app.cell
|
|
def _(expirations, mo, ticker):
|
|
sections = []
|
|
for exp in expirations:
|
|
chain = ticker.option_chain(exp)
|
|
sections += [
|
|
mo.md(f"### {exp} — Calls"),
|
|
mo.ui.table(chain.calls),
|
|
mo.md(f"### {exp} — Puts"),
|
|
mo.ui.table(chain.puts),
|
|
]
|
|
mo.vstack(sections) if sections else None
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Major Holders
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
major = ticker.major_holders
|
|
mo.ui.table(major)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Institutional Holders
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
inst = ticker.institutional_holders
|
|
mo.ui.table(inst)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Mutual Fund Holders
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
mf = ticker.mutualfund_holders
|
|
mo.ui.table(mf)
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Sustainability / ESG
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
sus = ticker.sustainability
|
|
mo.ui.table([sus] if sus is not None else [{"data": "No ESG data available"}])
|
|
return
|
|
|
|
|
|
@app.cell(hide_code=True)
|
|
def _(mo):
|
|
mo.md("""
|
|
## Calendar / Events
|
|
""")
|
|
return
|
|
|
|
|
|
@app.cell
|
|
def _(mo, ticker):
|
|
cal = ticker.calendar
|
|
mo.ui.table([cal] if isinstance(cal, dict) else cal)
|
|
return
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|