CNN Fear & Greed Index

io.github.wildsurfer由 GitHub 帳號 wildsurfer 發布v2.2.0更新於 Oct 24, 2026

CNN's Fear & Greed index for the US stock market: score, rating, indicators and daily history.

已驗證STDIO僅桌面金融資料與分析

概覽

AI 產生的概覽

讓助理取得 CNN 美國股市恐懼與貪婪指數,包含目前分數、評級、各分項指標與每日歷史資料。

可以做什麼
以 stdio 在本機執行 MCP 伺服器,只提供一個工具 get_fear_and_greed,可選參數 include_history。它回傳目前 0-100 的分數與評級、前收盤、一週前、一個月前與一年前的數值、約一年的每日歷史,以及七個分項指標(市場動能、股價強度、股價廣度、賣權/買權選擇權、市場波動率、垃圾債需求、避險需求),每項都有自己的分數、評級與原始數值序列。同一個 Go 模組也提供命令列工具與函式庫。
適用情境
適合助理需要目前或歷史美國市場情緒讀數時使用,例如摘要市場情緒、把今天的分數與過去時段比較,或查看哪些分項指標正在推動指數。它是唯讀資料來源,不是交易或分析引擎。
執行需求
需要本機執行環境:以 mcp 參數啟動 cnnfag 執行檔(可透過 Go 安裝,或使用已發布的容器映像)。MCP 用戶端必須能找到該執行檔,若未繼承 PATH 可能需要填寫完整路徑。需要連線至 CNN 資料端點的對外網路;未宣告帳號、API 金鑰或環境變數。
安裝前請注意
資料來自 CNN 未公開文件的端點,程式會帶上類似瀏覽器的 User-Agent 與 Referer 標頭;該端點隨時可能變更或消失。本專案與 CNN 無關聯也未獲其認可,MIT 授權只涵蓋程式碼,CNN 條款限制對該資料的商業利用,合規由使用者自行負責。此伺服器只讀取資料,不會寫入、傳送或刪除任何內容。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 CNN Fear & Greed Index,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

cnn-fear-and-greed-parse

[Go Reference] [CI] [Coverage Status] [License: MIT] [Glama score]

Go package for CNN's Fear & Greed Index, a 0–100 gauge of US stock market sentiment. It returns the current score and rating, the values for the previous close, week, month and year, about a year of daily history, and the seven component indicators (market momentum, stock price strength, stock price breadth, put/call options, market volatility, junk bond demand, safe haven demand), each with its own score, rating and history of raw values. The module also ships a CLI and an MCP server, and has no dependencies outside the Go standard library.

Install

go get github.com/wildsurfer/cnn-fear-and-greed-parse/v2

Usage

go
package main
import (	"context"	"fmt"
	cnnfag "github.com/wildsurfer/cnn-fear-and-greed-parse/v2")
func main() {	result, err := cnnfag.Get(context.Background())	if err != nil {		panic(err)	}
	fmt.Printf("Now: %.0f (%s)\n", result.Score, result.Rating)	fmt.Printf("One year ago: %.0f\n", result.OneYearAgo)	fmt.Printf("History: %d daily points since %s\n",		len(result.History), result.History[0].Date.Format("2006-01-02"))	fmt.Printf("VIX indicator: %.0f (%s)\n",		result.MarketVolatility.Score, result.MarketVolatility.Rating)}

Output:

Now: 64 (greed)One year ago: 58History: 250 daily points since 2025-08-11VIX indicator: 50 (neutral)

An Indicator's History holds the raw underlying series (the S&P 500 level for momentum, the VIX level for volatility, ratios and spreads for the rest), and its Score is CNN's 0–100 normalization. To use your own http.Client (timeout, proxy), replace cnnfag.HTTPClient.

CLI

For cron jobs and shell pipelines, without writing Go:

go install github.com/wildsurfer/cnn-fear-and-greed-parse/v2/cmd/cnnfag@latest
$ cnnfag64 (greed) as of 2026-08-11T00:00:00Zprevious close 64 · week ago 60 · month ago 47 · year ago 58
$ cnnfag -json | jq .score64.3714285714286

-json prints the full result, including the daily history. -timeout changes the request timeout (default 15s).

MCP server

cnnfag mcp runs a Model Context Protocol server over stdio, so AI assistants can query the index. It exposes one tool, get_fear_and_greed, with an optional include_history argument. Configuration for MCP clients:

json
{  "mcpServers": {    "cnnfag": {      "command": "cnnfag",      "args": ["mcp"]    }  }}

The client must be able to find the binary: use the full path (usually ~/go/bin/cnnfag) if your MCP client does not inherit your shell's PATH. Like the rest of the module, the server is built on the standard library only.

The server is also published to the MCP Registry as io.github.wildsurfer/cnnfag, with a container image at ghcr.io/wildsurfer/cnnfag for clients that prefer Docker over a local binary.

How it works

CNN does not offer a documented public API. This package requests the JSON endpoint that the Fear & Greed page itself uses:

https://production.dataviz.cnn.io/index/fearandgreed/graphdata

The endpoint rejects requests that do not look like they come from a browser, so the package sends browser-like User-Agent and Referer headers. This is the same data source used by the known wrappers in other languages.

A scheduled CI job runs the test suite against the real endpoint once a week, so a change on CNN's side is detected within days.

Migrating from v1

v2 is a full rewrite: CNN removed the HTML page that v1 parsed, so v1 stopped working and its data model no longer matches what CNN publishes. Update the import path first:

go
import cnnfag "github.com/wildsurfer/cnn-fear-and-greed-parse/v2"

Then adjust the calls:

v1v2
cnnfag.Parse()cnnfag.Get(ctx), takes a context.Context
Result.Now.Value (int)Result.Score (float64)
Result.Now.TextResult.Rating
Result.PreviousClose.Value (int)Result.PreviousClose (float64)
Result.OneWeekAgo.Value, .OneMonthAgo.Value, .OneYearAgo.Valuesame field names, now plain float64
Result.PreviousClose.Text and other past-period labelsremoved; CNN's API has no labels for past periods, but every History point carries a rating
Result.LastUpdateDateResult.Timestamp, now an exact time from CNN instead of a parsed guess
Result.ImageURL, Result.GetImageBytes()removed; the needle image no longer exists
ErrHTTPNon200ErrUnexpectedStatus, check with errors.Is
ErrEmptyFieldErrEmptyResult
ErrImgLoadNon200, ErrReadingBytesremoved with the image API
—Result.History is new: about a year of daily scores

Scores changed from rounded integers to the exact floats CNN serves, so 44 in v1 corresponds to something like 43.71 in v2. Round with %.0f or math.Round if you need the old look.

Project history

v1 (2021) parsed the HTML of money.cnn.com/data/fear-and-greed with goquery and could also download the index needle image. CNN removed that page, which broke parsing, and the image no longer exists. v2 (2026) is a rewrite on the JSON endpoint with a smaller API, historical data and zero dependencies. The last v1 release is tagged v1.2.0.

Data disclaimer

This package is not affiliated with or endorsed by CNN. The Fear & Greed Index and its values belong to CNN (Warner Bros. Discovery). The MIT license covers only the code in this repository and gives you no rights to CNN's data. CNN's Terms of Use permit personal use of site content and restrict commercial exploitation. If you use this data in a product, compliance is your responsibility, and the endpoint can change or disappear at any time.

License

MIT

來源:README.md,提交 e1955e7

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v2.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分