Repository navigation
Finalytics 1.0.0-rc.4
Pre-release
Pre-release
Added
- Screening:
Universeholds many securities, each on its own dates (no alignment), with a
close on each and, where known, volumes, dividends and fields: numbers or text the library does
not compute, such as a sector or a price-to-earnings ratio. It is built from series, from CSV in
the long layout (id,date,close, withvolumeanddividends) or the wide one, or with
Universe::builder(), with fields from CSV, a benchmark and a risk-free rate.
universe.screen()(universe.screen(...)in Python and JavaScript) measures every security up
to the date measured to: returns over calendar windows from a week to five years, volatility,
downside deviation, drawdowns, Sharpe, Sortino and Calmar ratios and value at risk, beta,
correlation and relative returns against the benchmark, moving averages, Wilder's RSI, the MACD
histogram, 52-week ranges, dividend yield, volumes and the state of the data. A measure whose
window is longer than a security's history has no value, and a security whose last close is
more thanmax_carry_days(5) old is stale: listed but not measured. Rules compare a measure or
a numeric field with a number or a range, or test a text field against a list of values; a
security without the value a rule tests fails it, and every problem with a screen is reported
together. The matches are sorted and limited. Like every verb, it returns the screening report,
which shows how the rules narrow the universe, the matches with a mark beside a value close to
a threshold, the securities that fail just one rule, where each threshold falls among every
security's values, the quartiles of every measure some security has and what is out of the
ordinary in the data, with each measure named as people say it, as a page, in 80 columns of
text and as tables, and the raw results, one row per security. Python takes a long DataFrame, a
mapping of Series or CSV, andfinalytics.pandas.securitiesturns the results into a
DataFrame; JavaScript addsUniverse.fromColumnsfor flat typed arrays and returns the results
as oneFloat64Arrayper measure, and the worker client holds universes (engine.universe).
Securities are measured in one pass each, on several threads with theparallelfeature:
5,000 securities with ten years of daily closes take about 0.4 seconds in WebAssembly.
The engine is thescreeningmodule offinalytics-risk, andfinalytics::screening
re-exports it. The methods page isdocs/methods/screening.md, and every measure is checked
against an independent implementation in pandas (scripts/reference/screening.py). - JavaScript: the worker client calls static methods of
Portfolio,Assets,MarketDataand
datasets(engine.static("Assets", "fromCsv", csv)), so the sample datasets and every reader
of CSV text work off the main thread. Market data returned by the worker stays there as a
handle, like portfolios, assets and performance records.