factor_agent.gate.vocabulary.Vocabulary#

class Vocabulary(sources, columns=None, intraday_columns=None)[source]#

Bases: object

What candidates may write with; build it with load, or from_sources in the sandbox.

Raises:
VocabularyError

If the files have any problem; every problem is listed.

Methods#

Vocabulary.allowed

Whether value is in the parameter set kind; a constant may also be negative or "nan".

Vocabulary.check

Return why graph's parameter values or dimensions are refused (empty if none) and its dimension.

Vocabulary.class_paths

The class path of every operator recorded graphs (Graph.to_json()) hold, by name.

Vocabulary.column_dimension

The (dollars, shares) exponents of the field reading column or a period lag of it, or None.

Vocabulary.execute

Run candidate code, which passed _checks.static_reasons, and return the names it bound.

Vocabulary.field_name

The field reading column or a period lag of it, or the column itself when no field reads it.

Vocabulary.fix_hints

The hint of every fix one of reasons matches, each once, in the operator file's order.

Vocabulary.from_sources

Rebuild a vocabulary from another's sources.

Vocabulary.load

Read the field files fields and the operator file operators.

Vocabulary.prompt

The prompt's description of the vocabulary: inputs, operators, parameter values, builtins.

Vocabulary.recorded_name

Return the name a graph records op_class under, or None when it is not registered.

Vocabulary.spec

The operator a graph records as name (or the stage split writes, WithinSession).

Vocabulary.written

column as candidate code reads it: a field's name, or PeriodLag(field, k) for a lag column.

Attributes#

Vocabulary.classes#

Every class a graph may hold, by the name it is recorded under (Input included).

Vocabulary.constant_set[source]#

The parameter set of constants: the one ConstantOp’s value is in (else AddConst’s or MulConst’s).

The operator file names its sets as it likes; the set an operator’s attribute is in says what kind of value it holds.

Vocabulary.intraday_columns#

The columns the intraday family’s fields read; empty without an intraday family.

Vocabulary.intraday_lags#

The lags, in bars, the intraday stage may use: the intraday family’s, else the operator file’s lag set.

Vocabulary.lag_columns#

How each lag column candidate code may read is computed, by its name (factor_agent.period_lag).

Vocabulary.lag_set[source]#

The parameter set of lags: the one BackRef’s window is in.

Vocabulary.names#

Every name candidate code may read without binding it first.

Vocabulary.operator_classes#

The registered classes, each with the name a graph records it under.

Vocabulary.reference_hashes[source]#

The canonical hashes of the derived fields (hash -> name) and of every node of the bar mask.

The mask is a sum over the bar columns; its partial sums are part of it too, so a graph that shares only them with a reference factor shares nothing the candidate wrote.

Vocabulary.sources#

The files’ paths and text and the operator modules: what the sandbox rebuilds from.

Vocabulary.parameters#

The parameter sets of the operator file, by kind.

Vocabulary.fields#

The fields of every family, in file order.

Vocabulary.families#

The description of every family, in file order.

Vocabulary.excluded#

The operator file’s excluded classes, with their reasons.

Vocabulary.period_lags#

The declared period lags, by family.

Vocabulary.intraday_family#

The intraday family, None when no field file is marked intraday.

Vocabulary.intraday_windows#

The window lengths, in bars, the intraday stage may use.