Build It With MetricDuck: Developer Tutorials for Financial Data APIs
Developer tutorials that ship working code. Each lab walks you through building a real financial tool with the MetricDuck API — from stock comparison tools to valuation alerts. Clone the repo, run the code, extend it for your own projects.
Build It With MetricDuck
Developer tutorials for financial data APIs
Each tutorial walks you through building a real financial tool with the MetricDuck API. Clone the repo, run the code, extend it for your own projects.
No API key required to start. Guest access gives you all 70 metrics and 12 dimensions. Register free for 500 credits/day to build more.
The Labs
All labs live in our public GitHub repo: github.com/metric-duck/build-with-metricduck
Lab 02: Stock Showdown
Compare any two stocks across Valuation and Quality panels using 7 metrics — 5 of which are MetricDuck exclusives not available in yfinance.
What you'll build:
- Fetch 7 metrics for 2 tickers in a single API call
- Panel 1 (Valuation): PE, EV/EBITDA, EV/EBIT
*, FCF Yield* - Panel 2 (Quality): ROIC
*, FCF Margin*, Total Shareholder Yield* - Multi-dimensional verdict: valuation winner + quality winner + ROIC highlight
- Optional yfinance integration for sector, beta, 52-week range
git clone https://github.com/metric-duck/build-with-metricduck.git
cd build-with-metricduck/labs/02-stock-showdown
pip install -r requirements.txt
python showdown.py NVDA AMD
Lab 03: Stock Pulse (Value Trap Detector)
Check any stock against its own 2-year history using Q.MED8 (median) and Q.TREND8 (trend) dimensions. The tool diagnoses whether a stock is an OPPORTUNITY, EARNING IT, WATCH, VALUE TRAP, or STABLE.
What you'll build:
- Fetch 8 metrics with 4 statistical dimensions for any ticker in a single API call
- Vital Signs: ROIC, Gross Margin, Operating Margin, FCF Margin vs 2-year median
- Valuation: PE Ratio and EV/EBITDA trend direction
- 5-word diagnosis: OPPORTUNITY / EARNING IT / WATCH / VALUE TRAP / STABLE
- Optional
--jsonoutput for chaining with other tools
git clone https://github.com/metric-duck/build-with-metricduck.git
cd build-with-metricduck/labs/03-stock-pulse
pip install -r requirements.txt
python pulse.py NVDA
Lab 04: Stock Screener
Screen 50+ stocks by Quality (ROIC, FCF Margin) and Value (PE, FCF Yield, EV/EBITDA). Percentile-ranked composite score finds stocks that are strong businesses and reasonably priced.
What you'll build:
- Fetch the top 50 companies by market cap from the universe endpoint
- Score each on 5 metrics using percentile normalization
- Composite score: Quality (60%) + Value (40%), fully configurable
- Signal labels: QUALITY / VALUE / BALANCED
- Optional
--jsonoutput, custom--tickerslist,--top N
git clone https://github.com/metric-duck/build-with-metricduck.git
cd build-with-metricduck/labs/04-stock-screener
pip install -r requirements.txt
python screener.py
What You Can Build
The MetricDuck API provides 70+ curated metrics with 7 years of history. Some ideas:
| Project | Metrics You'd Use | Complexity |
|---|---|---|
| Stock screener | pe_ratio, roic, fcf_yield | Beginner |
| Valuation alerts | Any metric + threshold logic | Beginner |
| Sector dashboard | Multiple tickers + charting | Intermediate |
| Portfolio analyzer | Weighted metrics across holdings | Intermediate |
| Earnings quality scanner | fcf_margin, sbc_ratio, cash_conversion | Advanced |
| Historical backtesting | Quarterly data + years=7 | Advanced |
API Quick Reference
Base URL: https://api.metricduck.com/api/v1
Main endpoint: GET /data/metrics
import httpx
response = httpx.get(
"https://api.metricduck.com/api/v1/data/metrics",
params={
"tickers": "AAPL,MSFT",
"metrics": "pe_ratio,roic,fcf_yield",
"period": "ttm",
"price": "current",
},
)
data = response.json()
Use price=current for real-time valuations at today's market price. Add dimensions=Q.MED8,Q.TREND8 for historical context (see Lab 03).
Key dimensions:
Q.MED8— 8-quarter median (2-year historical norm)Q.TREND8— 8-quarter trend (improving or deteriorating)TTM.YOY— Year-over-year changeTTM.CAGR3— 3-year compound annual growth rate
Full docs: /docs/api-reference/overview
Access Tiers
| Tier | Daily Limit | Max Tickers | Cost |
|---|---|---|---|
| Guest (no key) | 5 requests/day | 10 tickers | Free |
| Free (registered) | 500 credits/day | 200 tickers | Free |
| Builder | 200,000 credits/mo | 200 tickers | $29/mo |
| Production | 1,000,000 credits/mo | 200 tickers | $79/mo |
Guest access works immediately — no signup required. Register free for 500 credits/day — enough for 2 stock screens, 14 pulse checks, or 35 showdowns every day.
Register free → | Builder tier →
Coming Soon
More labs are in development:
- Lab 10: Valuation Alerts — Get notified when a stock's PE drops below your threshold
- Lab 50: Enterprise Data Pipeline — Bulk data ingestion for production systems
Star the repo to get notified: github.com/metric-duck/build-with-metricduck
In This Series (3 articles)
Stock Showdown: Compare Stocks with Python — ROIC, FCF Yield, and 5 Metrics yfinance Can't Provide
Compare any two stocks across Valuation and Quality panels — ROIC, FCF Margin, EV/EBIT, FCF Yield, and Total Shareholder Yield that yfinance cannot provide. One API call, no signup. Clone the repo and run it in 60 seconds.
Value Trap Detector: Check Any Stock Against Its Own 2-Year History with Python
A stock with a low PE looks cheap. But if ROIC is declining, you're buying a deteriorating business at a discount that keeps getting bigger. Stock Pulse compares any stock to its own 2-year baseline and diagnoses VALUE TRAP or OPPORTUNITY. One API call, no signup.
Stock Screener with Python: Rank 50 Stocks by ROIC, FCF Yield, and Quality Metrics No Free API Provides
Screen 50 stocks by ROIC, FCF Yield, and 3 other metrics yfinance cannot provide. Percentile-ranked composite score: Quality (60%) + Value (40%). One script, one API call, no signup.
MetricDuck Team
Building financial intelligence you can trust. Sourced directly from SEC Edgar.