factor_agent.config.CampaignConfig#

class CampaignConfig(run_dir, segments, data, scoring, roles, fields, operators, acceptance, market, operator_modules=(), reference=(), known=(), directions=(), evaluator=EvaluatorConfig(warmup_bars=260, njobs=51), gate=GateConfig(timeout_seconds=10.0, memory_mb=1024, max_nodes=200, max_free_parameter_ratio=0.5, max_base_fields=5, max_common_subtree_nodes=5), admission=AdmissionConfig(t_threshold=3.0, max_correlation=0.7, min_monotonicity=0.6, min_coverage=0.5, trial_exponent=1.0, confirm_t=2.0), round=RoundConfig(candidates=20, min_per_type=3, retries=2, max_rounds=30, max_trials=600, patience=5, memory_every=5, seed=0, groups=1, max_children=None, picked_parents=0), context=ContextConfig(recent_rounds=5, feedback=True, theme_correlation=None, send_back_repeats=False, lineage=False, fertile_children=3), trial_graph=TrialGraphConfig(gamma=0.75, iterations=100, tolerance=1e-08, weights={'generation': 0.3333333333333333, 'structure': 0.3333333333333333, 'correlation': 0.3333333333333333}, min_jaccard=0.2, structure_neighbours=30, min_correlation=0.1, correlation_neighbours=30, nearest_accepted=10, max_expansions=5), mechanisms=(Mechanism(name='behavioural_bias', description="investors' systematic errors (over- and underreaction, anchoring, limited attention) that prices correct later"), Mechanism(name='risk_compensation', description='a return paid for bearing a risk investors demand to be compensated for'), Mechanism(name='liquidity', description='the cost and the pressure of trading: illiquidity premia, liquidity demand and its reversal'), Mechanism(name='microstructure', description='the mechanics of trading within and between bars: order flow, the bid-ask bounce, the open and the close'), Mechanism(name='information_diffusion', description='news that reaches prices gradually, across investors, related firms or time')), prompts=<factory>, source=None)[source]#

Bases: object

Every setting of a campaign, read from one YAML file with from_file.

roles maps each of ROLES to its LLM; the roles may use different backends, so the reviewer can be another provider’s model. directions are the seed research directions the planner is shown. market describes the data in the prompts, mechanisms are the mechanism types in plan order, and prompts maps a template’s name to the file that replaces it; the replacing files are read and checked for their placeholders when the config is made.

Raises:
PromptError

Naming every problem of the replaced templates.

ValueError

If the mechanism types repeat or a round cannot hold its quota of them.

Methods#

CampaignConfig.from_file

Read a campaign config from YAML; the paths of fields, operators and prompts are relative to its folder.

CampaignConfig.load_factors

Rebuild the reference factors and the known factors, (reference, known), each in config order.

CampaignConfig.search_files

The files the run searches with: the field files, the operator file and the replaced templates.

CampaignConfig.templates

The prompt templates: the built-in ones, those files replace read from their files.

CampaignConfig.vocabulary

The Vocabulary of the field and operator files; columns, given, are the price dataset's.

Attributes#

CampaignConfig.admission = AdmissionConfig(t_threshold=3.0, max_correlation=0.7, min_monotonicity=0.6, min_coverage=0.5, trial_exponent=1.0, confirm_t=2.0)#
CampaignConfig.context = ContextConfig(recent_rounds=5, feedback=True, theme_correlation=None, send_back_repeats=False, lineage=False, fertile_children=3)#
CampaignConfig.directions = ()#
CampaignConfig.evaluator = EvaluatorConfig(warmup_bars=260, njobs=51)#
CampaignConfig.gate = GateConfig(timeout_seconds=10.0, memory_mb=1024, max_nodes=200, max_free_parameter_ratio=0.5, max_base_fields=5, max_common_subtree_nodes=5)#
CampaignConfig.known = ()#

The known factors besides the reference set, as components; see the module docstring.

CampaignConfig.mechanism_types#

The names of the mechanism types, in plan order.

CampaignConfig.mechanisms = (Mechanism(name='behavioural_bias', description="investors' systematic errors (over- and underreaction, anchoring, limited attention) that prices correct later"), Mechanism(name='risk_compensation', description='a return paid for bearing a risk investors demand to be compensated for'), Mechanism(name='liquidity', description='the cost and the pressure of trading: illiquidity premia, liquidity demand and its reversal'), Mechanism(name='microstructure', description='the mechanics of trading within and between bars: order flow, the bid-ask bounce, the open and the close'), Mechanism(name='information_diffusion', description='news that reaches prices gradually, across investors, related firms or time'))#
CampaignConfig.operator_modules = ()#

Modules besides KunQuant and quantlab.factor an operator’s class or callable may come from.

CampaignConfig.reference = ()#

The reference factors, as components; see the module docstring.

CampaignConfig.round = RoundConfig(candidates=20, min_per_type=3, retries=2, max_rounds=30, max_trials=600, patience=5, memory_every=5, seed=0, groups=1, max_children=None, picked_parents=0)#
CampaignConfig.source = None#

The YAML text from_file read, which a run keeps for each opening; None for a config made in code.

CampaignConfig.training#

The segment the campaign evaluates.

CampaignConfig.trial_graph = TrialGraphConfig(gamma=0.75, iterations=100, tolerance=1e-08, weights={'generation': 0.3333333333333333, 'structure': 0.3333333333333333, 'correlation': 0.3333333333333333}, min_jaccard=0.2, structure_neighbours=30, min_correlation=0.1, correlation_neighbours=30, nearest_accepted=10, max_expansions=5)#
CampaignConfig.run_dir#
CampaignConfig.segments#
CampaignConfig.data#
CampaignConfig.scoring#
CampaignConfig.roles#
CampaignConfig.fields#

The field files, one per input family candidates may read; see Vocabulary.

CampaignConfig.operators#

The operator file: the operators candidates may call and their parameter values.

CampaignConfig.acceptance#
CampaignConfig.market#

The data as the prompts describe it, such as “adjusted daily bars of every US common stock”.

CampaignConfig.prompts#