A small .NET CLI for fetching market data and running a v0 screening workflow (prices + fundamentals, with optional macro/options inputs).
src/StockScreener.Cli/— CLI app (svai) built with Spectre.Console.Clisrc/StockScreener.Core/— domain models + scoring + orchestration (StockScreenerEngine)src/StockScreener.Data/— data providers (prices, fundamentals, macro, options)tests/StockScreener.Tests/— unit tests (xUnit)
- .NET SDK (targets
net10.0)
This repo includes helper scripts that publish and install svai onto your PATH via a symlink.
Default install location: /usr/local/bin/svai.
./install.shUninstall:
./uninstall.shIf you prefer a user-local install (no sudo), use:
PREFIX=~/.local ./install.sh
PREFIX=~/.local ./uninstall.sh
# ensure ~/.local/bin is on your PATHmake publish
make install
make uninstallThis is convenient for development machines because it pins the tool in a repo-local manifest.
make svai-install
# run:
dotnet tool run svai -- --help
# or (dotnet supports this shorthand for local tools):
dotnet svai -- --helpUninstall:
make svai-uninstallShow CLI help:
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- --helpFetch recent daily prices (default provider: Stooq):
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- prices AAPL --days 5Print configured vs effective providers and whether required API keys are present:
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- doctor --verboseRun a simple screen over tickers. This fetches fundamentals + price history per ticker and computes a toy score.
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- screen AAPL,MSFT,NVDA --days 90 --top 10Explain a single ticker (factor breakdown + the inputs used):
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- screen AAPL,MSFT,NVDA --days 90 --explain MSFTBy default, scoring uses raw heuristic inputs.
You can optionally normalize inputs using per-run z-scores (computed only over the tickers in the current screen invocation):
--normalize none(default)--normalize global— z-score across all tickers in the run--normalize sector— z-score within each sector (falls back to global if the sector sample is too small)
Example:
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- screen AAPL,MSFT,NVDA,GOOG --days 90 --normalize globalFilters exclude tickers before scoring (and before optional/expensive calls like options):
--min-fcf-yield <YIELD>--max-pe <PE>--min-roic <ROIC>--max-netdebt-ebitda <X>--min-momentum <R>(20d momentum, e.g.0for non-negative)
Example:
dotnet run --project src/StockScreener.Cli/StockScreener.Cli.csproj -- screen AAPL,MSFT,NVDA --days 90 --max-pe 30 --min-roic 0.1 --min-momentum 0Edit src/StockScreener.Cli/appsettings.json.
Providers are selected via:
Providers:PriceProviderProviders:FundamentalsProviderProviders:MacroProviderProviders:OptionsProvider
Supported implementations (current):
- Prices:
Stooq,Yahoo(unofficial),AlphaVantage - Fundamentals:
Fmp(recommended, default),AlphaVantage, or config fallback - Macro:
Fredor config fallback - Options:
Polygon(may require paid entitlements) or config fallback (returns null)
This project loads environment variables via .NET configuration and (for local dev convenience) also loads a local .env file at startup.
- Copy
.env.exampleto.env - Fill in your real keys in
.env .envis gitignored (do not commit secrets)
Example keys:
Providers__FmpApiKey— Financial Modeling Prep (free tier: 250 req/day)Providers__AlphaVantageApiKey— Alpha Vantage (free tier: 25 req/day)Providers__FredApiKey— FREDProviders__PolygonApiKey— Polygon.io
- Scoring is intentionally naive (toy heuristics). It will evolve toward normalized, sector-aware factors.
- Some APIs have free-tier rate limits. FMP (250 req/day) is recommended over AlphaVantage (25 req/day) for fundamentals.
- Polygon options snapshots may return
403 NOT_AUTHORIZEDdepending on your plan; the CLI degrades gracefully (options snapshot will benone).