
Alphaear Stock
Persist and query A-share style stock price and symbol list data locally in SQLite for finance agents and trading-sidecar apps.
Overview
Alphaear-stock is an agent skill most often used in Build (also Idea research and Operate signal storage) that initializes and manages a SQLite stock price and symbol-list database for AlphaEar-style finance agents.
Install
npx skills add https://github.com/rkiding/awesome-finance-skills --skill alphaear-stockWhat is this skill?
- SQLite DatabaseManager with stock_prices OHLCV + change_pct keyed by ticker and date
- stock_list table for code/name pairs with primary-key lookup
- Auto-creates data directory and idx_stock_prices_ticker_date on startup
- Uses pandas/loguru in the AlphaEar stack pattern (signal_flux.db default path)
- Reduced AlphaEar module focused on local signal storage for agent workflows
- Two core tables: stock_prices (OHLCV + change_pct) and stock_list (code, name)
- Default database path: data/signal_flux.db with ticker-date index
Adoption & trust: 999 installs on skills.sh; 2.4k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need a consistent on-disk schema for stock bars and tickers so your agent does not reinvent SQLite setup every time you prototype a finance workflow.
Who is it for?
Indie builders shipping Python-based market research, alerting, or backtest prep who want a small, file-local persistence layer.
Skip if: Teams needing live brokerage execution, regulatory-grade market-data licensing, or a managed cloud warehouse without extending this skill themselves.
When should I use this skill?
You are implementing or extending AlphaEar-style local stock storage and need the standard SQLite schema and DatabaseManager bootstrap.
What do I get? / Deliverables
You get a ready signal_flux.db with indexed price history and symbol metadata your agent can read and write in Python workflows.
- Initialized SQLite file with stock_prices and stock_list schema
- Indexed time-series store agents can query from Python
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
The skill ships a Python database layer (prices + symbol list), which fits the Build phase as backend data infrastructure for finance tooling rather than distribution or ops runbooks. Canonical shelf is backend because the exposed capability is schema initialization, indexing, and SQLite access—not frontend charts or launch SEO.
Where it fits
Cache downloaded daily bars into stock_prices before comparing tickers for a weekend research sprint.
Stand up a minimal signal prototype that reads from signal_flux.db to demo alerts to a cofounder.
Embed DatabaseManager in an agent-run ETL step that normalizes OHLCV rows after a fetch skill returns data.
Point scheduled jobs at the same SQLite path so nightly updates append without breaking the ticker-date index.
How it compares
Local SQLite skill package for agent-driven finance apps—not a hosted market-data API or MCP market feed.
Common Questions / FAQ
Who is alphaear-stock for?
Solo builders and small teams using coding agents to build finance side projects that need durable stock price and symbol tables on disk.
When should I use alphaear-stock?
Use it in Build when adding backend storage; in Idea when prototyping research pipelines that must cache bars; and in Operate when signal jobs append to the same SQLite file.
Is alphaear-stock safe to install?
Review the Security Audits panel on this Prism page and inspect the skill source in your repo before granting filesystem access to agent runs.
SKILL.md
READMESKILL.md - Alphaear Stock
import sqlite3 from pathlib import Path from typing import List, Dict, Optional import pandas as pd from loguru import logger class DatabaseManager: """ AlphaEar Stock Database Manager Reduced version for alphaear-stock skill """ def __init__(self, db_path: str = "data/signal_flux.db"): self.db_path = Path(db_path) self.db_path.parent.mkdir(parents=True, exist_ok=True) self.conn = sqlite3.connect(str(self.db_path), check_same_thread=False) self.conn.row_factory = sqlite3.Row self._init_db() logger.debug(f"💾 Stock Database initialized at {self.db_path}") def _init_db(self): """Initialize stock-related tables""" cursor = self.conn.cursor() # Stock Prices Table cursor.execute(""" CREATE TABLE IF NOT EXISTS stock_prices ( ticker TEXT, date TEXT, open REAL, close REAL, high REAL, low REAL, volume REAL, change_pct REAL, PRIMARY KEY (ticker, date) ) """) # Stock List Table cursor.execute(""" CREATE TABLE IF NOT EXISTS stock_list ( code TEXT PRIMARY KEY, name TEXT ) """) cursor.execute("CREATE INDEX IF NOT EXISTS idx_stock_prices_ticker_date ON stock_prices(ticker, date)") self.conn.commit() # --- Stock Operations --- def save_stock_list(self, df: pd.DataFrame): cursor = self.conn.cursor() try: cursor.execute("DELETE FROM stock_list") data = df[['code', 'name']].to_dict('records') cursor.executemany( "INSERT INTO stock_list (code, name) VALUES (:code, :name)", data ) self.conn.commit() except Exception as e: logger.error(f"Error saving stock list: {e}") def search_stock(self, query: str, limit: int = 5) -> List[Dict]: cursor = self.conn.cursor() wild = f"%{query}%" cursor.execute(""" SELECT code, name FROM stock_list WHERE code LIKE ? OR name LIKE ? LIMIT ? """, (wild, wild, limit)) return [dict(row) for row in cursor.fetchall()] def get_stock_by_code(self, code: str) -> Optional[Dict[str, str]]: if not code: return None clean = "".join([c for c in str(code).strip() if c.isdigit()]) if not clean: return None cursor = self.conn.cursor() cursor.execute("SELECT code, name FROM stock_list WHERE code = ? LIMIT 1", (clean,)) row = cursor.fetchone() return dict(row) if row else None def save_stock_prices(self, ticker: str, df: pd.DataFrame): if df.empty: return cursor = self.conn.cursor() try: for _, row in df.iterrows(): cursor.execute(""" INSERT OR REPLACE INTO stock_prices (ticker, date, open, close, high, low, volume, change_pct) VALUES (?, ?, ?, ?, ?, ?, ?, ?) """, ( ticker, row['date'], row['open'], row['close'], row['high'], row['low'], row['volume'], row['change_pct'] )) self.conn.commit() except Exception as e: logger.error(f"Error saving prices for {ticker}: {e}") def get_stock_prices(self, ticker: str, start_date: str, end_date: str) -> pd.DataFrame: cursor = self.conn.cursor() cursor.execute(""" SELECT * FROM stock_prices WHERE ticker = ? AND date >= ? AND date <= ? ORDER BY date """, (ticker, start_date, end_date)) rows = cursor.fetchall() if not rows: return pd.DataFrame() columns = ['ticker', 'date', 'open', 'close', 'high