Skip to main content

RL-pricing

A reproducibility lab for trading AI. RL-pricing re-tests published claims about deep RL agents, LLM trading agents and forecasters under one pre-registered protocol. This package holds the lab's instruments:

  • rl-pricing bench: a causal backtesting benchmark. Policies decide at the close and fill at the next open with fees; learned policies run over several seeds; frozen policies are scored on a live forward-test track; and a decision ledger records LLM agents' trades before each US market open.
  • rl-pricing --mode train|backtest|ensemble|lstm: the share-trading toolkit that trains and backtests Stable-Baselines3 agents (A2C, PPO, DDPG, TD3, SAC), a rolling ensemble and an LSTM forecaster on daily equity data.

Score your own policy

A policy maps the history up to today's close to long-only target weights, which fill at the next open. Put it in a submission directory:

# my-submissions/low-vol/policy.py
import numpy as np

from rl.bench.policy import Policy


class LowVolHalf(Policy):
    """Equal-weight the calmer half of the listed assets."""

    def act(self, view):
        closes = view.history.window(64).close
        vol = np.nanstd(np.diff(np.log(closes), axis=0), axis=0)
        vol = np.where(view.listed & np.isfinite(vol), vol, np.inf)
        keep = np.argsort(vol)[: max(1, view.listed.sum() // 2)]
        weights = np.zeros(len(view.tickers))
        weights[keep] = 1 / len(keep)
        return weights

and describe it in my-submissions/low-vol/submission.json:

{"name": "Low-vol half", "kind": "other", "policy": "policy.py:LowVolHalf", "trials": 1}

A submission can also name a built-in policy, such as "policy": "rl.bench.policies.baselines:Momentum" or "policy": "rl.bench.policies.sb3:SB3Policy" with "params": {"algo": "ppo"}. Then score it against 1/N buy-and-hold:

pip install rl-pricing
rl-pricing bench tasks
rl-pricing bench run --task synthetic --submission low-vol \
    --submissions-root my-submissions --out-root board
rl-pricing bench leaderboard --out-root board --no-readme

synthetic runs offline; the real tasks (us-sectors, us-multi-asset, crypto-majors, …) download their data on first use into datasets/bench/, or $RL_PRICING_DATA.

The import package is rl, so this distribution can't share an environment with the unrelated rl (GNU Readline bindings) distribution. The policy interface, the submission.json fields, the record formats and the rl-pricing commands follow semantic versioning; see the changelog.

The training toolkit's environment, preprocessing and training code are adapted from FinRL, which is MIT-licensed.

Metadata

Release files for rl-pricing 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rl-pricing 2.0.0
File Size Uploaded Provenance Actions
rl_pricing-2.0.0.tar.gz 276.4 kB With provenance Details for rl_pricing-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rl-pricing 2.0.0
File Interpreter ABI Platform Actions
rl_pricing-2.0.0-py3-none-any.whl Python 3 none any Details for rl_pricing-2.0.0-py3-none-any.whl

Total release size: 467.8 kB

Release files / rl_pricing-2.0.0.tar.gz

Download URL rl_pricing-2.0.0.tar.gz
Size 276.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3e01f5b805cc457a85328b586321456cefe0978b168d7c7f679fe2e2d8649f82
BLAKE2b-256 checksum
How to use checksums
2e06a0754269638de262775f307e9809a3630c6dd3a7a48b13ff5959e7a1c49c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / rl_pricing-2.0.0-py3-none-any.whl

Download URL rl_pricing-2.0.0-py3-none-any.whl
Size 191.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14f464615bd08b1c7433a5e291339237d90f7b8bc8bfbbad0236e04a4cac01e0
BLAKE2b-256 checksum
How to use checksums
6186ad28d906df5a93152584bfc0f1aa9324f13f5f7b63357c3aad7da8a71ae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for rl-pricing 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rl_pricing-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page