A sharp, no-fluff AI stock market assistant — built with Streamlit, powered by Ollama cloud models and real-time Yahoo Finance data.
Stockly.AI is a conversational stock analysis web app. Users can ask natural-language questions about any stock and get concise, data-backed answers alongside a live candlestick chart, key financial metrics, and the latest news headlines — all within a sleek dark-mode interface.
- AI Chat Interface — Conversational Q&A powered by Ollama cloud models (streaming responses)
- Real-Time Stock Data — Live prices, market cap, P/E, EPS, 52-week high/low, beta, dividend yield, and analyst ratings via
yfinance - Candlestick Charts — Interactive OHLC chart with volume overlay via Plotly, supporting 1W / 1M / 3M / 6M / 1Y / 5Y timeframes
- Auto Ticker Detection — Automatically recognizes stock tickers mentioned in chat (e.g. "What do you think about NVDA?") from a curated list of 100+ popular symbols
- Latest News — Fetches and displays the 4 most recent headlines for the active ticker
- Quick Lookup Sidebar — Type any ticker, pick a time range, and pull up the chart instantly
- Popular Stocks Shortcuts — One-click buttons for AAPL, TSLA, NVDA, MSFT, AMZN, META, GOOGL, JPM
- Dark Aesthetic UI — Custom CSS styled after Claude.ai's dark theme using Inter font
| Layer | Technology |
|---|---|
| Frontend / App | Streamlit |
| AI Backend | Ollama Cloud API (streaming) |
| Stock Data | yfinance |
| Charts | Plotly |
| HTTP | requests |
| Data | pandas |
.
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
└── README.md
- Python 3.9+
- An Ollama account with an API key
# 1. Clone the repo
git clone https://github.com/your-username/stockly-ai.git
cd stockly-ai
# 2. Install dependencies
pip install -r requirements.txt
# 3. Add your Ollama API key to Streamlit secrets
mkdir -p .streamlit
echo 'OLLAMA_API_KEY = "your_key_here"' > .streamlit/secrets.toml
# 4. Run the app
streamlit run app.pyThen open http://localhost:8501 in your browser.
The app reads your Ollama API key from Streamlit's secrets manager. Create .streamlit/secrets.toml:
OLLAMA_API_KEY = "your_ollama_api_key_here"When deploying to Streamlit Community Cloud, add this key under App Settings → Secrets.
The active model is selected from the sidebar at runtime. To add or change models, edit the CLOUD_MODELS dictionary in app.py:
CLOUD_MODELS = {
"GPT-OSS 120B": "gpt-oss:120b",
# Add more Ollama-compatible model IDs here
}Two constants control AI response style:
TEMPERATURE = 0.5 # Creativity level (0 = deterministic, 1 = creative)
MAX_TOKENS = 1000 # Max response lengthThe system prompt (SYSTEM_PROMPT) is tuned for concise, data-first stock analysis. Modify it in app.py to adjust the assistant's tone or behavior.
-
Chat — Type any question in the chat bar, e.g.:
- "Analyze Apple stock for me"
- "Will NVDA go up this month?"
- "Compare AAPL vs MSFT vs GOOGL"
- "What's the latest news on Tesla?"
-
Quick Lookup — Enter a ticker in the sidebar and click Show Chart to pull up metrics and the candlestick chart.
-
Popular Stocks — Click any shortcut button in the sidebar (AAPL, TSLA, NVDA, etc.) for instant chart access.
-
Clear / Reset — Use the sidebar buttons to clear chat history or reset to the default AAPL view.
- Push the repo to GitHub.
- Go to share.streamlit.io and connect your repo.
- Set
OLLAMA_API_KEYunder App Settings → Secrets. - Deploy.
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]Stock data is cached with a 5-hour TTL (ttl=18000) using @st.cache_data to avoid redundant API calls to Yahoo Finance. To force a refresh, clear the Streamlit cache via the app menu or restart the server.
Stockly.AI is for informational and educational purposes only. Nothing in this application constitutes financial advice. Always do your own research before making investment decisions.
See LICENSE for details.