trader.errors module

Typed exceptions for the whole package.

Every failure the app raises deliberately derives from TraderError, so callers can distinguish our errors from third-party SDK noise.

exception trader.errors.BacktestError[source]

Bases: TraderError

A backtest cannot produce a meaningful result from the inputs given.

exception trader.errors.BrokerError[source]

Bases: TraderError

The broker API call failed.

exception trader.errors.ConfigError[source]

Bases: TraderError

Configuration is missing or invalid.

exception trader.errors.MarketDataError[source]

Bases: TraderError

The market data provider call failed or returned nothing usable.

exception trader.errors.MissingCredentialsError[source]

Bases: ConfigError

Credentials required for the selected trading mode are absent.

exception trader.errors.NonRetryableMarketDataError[source]

Bases: MarketDataError

A MarketDataError caused by the content of what was returned, not a transient fetch failure – retrying reproduces the identical failure (issue #99: yfinance served the same malformed bar 17 minutes apart). resilience/retrying.py’s _NEVER_RETRIED skips the retry-with-backoff for exactly this reason: waiting does not fix these.

exception trader.errors.OrderError[source]

Bases: TraderError

Submitting, cancelling, or reading an order failed.

exception trader.errors.PerformanceError[source]

Bases: TraderError

A return (account or benchmark) cannot be computed from the inputs given.

exception trader.errors.ReplayError[source]

Bases: TraderError

A replay tried to use information from after the decision instant.

Raised, never warned: a point-in-time leak does not degrade a replay result, it manufactures one. Issue #7’s scoring rule calls this “the easiest thing to get wrong and the one that would silently invent skill”.

exception trader.errors.RiskHaltError[source]

Bases: TraderError

A guardrail halted trading for the remainder of the day.

exception trader.errors.TraderError[source]

Bases: Exception

Base class for all errors raised by this application.

exception trader.errors.UnsafeConfigError[source]

Bases: ConfigError

Configuration would risk real money. The app must fail closed.