trader.evaluation.base module

The evaluator interface: the second opinion between a signal and an order.

A strategy says “this looks like a buy”. An evaluator says whether that is worth acting on. Keeping them separate is what lets OllamaEvaluator drop in next slice without touching a strategy — and, because BacktestEvaluator is deterministic, what lets the LLM’s decisions be diffed against a reproducible baseline. Without that baseline there is no way to tell whether the model added judgement or noise.

class trader.evaluation.base.Evaluator(*args, **kwargs)[source]

Bases: Protocol

Decides whether a signal is worth acting on.

evaluate(symbol, bars, signal)[source]

Judge signal for symbol, given bars up to the decision bar.

Parameters:
  • symbol (str)

  • bars (Sequence[Bar])

  • signal (Signal)

Return type:

Verdict

class trader.evaluation.base.Verdict(approved, reason, evidence=<factory>)[source]

Bases: object

Whether to act on a signal, and the evidence behind that.

evidence holds backtest metrics today and an LLM’s output later, with no interface change — which is the point of it being a dict rather than a fixed set of metric fields.

Parameters:
  • approved (bool)

  • reason (str)

  • evidence (dict[str, object])

approved: bool
reason: str
evidence: dict[str, object]