yfinance: Free Yahoo Finance market data (quotes, history, fundamentals, options, news, movers) via a bundled MCP server, with five views.
| 1 | // What the orchestrator is told while one of the Yahoo Finance views is focused: how each is driven |
| 2 | // by state, what its output holds, and where to go for more than it shows. |
| 3 | |
| 4 | const SYMBOLS = 'Symbols: AAPL, BRK-B, SHOP.TO, 7203.T, ^GSPC, ES=F, EURUSD=X, BTC-USD; the yfinance search source finds one from a name.' |
| 5 | const SOURCE = 'Some quotes are delayed.' |
| 6 | |
| 7 | export const OVERVIEW_INSTRUCTIONS = [ |
| 8 | 'One company or fund: price and change, day and 52-week ranges, key statistics, analyst targets and the month’s ratings, the next earnings date and recent quarters against estimates, and the profile; for an ETF or mutual fund, also its figures, top holdings, and sector weights.', |
| 9 | `state.symbol is the symbol; set it to show another. ${SYMBOLS}`, |
| 10 | 'output holds the price, change in percent, market cap, P/E, forward P/E, dividend yield, the 52-week range, the analysts’ target (low, mean, high) and consensus, the next earnings date, sector, and industry, and output.errors names any part that was refused. For figures the view does not publish, call the yfinance sources (statistics, analysts, earnings, profile, holders, fund) rather than guessing.', |
| 11 | SOURCE, |
| 12 | ].join('\n') |
| 13 | |
| 14 | export const WATCHLIST_INSTRUCTIONS = [ |
| 15 | 'A watchlist: quotes for a list of symbols (last, change, volume, market cap, day range), asked again every minute. The user adds symbols in its field and removes them with ×.', |
| 16 | `state.symbols is the whole list, up to 30; set it whole to change it, keeping the symbols already there unless the user asks to drop them. ${SYMBOLS}`, |
| 17 | 'output.rows holds each symbol’s price and change in percent, in the list’s order; output.missing names symbols not found, which the search source can correct.', |
| 18 | SOURCE, |
| 19 | ].join('\n') |
| 20 | |
| 21 | export const MARKETS_INSTRUCTIONS = [ |
| 22 | 'The market at a glance: tiles for index futures, commodities, the 10-year yield, the VIX, currencies, and crypto, then a list of US stocks, both asked again every minute.', |
| 23 | 'state.list is gainers (default), losers, most_active, trending, or a saved screen: undervalued_growth, growth_technology, aggressive_small_caps, small_cap_gainers, undervalued_large_caps.', |
| 24 | 'output.tiles holds each tile’s symbol, price, and change in percent; output.top the first ten of the list, and output.total how many the list has. For more of a list, call the movers source with a limit.', |
| 25 | SOURCE, |
| 26 | ].join('\n') |
| 27 | |
| 28 | export const FINANCIALS_INSTRUCTIONS = [ |
| 29 | 'One company’s financial statement: line items down, periods across, latest first, as reported in the statement’s currency. There are about four years and five quarters.', |
| 30 | `state.symbol is the symbol; state.statement is income (default), balance, or cashflow; state.frequency is annual (default), quarterly, or trailing (twelve months; not for a balance sheet). ${SYMBOLS}`, |
| 31 | 'output holds the periods and the key lines’ values by label (revenue, profit, EPS; assets, liabilities, equity, debt; operating, investing, financing, and free cash flow), aligned with the periods. For every line, call the financials source with the same arguments.', |
| 32 | SOURCE, |
| 33 | ].join('\n') |
| 34 | |
| 35 | export const OPTIONS_INSTRUCTIONS = [ |
| 36 | 'One symbol’s option chain for one expiration: calls and puts side by side at the strikes nearest the price, with last, bid, ask, volume, open interest, and implied volatility, the in-the-money side shaded. Asked again every minute; prices can be delayed.', |
| 37 | 'state.symbol is the underlying; state.expiration is a date the chain lists (YYYY-MM-DD), or null for the nearest; state.strikes is how many strikes on each side of the price, 10 by default. Setting a new symbol, set expiration to null too.', |
| 38 | 'output holds the expiration, output.expirations (the dates listed, for choosing another), the underlying price, the strike nearest the price with its call and put mid and IV, and put/call ratios by volume and open interest.', |
| 39 | SOURCE, |
| 40 | ].join('\n') |