Liking cljdoc? Tell your friends :D

clojure-backtesting.fundamentals

Point-in-time fundamentals for strategies: statement values as they were known on the backtest date, and valuation and quality ratios built on them.

A value is visible from the day its report became public (see clojure-backtesting.yahoo.build/report-date), never earlier. Values come back in the share basis of the backtest date, so per-share figures and share counts match the day's quoted price even when a later split has been applied to the source data, and in the security's trading currency (major unit: pounds, not pence), converted at the day's FX rate when the company reports in another currency. A value that cannot be stated that way (no FX rate, nothing public yet, or a period that ended more than FUNDAMENTALS-MAX-AGE-MONTHS ago) is nil, never guessed.

Fields are kebab-case Yahoo statement fields such as :total-revenue, :net-income, :diluted-eps, :stockholders-equity or :ordinary-shares-number. Frequencies: :quarterly the latest quarter :annual the latest fiscal year :trailing Yahoo's own trailing-twelve-month figure :ttm twelve months: Yahoo's trailing figure, the sum of the last four quarters, or the last fiscal year, whichever ends latest (flow fields only) :latest the latest quarter or fiscal year, whichever ends latest With no frequency, income-statement and cash-flow fields use :ttm and balance-sheet fields :latest.

Point-in-time fundamentals for strategies: statement values as they were
known on the backtest date, and valuation and quality ratios built on
them.

A value is visible from the day its report became public (see
`clojure-backtesting.yahoo.build/report-date`), never earlier. Values come
back in the share basis of the backtest date, so per-share figures and
share counts match the day's quoted price even when a later split has
been applied to the source data, and in the security's trading currency
(major unit: pounds, not pence), converted at the day's FX rate when the
company reports in another currency. A value that cannot be stated that
way (no FX rate, nothing public yet, or a period that ended more than
FUNDAMENTALS-MAX-AGE-MONTHS ago) is nil, never guessed.

Fields are kebab-case Yahoo statement fields such as :total-revenue,
:net-income, :diluted-eps, :stockholders-equity or
:ordinary-shares-number. Frequencies:
  :quarterly  the latest quarter
  :annual     the latest fiscal year
  :trailing   Yahoo's own trailing-twelve-month figure
  :ttm        twelve months: Yahoo's trailing figure, the sum of the last
              four quarters, or the last fiscal year, whichever ends
              latest (flow fields only)
  :latest     the latest quarter or fiscal year, whichever ends latest
With no frequency, income-statement and cash-flow fields use :ttm and
balance-sheet fields :latest.
raw docstring

available-fieldsclj

(available-fields permno)

The fundamental fields known for permno, sorted.

The fundamental fields known for `permno`, sorted.
sourceraw docstring

book-to-marketclj

(book-to-market permno)

Book equity over market capitalisation.

Book equity over market capitalisation.
sourceraw docstring

clear-fundamentals!clj

(clear-fundamentals!)

Unloads the fundamentals.

Unloads the fundamentals.
sourceraw docstring

current-ratioclj

(current-ratio permno)

Current assets over current liabilities.

Current assets over current liabilities.
sourceraw docstring

days-since-earningsclj

(days-since-earnings permno)

Calendar days since the latest public earnings announcement, or nil.

Calendar days since the latest public earnings announcement, or nil.
sourceraw docstring

debt-to-equityclj

(debt-to-equity permno)

Total debt over book equity; nil when equity is not positive.

Total debt over book equity; nil when equity is not positive.
sourceraw docstring

dividend-yieldclj

(dividend-yield permno)

Dividends with an ex-date in the last 365 days over today's price, both per share of today's basis. Uses the price history's dividends, so it needs no statement data.

Dividends with an ex-date in the last 365 days over today's price, both
per share of today's basis. Uses the price history's dividends, so it
needs no statement data.
sourceraw docstring

earnings-yieldclj

(earnings-yield permno)

Twelve-month diluted EPS over price (negative for losses).

Twelve-month diluted EPS over price (negative for losses).
sourceraw docstring

enterprise-valueclj

(enterprise-value permno)

Market capitalisation plus total debt minus cash; nil unless all three are known.

Market capitalisation plus total debt minus cash; nil unless all three are known.
sourceraw docstring

ev-to-ebitdaclj

(ev-to-ebitda permno)

Enterprise value over twelve-month EBITDA; nil when EBITDA is not positive.

Enterprise value over twelve-month EBITDA; nil when EBITDA is not positive.
sourceraw docstring

free-cash-flow-yieldclj

(free-cash-flow-yield permno)

Twelve-month free cash flow over market capitalisation.

Twelve-month free cash flow over market capitalisation.
sourceraw docstring

fundamentalclj

(fundamental permno field)
(fundamental permno field frequency)

The latest public value of field for permno on the backtest date, or nil. See the namespace docstring for frequency.

The latest public value of `field` for `permno` on the backtest date,
or nil. See the namespace docstring for `frequency`.
sourceraw docstring

fundamental-as-ofclj

(fundamental-as-of date permno field)
(fundamental-as-of date permno field frequency)

Like fundamental, on date rather than the backtest date.

Like fundamental, on `date` rather than the backtest date.
sourceraw docstring

fundamental-historyclj

(fundamental-history permno field frequency n)

Up to n public values of field at frequency (:quarterly, :annual or :trailing) on the backtest date, newest first, each as fundamental-info describes it. Old values are included regardless of their age.

Up to `n` public values of `field` at `frequency` (:quarterly, :annual or
:trailing) on the backtest date, newest first, each as fundamental-info
describes it. Old values are included regardless of their age.
sourceraw docstring

fundamental-infoclj

(fundamental-info permno field)
(fundamental-info permno field frequency)

The latest public value of field for permno on the backtest date, with where it comes from: {:value :field :frequency :source :period-end :report-date :public-date :report-date-source :reported-value :reported-currency :currency}. :report-date-source says how the public date was found (:earnings-history, :announcement, or :lag when it is an assumed reporting lag). nil when nothing is public yet or it is too old.

The latest public value of `field` for `permno` on the backtest date,
with where it comes from: {:value :field :frequency :source :period-end
:report-date :public-date :report-date-source :reported-value
:reported-currency :currency}. :report-date-source says how the public
date was found (:earnings-history, :announcement, or :lag when it is an
assumed reporting lag). nil when nothing is public yet or it is too old.
sourceraw docstring

fundamental-info-as-ofclj

(fundamental-info-as-of date permno field frequency)

Like fundamental-info, on date rather than the backtest date.

Like fundamental-info, on `date` rather than the backtest date.
sourceraw docstring

fundamentals-snapshotclj

(fundamentals-snapshot permno & fields)

{field value} of the given fields (all known fields by default) for permno on the backtest date, each at its default frequency.

{field value} of the given fields (all known fields by default) for
`permno` on the backtest date, each at its default frequency.
sourceraw docstring

fundamentals-storeclj

{security-id entry}, as written by clojure-backtesting.yahoo.build.

{security-id entry}, as written by clojure-backtesting.yahoo.build.
sourceraw docstring

fx-rateclj

(fx-rate from to date)

Units of to per unit of from known on date: the latest rate dated before it, since a day's FX close comes after many markets close. 1.0 when the currencies are the same, nil when unknown.

Units of `to` per unit of `from` known on `date`: the latest rate dated
before it, since a day's FX close comes after many markets close. 1.0
when the currencies are the same, nil when unknown.
sourceraw docstring

fx-ratesclj

{[from to] (sorted-map date rate)}: units of to per unit of from.

{[from to] (sorted-map date rate)}: units of `to` per unit of `from`.
sourceraw docstring

gross-marginclj

(gross-margin permno)

Twelve-month gross profit over revenue.

Twelve-month gross profit over revenue.
sourceraw docstring

growthclj

(growth permno field)
(growth permno field frequency)

Year-on-year growth of field at frequency (:annual by default, or :quarterly for the latest quarter against the same quarter a year before): latest / year-earlier - 1, nil when the year-earlier value is missing or not positive.

Year-on-year growth of `field` at `frequency` (:annual by default, or
:quarterly for the latest quarter against the same quarter a year
before): latest / year-earlier - 1, nil when the year-earlier value is
missing or not positive.
sourceraw docstring

latest-earningsclj

(latest-earnings permno)

The latest earnings announcement public on the backtest date: {:report-date :public-date :period-end :eps-actual :eps-estimate :surprise-pct}, or nil. :surprise-pct is in percent.

The latest earnings announcement public on the backtest date:
{:report-date :public-date :period-end :eps-actual :eps-estimate
:surprise-pct}, or nil. :surprise-pct is in percent.
sourceraw docstring

load-fundamentalsclj

(load-fundamentals path)

Loads a fundamentals.edn file (as build-yahoo-dataset! writes it), replacing any fundamentals loaded before.

Loads a fundamentals.edn file (as build-yahoo-dataset! writes it),
replacing any fundamentals loaded before.
sourceraw docstring

market-capclj

(market-cap permno)

Today's price times shares outstanding, in the trading currency.

Today's price times shares outstanding, in the trading currency.
sourceraw docstring

net-marginclj

(net-margin permno)

Twelve-month net income over revenue.

Twelve-month net income over revenue.
sourceraw docstring

operating-marginclj

(operating-margin permno)

Twelve-month operating income over revenue.

Twelve-month operating income over revenue.
sourceraw docstring

pe-ratioclj

(pe-ratio permno)

Price over twelve-month diluted EPS; nil when EPS is not positive.

Price over twelve-month diluted EPS; nil when EPS is not positive.
sourceraw docstring

piotroski-f-scoreclj

(piotroski-f-score permno)

The F-score (0 to 9): the number of piotroski-signals that hold. nil unless all nine can be computed, which needs three fiscal years of total assets.

The F-score (0 to 9): the number of piotroski-signals that hold. nil
unless all nine can be computed, which needs three fiscal years of total
assets.
sourceraw docstring

piotroski-signalsclj

(piotroski-signals permno)

The nine signals of Piotroski's (2000) F-score from the last two fiscal years, each true, false, or nil when its inputs are missing: :roa (net income over beginning assets is positive), :cfo (operating cash flow is positive), :delta-roa (ROA improved), :accrual (cash flow exceeds net income), :delta-leverage (long-term debt over assets fell), :delta-liquidity (current ratio rose), :no-dilution (shares did not increase), :delta-margin (gross margin rose), :delta-turnover (revenue over beginning assets rose). Years are aligned on the fiscal years of total assets.

The nine signals of Piotroski's (2000) F-score from the last two fiscal
years, each true, false, or nil when its inputs are missing:
:roa (net income over beginning assets is positive), :cfo (operating
cash flow is positive), :delta-roa (ROA improved), :accrual (cash flow
exceeds net income), :delta-leverage (long-term debt over assets fell),
:delta-liquidity (current ratio rose), :no-dilution (shares did not
increase), :delta-margin (gross margin rose), :delta-turnover (revenue
over beginning assets rose). Years are aligned on the fiscal years of
total assets.
sourceraw docstring

price-to-bookclj

(price-to-book permno)

Market capitalisation over book equity; nil when equity is not positive.

Market capitalisation over book equity; nil when equity is not positive.
sourceraw docstring

return-on-assetsclj

(return-on-assets permno)

Twelve-month net income over total assets.

Twelve-month net income over total assets.
sourceraw docstring

return-on-equityclj

(return-on-equity permno)

Twelve-month net income over book equity; nil when equity is not positive.

Twelve-month net income over book equity; nil when equity is not positive.
sourceraw docstring

sales-to-priceclj

(sales-to-price permno)

Twelve-month revenue over market capitalisation.

Twelve-month revenue over market capitalisation.
sourceraw docstring

shares-outstandingclj

(shares-outstanding permno)

Shares outstanding in today's share basis: the latest ordinary shares number, else shares issued, else diluted average shares. nil, with a warning, when it differs more than twofold from the count implied by net income over diluted EPS: Yahoo counts some multi-class companies in another class than the one quoted (Berkshire Hathaway's B shares in A equivalents), which would make every ratio on market value wrong.

Shares outstanding in today's share basis: the latest ordinary shares
number, else shares issued, else diluted average shares. nil, with a
warning, when it differs more than twofold from the count implied by net
income over diluted EPS: Yahoo counts some multi-class companies in
another class than the one quoted (Berkshire Hathaway's B shares in A
equivalents), which would make every ratio on market value wrong.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close