跳转至

Lite Reference

Lightweight Tradelearn 1.x style API.

Back to API Reference

Lite public facade.

TargetOrderConstraints dataclass

Optional trading constraints applied while building target-weight intents.

Backtest

Tradelearn Lite quick backtest facade.

run

run(**kwargs) -> LiteStats

Run the backtest and return statistics.

optimize

optimize(**kwargs) -> LiteStats

Run a finite grid sequentially with isolated, identically configured runs.

plot

plot(*args, **kwargs)

Return market replay charts for the most recent Lite run.

report

report(
    path: str = "report.html", benchmark=None, sections=None
)

Write a Tradelearn report for the most recent Lite run.

log_mlflow

log_mlflow(
    experiment_name: str | None = None,
    run_name: str | None = None,
    *,
    research_result: Any = None,
    uri: str | None = None,
    log_report: bool = False,
    attachments: tuple[str, ...] = (),
) -> Any

Record the last result using the independent post-run integration.

Strategy

Tradelearn Lite strategy facade.

init

init()

Initialize shared streaming lines and strategy-owned state.

position

position(ticker: str | None = None) -> Any

Return the Tradelearn Lite position view for a ticker.

record

record(
    name=None,
    plot=True,
    overlay=None,
    color=None,
    scatter=False,
    **kwargs,
)

Record observations at the delivered clock, without copying future bars.

window

window(size: int, data=None, ago: int = 0)

Copy the delivered OHLCV window using the shared research converter.

target_weights

target_weights(
    weights: Mapping[str, float] | Series,
    *,
    close_missing: bool = True,
    constraints: Any | None = None,
) -> list[Any]

Move the portfolio toward the requested ticker weights.

cash is accepted as a reserved key and is not translated into an order.

close_all

close_all() -> list[Any]

Close all known Lite data-feed positions.

start_on_bar

start_on_bar(n: int) -> None

Start next no earlier than bar index n.

Indicator

Base class for Engine custom indicators.

Built-in indicators are intentionally not exposed from tradelearn.engine. Use qualified tradelearn.indicators sources for persistent indicators, or subclass this class for strategy-specific custom indicators.