Real-time sentiment tracking across 4 major asset classes: Gold, Bonds, Stocks, and Crypto. Independent, transparent indices with complete methodology disclosure.
Live Site: onoff.markets
OnOff.Markets provides transparent Fear & Greed indices for four markets:
- Gold - Safe haven sentiment (5 components)
- Bonds - Treasury market sentiment (6 components)
- Stocks - Equity market sentiment (7 components)
- Crypto - Cryptocurrency sentiment (5 components)
Each index outputs a 0-100 score:
- 0-25: Extreme Fear
- 26-45: Fear
- 46-55: Neutral
- 56-75: Greed
- 76-100: Extreme Greed
The homepage features a Market Sentiment Indicator — the simple average of all four indices — showing the overall market mood at a glance.
Every sentiment tool claims to measure "fear & greed," but none explain how. Vague methodology. Hidden calculations. "Proprietary algorithms."
OnOff.Markets was built on the opposite principle:
- Complete transparency - All formulas published on each asset page
- Open methodology - Every component weight disclosed
- Free data sources - Yahoo Finance + FRED API only
- Daily updates - Automated via GitHub Actions
- No subscriptions - Free forever
Each index measures sentiment TOWARDS that market (whether people are buying or selling), following Alternative.me's philosophy for crypto.
If you can't verify it, you can't trust it.
The homepage score is the simple average of all 4 individual indices:
Sentiment = (Gold + Stocks + Crypto + Bonds) / 4
Below 50 = fear dominates across markets. Above 50 = optimism prevails.
| Component | Weight | Description |
|---|---|---|
| GLD Price Momentum | 30% | Direct 14-day GLD ETF performance (PRIMARY) |
| RSI & Moving Averages | 25% | Proportional distance-based MA50/MA200 + RSI signal |
| Dollar Index | 20% | DXY 14-day change with x15 multiplier (inverse correlation) |
| Real Rates | 15% | 10-Year TIPS yields from FRED (x18.75 scoring) |
| VIX | 10% | Z-score vs 3-month average (safe haven demand) |
| Component | Weight | Description |
|---|---|---|
| Duration Risk / TLT | 30% | Direct 14-day TLT ETF performance (x12 multiplier) |
| Yield Curve Shape | 20% | 10Y-2Y Treasury spread from FRED (structural signal) |
| Credit Quality | 20% | HYG vs LQD performance (credit spreads) |
| Real Rates | 15% | 10-Year TIPS yields from FRED (x10 multiplier) |
| Bond Volatility | 10% | 5-day vs 30-day TLT vol (MOVE proxy, x60) |
| Equity vs Bonds | 5% | TLT vs SPY relative performance (x8) |
| Component | Weight | Description |
|---|---|---|
| Price Strength | 20% | Direct 14-day SPY performance (x8 multiplier) |
| VIX | 20% | Continuous linear formula: 90 - (VIX-10) x 3.2 |
| Momentum | 15% | SPY RSI(14) 70% + MA50 position 30% |
| Market Participation | 15% | RSP vs SPY (x18 multiplier, equal vs cap-weight) |
| Junk Bonds | 10% | HYG vs TLT (credit risk appetite) |
| Safe Haven | 10% | TLT momentum inverted (flight-to-safety signal) |
| Sector Rotation | 10% | QQQ vs XLP (tech vs defensive, x5 multiplier) |
| Component | Weight | Description |
|---|---|---|
| Context | 30% | 30-day BTC price trend (x2.0 multiplier, centered at 50) |
| RSI & Moving Averages | 20% | BTC RSI direct (60%) + MA position (40%) |
| Bitcoin Dominance | 20% | BTC vs ETH performance (inverted, x3.0) |
| Volume Trend | 15% | 7d vs 30d volume ratio, direction-adjusted (x50) |
| Volatility | 15% | 14-day annualized vol (inverted, 40-80% thresholds) |
Full methodology with detailed explanations available on each asset page (Gold, Bonds, Stocks, Crypto).
All data is 100% free and publicly accessible:
-
Yahoo Finance (via yfinance): All price, volume, and technical data
- ETFs: GLD, TLT, SPY, SHY, LQD, HYG, RSP, QQQ, XLP, TIP
- Indices: ^VIX, DX=F (DXY), ^TNX, ^IRX
- Crypto: BTC-USD, ETH-USD
-
FRED API (Federal Reserve): Treasury yields and TIPS
- DGS2, DGS10 (2Y/10Y Treasury yields)
- DFII10 (10-Year TIPS real yields)
Fallback Strategy: FRED > Yahoo Finance for weekend/holiday protection (never defaults to neutral 50.0).
gold-fear-greed-index/
├── gold_fear_greed.py # Gold index calculator
├── bonds_fear_greed.py # Bonds index calculator
├── stocks_fear_greed.py # Stocks index calculator
├── crypto_fear_greed.py # Crypto index calculator
├── generate_insights.py # 5-year insights generator
├── rebuild_5y.py # 5-year history rebuild
├── index.html # Homepage (market sentiment + cross-asset chart)
├── gold.html # Gold index page (score + methodology + FAQ schema)
├── bonds.html # Bonds index page
├── stocks.html # Stocks index page
├── crypto.html # Crypto index page
├── about.html # Story, data sources, FAQ
├── shared.css # Shared styles (nav, footer, mobile menu)
├── chart.css # Chart styles (toolbar, tooltip, canvas)
├── asset.css # Asset page styles (hero, bar, components, methodology)
├── shared.js # Shared utilities (chart helpers, mobile menu, logo dots)
├── asset-chart.js # Asset page chart logic (parameterized via ASSET_CONFIG)
├── data/
│ ├── *-fear-greed.json # Daily F&G data (365 days x 4 assets)
│ ├── history-5y-*.json # 5-year aligned score+price history
│ └── insights-5y-*.json # Pre-computed correlation & stats
├── .github/
│ └── workflows/
│ └── update-index.yml # Daily automation (2:00 UTC)
└── README.md
The frontend uses a shared component system to avoid code duplication across 7 HTML pages:
shared.css+chart.css+asset.css: Layered CSS loaded by each page as neededshared.js: Common utilities (getColor(),scoreToY(), zones, mobile menu,updateLogoDots())asset-chart.js: Full asset page logic (data loading, chart rendering, tooltips) parameterized viawindow.ASSET_CONFIG
Each asset page only defines its unique config:
<script>
window.ASSET_CONFIG = {
color: '#FFD700',
name: 'Gold',
dataUrl: 'data/gold-fear-greed.json',
phrases: { extremeFear: '...', fear: '...', neutral: '...', greed: '...', extremeGreed: '...' }
};
</script>
<script src="shared.js"></script>
<script src="asset-chart.js"></script>Each asset page includes:
- Full meta tags (Open Graph, Twitter Card)
- JSON-LD
WebApplicationstructured data - JSON-LD
FAQPageschema with 3 targeted questions per asset - Complete methodology section for crawlability
The about page includes a JSON-LD FAQPage schema with 6 general questions.
- Python 3.9+
- Git
- GitHub account (for automation)
git clone https://github.com/applenostalgeek-sketch/gold-fear-greed-index.git
cd gold-fear-greed-index
pip install -r requirements.txt- Visit FRED API
- Create free account & generate API key
- Set environment variable:
export FRED_API_KEY="your_api_key_here"# Individual indices
python gold_fear_greed.py
python bonds_fear_greed.py --FRED_API_KEY="your_key"
python stocks_fear_greed.py
python crypto_fear_greed.py
# Force rebuild 365-day history
python gold_fear_greed.py --force-rebuildpython -m http.server 8080
# Visit http://localhost:8080The site auto-deploys to GitHub Pages from the main branch.
- Go to repo Settings > Pages
- Source: Deploy from branch
main - Folder:
/ (root) - Add
FRED_API_KEYto Settings > Secrets and variables > Actions
GitHub Actions runs daily at 2:00 UTC:
- Calculates all 4 indices
- Generates/updates JSON files in
data/ - Commits changes to
main - GitHub Pages auto-redeploys
Manual trigger: Actions tab > "Update Fear & Greed Indices" > Run workflow
- Calculation: Daily at 2:00 AM UTC (3:00 AM Paris / 9:00 PM ET)
- Market data: Real-time when script runs
- History retention: 365 days rolling window + 5-year rebuilt history
- Methodology: Documented on each asset page and on about.html
| Source | Limit | Usage |
|---|---|---|
| Yahoo Finance | Unlimited | ~15-20 calls/day |
| FRED API | 120 req/min | ~5 calls/day |
MIT License - See LICENSE file
This project is provided for informational purposes only and does not constitute financial advice. Investments carry risks. Consult a qualified financial advisor before making investment decisions.
These indices are analytical tools designed to complement, not replace, fundamental analysis and risk management.
- Inspired by Alternative.me's Crypto Fear & Greed Index
- Data: Yahoo Finance & Federal Reserve Economic Data (FRED)
- Built with Claude Code
- Hosted on GitHub Pages
- Live Site: onoff.markets
- Email: contact@onoff.markets
- Issues: GitHub Issues
0 comments
log in to comment.