EXPERIMENTAL: Fetch data from Yahoo Finance quoteSummary endpoint.
This namespace provides access to company data via Yahoo's authenticated quoteSummary API. The underlying fetch-quotesummary* function accepts any combination of quoteSummary modules, making it easy to add new data types.
Available modules (pass to fetch-quotesummary*):
WARNING: This is experimental and may break at any time. Yahoo can change or block authentication without notice.
For production use, consider stable alternatives:
Implementation notes:
EXPERIMENTAL: Fetch data from Yahoo Finance quoteSummary endpoint. This namespace provides access to company data via Yahoo's authenticated quoteSummary API. The underlying fetch-quotesummary* function accepts any combination of quoteSummary modules, making it easy to add new data types. Available modules (pass to fetch-quotesummary*): - financialData - Price targets, margins, revenue, cash flow - defaultKeyStatistics - P/E, market cap, beta, shares outstanding - assetProfile - Sector, industry, description, employees - earningsTrend - Analyst EPS/revenue estimates by period - recommendationTrend - Buy/hold/sell counts over time - earningsHistory - Historical EPS vs estimates - incomeStatementHistory - Annual/quarterly income statements - balanceSheetHistory - Annual/quarterly balance sheets - cashflowStatementHistory - Annual/quarterly cash flow statements WARNING: This is experimental and may break at any time. Yahoo can change or block authentication without notice. For production use, consider stable alternatives: - AlphaVantage (free tier, good fundamentals) - Financial Modeling Prep (comprehensive) - Polygon.io (professional-grade) Implementation notes: - Returns ALL fields from Yahoo (no filtering) - Session auto-refreshes every hour - MAX 1 retry on authentication failure
(fetch-analyst ticker)Fetch analyst estimates and recommendations for a ticker (simple API).
Returns the data map with :earningsTrend, :recommendationTrend, and :earningsHistory keys, or nil on failure. For error details, use fetch-analyst* instead.
Example: (fetch-analyst "AAPL") => {:earningsTrend {:trend [...]} :recommendationTrend {:trend [{:period "0m" :strongBuy 5 :buy 23 ...} ...]} :earningsHistory {:history [...]}}
Fetch analyst estimates and recommendations for a ticker (simple API).
Returns the data map with :earningsTrend, :recommendationTrend, and
:earningsHistory keys, or nil on failure.
For error details, use fetch-analyst* instead.
Example:
(fetch-analyst "AAPL")
=> {:earningsTrend {:trend [...]}
:recommendationTrend {:trend [{:period "0m" :strongBuy 5 :buy 23 ...} ...]}
:earningsHistory {:history [...]}}(fetch-analyst* ticker)Fetch analyst estimates and recommendations for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {:}}
:data contains three modules:
:earningsTrend - EPS and revenue estimates by period :trend - vector of 4 periods ("0q" current quarter, "1q" next quarter, "0y" current year, "1y" next year), each with: - :earningsEstimate - avg/low/high EPS estimate, numberOfAnalysts, growth - :revenueEstimate - avg/low/high revenue estimate, numberOfAnalysts, growth - :epsTrend - current/7daysAgo/30daysAgo/60daysAgo/90daysAgo - :epsRevisions - upLast7days/upLast30days/downLast30days/downLast7Days
:recommendationTrend - Analyst buy/sell counts over 4 months :trend - vector of 4 months ("0m" current, "-1m", "-2m", "-3m"), each with: - :strongBuy, :buy, :hold, :sell, :strongSell counts
:earningsHistory - Actual vs estimated EPS for last 4 quarters :history - vector of 4 quarters, each with: - :epsActual, :epsEstimate, :epsDifference, :surprisePercent - :quarter (epoch timestamp), :period (e.g. "-4q")
Example: (fetch-analyst* "AAPL") => {:ok? true :data {:earningsTrend {:trend [{:period "0q" :earningsEstimate {:avg {:raw 1.95 :fmt "1.95"} ...} :revenueEstimate {:avg {:raw 109078529710 ...} ...} :epsTrend {:current {:raw 1.95 :fmt "1.95"} ...} :epsRevisions {:upLast7days {:raw 1} ...}} ...]} :recommendationTrend {:trend [{:period "0m" :strongBuy 5 :buy 23 :hold 16 :sell 1 :strongSell 1} ...]} :earningsHistory {:history [{:epsActual {:raw 1.65 :fmt "1.65"} :epsEstimate {:raw 1.62 :fmt "1.62"} :surprisePercent {:raw 0.0169 :fmt "1.69%"}} ...]}}}
Fetch analyst estimates and recommendations for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {:}}
:data contains three modules:
:earningsTrend - EPS and revenue estimates by period
:trend - vector of 4 periods ("0q" current quarter, "1q" next quarter,
"0y" current year, "1y" next year), each with:
- :earningsEstimate - avg/low/high EPS estimate, numberOfAnalysts, growth
- :revenueEstimate - avg/low/high revenue estimate, numberOfAnalysts, growth
- :epsTrend - current/7daysAgo/30daysAgo/60daysAgo/90daysAgo
- :epsRevisions - upLast7days/upLast30days/downLast30days/downLast7Days
:recommendationTrend - Analyst buy/sell counts over 4 months
:trend - vector of 4 months ("0m" current, "-1m", "-2m", "-3m"), each with:
- :strongBuy, :buy, :hold, :sell, :strongSell counts
:earningsHistory - Actual vs estimated EPS for last 4 quarters
:history - vector of 4 quarters, each with:
- :epsActual, :epsEstimate, :epsDifference, :surprisePercent
- :quarter (epoch timestamp), :period (e.g. "-4q")
Example:
(fetch-analyst* "AAPL")
=> {:ok? true
:data {:earningsTrend {:trend [{:period "0q"
:earningsEstimate {:avg {:raw 1.95 :fmt "1.95"} ...}
:revenueEstimate {:avg {:raw 109078529710 ...} ...}
:epsTrend {:current {:raw 1.95 :fmt "1.95"} ...}
:epsRevisions {:upLast7days {:raw 1} ...}} ...]}
:recommendationTrend {:trend [{:period "0m"
:strongBuy 5 :buy 23 :hold 16
:sell 1 :strongSell 1} ...]}
:earningsHistory {:history [{:epsActual {:raw 1.65 :fmt "1.65"}
:epsEstimate {:raw 1.62 :fmt "1.62"}
:surprisePercent {:raw 0.0169 :fmt "1.69%"}} ...]}}}(fetch-calendar ticker)Fetch upcoming earnings dates and dividend dates for a ticker (simple API).
Returns the :calendarEvents map directly, or nil on failure. For error details, use fetch-calendar* instead.
Key fields:
Example: (fetch-calendar "AAPL") => {:earnings {:earningsDate [{:raw 1777582800 :fmt "2026-04-30"}] :earningsCallDate [{:raw 1769724000 :fmt "2026-01-29"}] :isEarningsDateEstimate false :earningsAverage {:raw 1.95403 :fmt "1.95"} ...} :exDividendDate {:raw 1770595200 :fmt "2026-02-09"} :dividendDate {:raw 1770854400 :fmt "2026-02-12"}}
Fetch upcoming earnings dates and dividend dates for a ticker (simple API).
Returns the :calendarEvents map directly, or nil on failure.
For error details, use fetch-calendar* instead.
Key fields:
- (-> result :earnings :earningsDate first :fmt) - Next earnings date string
- (-> result :earnings :earningsDate first :raw) - Next earnings date epoch seconds
- (-> result :earnings :isEarningsDateEstimate) - true if estimated
- (-> result :exDividendDate :fmt) - Ex-dividend date string
Example:
(fetch-calendar "AAPL")
=> {:earnings {:earningsDate [{:raw 1777582800 :fmt "2026-04-30"}]
:earningsCallDate [{:raw 1769724000 :fmt "2026-01-29"}]
:isEarningsDateEstimate false
:earningsAverage {:raw 1.95403 :fmt "1.95"} ...}
:exDividendDate {:raw 1770595200 :fmt "2026-02-09"}
:dividendDate {:raw 1770854400 :fmt "2026-02-12"}}(fetch-calendar* ticker)Fetch upcoming earnings dates and dividend dates for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains the :calendarEvents map with fields:
Example: (fetch-calendar* "AAPL") => {:ok? true :data {:calendarEvents {:earnings {:earningsDate [{:raw 1777582800 :fmt "2026-04-30"}] :earningsCallDate [{:raw 1769724000 :fmt "2026-01-29"}] :isEarningsDateEstimate false :earningsAverage {:raw 1.95403 :fmt "1.95"} :earningsHigh {:raw 2.16 :fmt "2.16"} :earningsLow {:raw 1.85 :fmt "1.85"} :revenueAverage {:raw 109083851330 :fmt "109.08B"} :revenueHigh {:raw 112596000000 :fmt "112.6B"} :revenueLow {:raw 105000000000 :fmt "105B"}} :exDividendDate {:raw 1770595200 :fmt "2026-02-09"} :dividendDate {:raw 1770854400 :fmt "2026-02-12"}}}}
Fetch upcoming earnings dates and dividend dates for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains the :calendarEvents map with fields:
- :earnings
- :earningsDate - Vector of upcoming earnings date(s) [{:raw epoch :fmt date}]
- :earningsCallDate - Vector of earnings call date(s) [{:raw epoch :fmt date}]
- :isEarningsDateEstimate - Boolean: true if date is estimated, false if confirmed
- :earningsAverage / :earningsHigh / :earningsLow - EPS consensus estimates
- :revenueAverage / :revenueHigh / :revenueLow - Revenue consensus estimates
- :exDividendDate - Ex-dividend date {:raw epoch :fmt date}
- :dividendDate - Dividend payment date {:raw epoch :fmt date}
Example:
(fetch-calendar* "AAPL")
=> {:ok? true
:data {:calendarEvents
{:earnings {:earningsDate [{:raw 1777582800 :fmt "2026-04-30"}]
:earningsCallDate [{:raw 1769724000 :fmt "2026-01-29"}]
:isEarningsDateEstimate false
:earningsAverage {:raw 1.95403 :fmt "1.95"}
:earningsHigh {:raw 2.16 :fmt "2.16"}
:earningsLow {:raw 1.85 :fmt "1.85"}
:revenueAverage {:raw 109083851330 :fmt "109.08B"}
:revenueHigh {:raw 112596000000 :fmt "112.6B"}
:revenueLow {:raw 105000000000 :fmt "105B"}}
:exDividendDate {:raw 1770595200 :fmt "2026-02-09"}
:dividendDate {:raw 1770854400 :fmt "2026-02-12"}}}}(fetch-company-info ticker)Fetch company profile for a ticker (simple API).
Returns the :assetProfile map directly, or nil on failure. For error details, use fetch-company-info* instead.
Example: (fetch-company-info "AAPL") => {:sector "Technology" :industry "Consumer Electronics" :fullTimeEmployees 150000 :longBusinessSummary "Apple Inc. designs..." :companyOfficers [...]}
Fetch company profile for a ticker (simple API).
Returns the :assetProfile map directly, or nil on failure.
For error details, use fetch-company-info* instead.
Example:
(fetch-company-info "AAPL")
=> {:sector "Technology"
:industry "Consumer Electronics"
:fullTimeEmployees 150000
:longBusinessSummary "Apple Inc. designs..."
:companyOfficers [...]}(fetch-company-info* ticker)Fetch company profile for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains the :assetProfile map with fields including:
Example: (fetch-company-info* "AAPL") => {:ok? true :data {:assetProfile {:sector "Technology" :industry "Consumer Electronics" :fullTimeEmployees 150000 :longBusinessSummary "Apple Inc. designs..." :companyOfficers [{:name "Mr. Timothy D. Cook" :title "CEO & Director" :totalPay {:raw 16759518 :fmt "16.76M"}} ...]}}}
Fetch company profile for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains the :assetProfile map with fields including:
- :sector, :sectorKey, :industry, :industryKey
- :longBusinessSummary - Full company description
- :fullTimeEmployees
- :country, :city, :state, :zip, :address1
- :phone, :website, :irWebsite
- :companyOfficers - Vector of officer maps (name, title, age, totalPay)
- :overallRisk, :auditRisk, :boardRisk, :compensationRisk,
:shareHolderRightsRisk, :governanceEpochDate
Example:
(fetch-company-info* "AAPL")
=> {:ok? true
:data {:assetProfile {:sector "Technology"
:industry "Consumer Electronics"
:fullTimeEmployees 150000
:longBusinessSummary "Apple Inc. designs..."
:companyOfficers [{:name "Mr. Timothy D. Cook"
:title "CEO & Director"
:totalPay {:raw 16759518 :fmt "16.76M"}} ...]}}}(fetch-financials ticker & {:keys [period] :or {period :annual}})Fetch financial statements for a ticker (simple API).
Returns the data map or nil on failure. Options: :period - :annual (default) or :quarterly For error details, use fetch-financials* instead.
Example: (fetch-financials "MSFT") => {:incomeStatementHistory {...} :balanceSheetHistory {...} :cashflowStatementHistory {...}}
(fetch-financials "MSFT" :period :quarterly) => {:incomeStatementHistoryQuarterly {...} ...}
Fetch financial statements for a ticker (simple API).
Returns the data map or nil on failure.
Options: :period - :annual (default) or :quarterly
For error details, use fetch-financials* instead.
Example:
(fetch-financials "MSFT")
=> {:incomeStatementHistory {...}
:balanceSheetHistory {...}
:cashflowStatementHistory {...}}
(fetch-financials "MSFT" :period :quarterly)
=> {:incomeStatementHistoryQuarterly {...} ...}(fetch-financials* ticker & {:keys [period] :or {period :annual}})Fetch financial statements for a ticker (verbose API).
Options:
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
NOTE: Yahoo partially restricts these modules. Fields reliably available:
For comprehensive financial statements, consider Financial Modeling Prep or AlphaVantage as stable alternatives.
Annual :data keys:
Quarterly :data keys:
Each period map includes :endDate {:raw <epoch> :fmt <date-string>} and numeric fields as {:raw <number> :fmt <string>} maps.
Example: (fetch-financials* "MSFT") => {:ok? true :data {:incomeStatementHistory {:incomeStatementHistory [{:endDate {:raw 1751241600 :fmt "2025-06-30"} :totalRevenue {:raw 281724000000 :fmt "281.72B"} :netIncome {:raw 101832000000 :fmt "101.83B"} ...} ...]}}}
(fetch-financials* "MSFT" :period :quarterly) => {:ok? true :data {:incomeStatementHistoryQuarterly {...} ...}}
Fetch financial statements for a ticker (verbose API).
Options:
- :period - :annual (default) or :quarterly
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
NOTE: Yahoo partially restricts these modules. Fields reliably available:
- Income statement: :totalRevenue, :netIncome (4 periods)
- Balance sheet: :endDate only (other fields blocked by Yahoo)
- Cash flow: :netIncome, :endDate only (other fields blocked by Yahoo)
For comprehensive financial statements, consider Financial Modeling Prep
or AlphaVantage as stable alternatives.
Annual :data keys:
- :incomeStatementHistory - {:incomeStatementHistory [<4 annual periods>]}
- :balanceSheetHistory - {:balanceSheetStatements [<4 annual periods>]}
- :cashflowStatementHistory - {:cashflowStatements [<4 annual periods>]}
Quarterly :data keys:
- :incomeStatementHistoryQuarterly - {:incomeStatementHistory [<4 quarters>]}
- :balanceSheetHistoryQuarterly - {:balanceSheetStatements [<4 quarters>]}
- :cashflowStatementHistoryQuarterly - {:cashflowStatements [<4 quarters>]}
Each period map includes :endDate {:raw <epoch> :fmt <date-string>} and
numeric fields as {:raw <number> :fmt <string>} maps.
Example:
(fetch-financials* "MSFT")
=> {:ok? true
:data {:incomeStatementHistory
{:incomeStatementHistory
[{:endDate {:raw 1751241600 :fmt "2025-06-30"}
:totalRevenue {:raw 281724000000 :fmt "281.72B"}
:netIncome {:raw 101832000000 :fmt "101.83B"} ...} ...]}}}
(fetch-financials* "MSFT" :period :quarterly)
=> {:ok? true :data {:incomeStatementHistoryQuarterly {...} ...}}(fetch-fundamentals ticker)Fetch fundamentals data for a ticker (simple API).
Returns map of fundamentals data or nil on failure. For error details, use fetch-fundamentals* instead.
Example: (fetch-fundamentals "AAPL") => {:financialData {:currentPrice {:raw 255.78 :fmt "255.78"} ...} :defaultKeyStatistics {:beta {:raw 1.107 :fmt "1.11"} ...}}
Fetch fundamentals data for a ticker (simple API).
Returns map of fundamentals data or nil on failure.
For error details, use fetch-fundamentals* instead.
Example:
(fetch-fundamentals "AAPL")
=> {:financialData {:currentPrice {:raw 255.78 :fmt "255.78"} ...}
:defaultKeyStatistics {:beta {:raw 1.107 :fmt "1.11"} ...}}(fetch-fundamentals* ticker)Fetch fundamentals data for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains fields from two modules:
Numeric values are {:raw <number> :fmt <string>} maps.
Example: (fetch-fundamentals* "AAPL") => {:ok? true :data {:financialData {:currentPrice {:raw 255.78 :fmt "255.78"} :recommendationKey "buy" ...} :defaultKeyStatistics {:beta {:raw 1.107 :fmt "1.11"} ...}}}
Fetch fundamentals data for a ticker (verbose API).
Returns {:ok? true :data {...}} or {:ok? false :error {...}}.
:data contains fields from two modules:
- :financialData - currentPrice, targets, margins, revenue, ROE, recommendations
- :defaultKeyStatistics - beta, P/E ratios, market cap, shares, 52-week change
Numeric values are {:raw <number> :fmt <string>} maps.
Example:
(fetch-fundamentals* "AAPL")
=> {:ok? true
:data {:financialData {:currentPrice {:raw 255.78 :fmt "255.78"}
:recommendationKey "buy" ...}
:defaultKeyStatistics {:beta {:raw 1.107 :fmt "1.11"} ...}}}(fetch-quotesummary* ticker modules)Shared foundation: fetch any quoteSummary modules for a ticker (verbose API).
This is the base function used by all quoteSummary-based fetch functions. New data types (analyst, financials, company info) are built on top of this.
Parameters:
Returns: {:ok? true :data {...}} - :data keys match the requested module names {:ok? false :error {...}} on failure
Error types: :auth-failed, :session-failed, :api-error, :http-error, :rate-limited, :parse-error, :missing-data, :request-failed, :exception
Example: (fetch-quotesummary* "AAPL" "assetProfile,financialData") => {:ok? true :data {:assetProfile {:sector "Technology" :industry "Consumer Electronics" ...} :financialData {:currentPrice {:raw 255.78 :fmt "255.78"} ...}}}
Shared foundation: fetch any quoteSummary modules for a ticker (verbose API).
This is the base function used by all quoteSummary-based fetch functions.
New data types (analyst, financials, company info) are built on top of this.
Parameters:
- ticker - Ticker symbol string (e.g. "AAPL")
- modules - Comma-separated Yahoo quoteSummary module names
(e.g. "financialData,defaultKeyStatistics")
Returns:
{:ok? true :data {...}} - :data keys match the requested module names
{:ok? false :error {...}} on failure
Error types: :auth-failed, :session-failed, :api-error, :http-error,
:rate-limited, :parse-error, :missing-data, :request-failed,
:exception
Example:
(fetch-quotesummary* "AAPL" "assetProfile,financialData")
=> {:ok? true
:data {:assetProfile {:sector "Technology"
:industry "Consumer Electronics" ...}
:financialData {:currentPrice {:raw 255.78 :fmt "255.78"} ...}}}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |