factor_agent.segments#

Evaluation segments: the date ranges the campaign and the acceptance read, the purge and the hold-out lock.

The training segment is the only one the campaign evaluates; the validation segment is read by Acceptance.validate and the hold-out by Acceptance.open_holdout, once.

The purge: a forward label at t reads prices up to lookahead bars past t, so wherever labels are read the last bars of a segment are dropped and no label reads a bar of the next segment. At least purge_bars (five) trading days are dropped, more when the label reads further (ret_5, whose label at t reads the open of t + 6, drops six).

The hold-out lock: Segments.open_holdout writes a lock file recording when and with which code version the hold-out was opened. A second open is refused unless forced; every open, forced or not, is appended to the lock.

Classes

HoldoutLock

The lock after an open: opens holds every open so far, this one last.

HoldoutOpen

One open of the hold-out: when (UTC), with which code, and whether it was forced past the lock.

Segment

A named, inclusive date range.

Segments

The training, confirmation, validation and hold-out segments, in that order, and the purge between them.

Functions

code_version

The commit (+dirty with uncommitted changes) of this package and of quantlab, and quantlab's version.

purge

The bars dropped at the end of a segment for a label that reads lookahead bars past t.