Investment Spear
An always-on Python trading system that monitors Yahoo Finance news, uses a local Ollama model for sentiment analysis, and places Alpaca paper trades with conservative, cash-only risk controls. It also includes a web dashboard for viewing portfolio activity, news, and AI-driven decisions.
Project Overview
Investment Spear is designed to react to changing market conditions instead of trading a fixed list of stocks. On startup, it uses AI market research to build a diversified symbol universe, then refreshes that universe daily while keeping any currently held positions in scope. The bot continuously pulls market news, analyzes it with local AI, and makes buy, sell, or hold decisions based on sentiment, portfolio context, and risk rules. A Flask-based dashboard provides visibility into the portfolio, news flow, and decision history.
Key Features
- AI-driven symbol selection and daily universe refresh
- News-based trading decisions using Yahoo Finance headlines
- BUY / SELL / HOLD logic with portfolio context and sentiment analysis
- Alpaca paper trading with cash-only execution
- Conservative risk management with reserve capital
- Live dashboard for portfolio, news, and decision tracking
- SQLite logging for trades and decisions
- Automated test suite for core trading behavior
Technical Implementation
The application is built around a continuous trading loop that coordinates market research, news ingestion, decision-making, and execution. A local Ollama model handles symbol research and sentiment analysis. Yahoo Finance provides the news input, Alpaca handles trade execution, and SQLite stores the bot’s activity. The dashboard exposes portfolio and analysis data through a Flask API and a browser UI. The architecture is modular, separating AI logic, broker access, data fetching, storage, and the live bot loop.
Technologies Used
Python 3.11+
Ollama
Alpaca API
Yahoo Finance / yfinance
Flask
SQLite
Pytest
HTML/CSS/JS Frontend
Advanced Features
- Daily refresh of the tracked symbol universe
- Preservation of held positions during universe rotation
- Batch news scanning across the full symbol set
- Cash-only trading with no margin usage
- Local AI execution for privacy and lower external dependency
- Decision logging for later review and debugging
- Separate dashboard for monitoring live activity
- Automated tests covering bot behavior and supporting services
Quality Assurance
- Regression tests for symbol universe merging and news batch processing
- Mocked tests for broker, data, and strategy logic
- Clear separation of concerns across bot, AI, broker, and data layers
- Conservative defaults to reduce trading risk
- Documentation for setup, runtime behavior, and bot options
×