Skip to main content

johnnybt-ledger-polars

An amount-based bookkeeping policy for johnnybt's account walk, as a polars expression plugin.

The framework's default policy (johnnybt-polars) is market-neutral: a buy only fills from cash the account actually has, nobody runs a debt. This one keeps the books the way a production A-share ledger does:

  • Netted funding. A decision is funded once, at sizing, with the gap between target equity and holdings — on the assumption its sells go through. Fills carry no cash check; what a refused sale leaves unpaid becomes a debt in that tranche's own pocket, outside the account's cash and its reported equity, until the next net sale repays it.
  • A sellable budget in money, account-wide. One per name across every tranche and the liquidation pool, reset at each close to everything held, drawn down by what each decision meant to sell rather than by what it sold.
  • Two-pass sizing. A mask pass sizes under the tighter cash, the frozen budget is released, then the trading pass sizes again — the two see different cash on purpose.
  • Estimated commission frozen with a blocked order, at the share count the order was sized for.

It is one Bookkeeping implementation of johnnybt_engine's account walk: the walk — pricing, ex-dividend, the liquidation pool, equity snapshots — is the same for every market, and only the funding, sizing and settlement rules live here.

Install

pip install johnnybt-ledger-polars

Prebuilt wheels — no Rust toolchain needed. One per platform, abi3 against Python 3.11, which covers 3.11 through 3.14:

x86_64 arm64
Linux manylinux2014 (glibc 2.17 and up) manylinux2014 (glibc 2.17 and up)
macOS 10.12 and up 11.0 and up
Windows yes yes

Use

import polars as pl
from johnnybt_ledger_polars import simulate

equity = frame.group_by("account").agg(simulate(columns, **kwargs))

columns and kwargs are johnnybt's SimulateKwargs contract — which column plays which part, the market's rules, the account's terms. The same call shape as johnnybt_polars.simulate, a different policy behind it.

Build

maturin develop --release      # or: maturin build --release

Rust ≥ 1.85, Python ≥ 3.11 (abi3). A pure-Python twin of this policy is held bit-for-bit equal to it by test, which is how the rules stay honest.

Licence

MIT

Metadata

Release files for johnnybt-ledger-polars 0.1.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 johnnybt-ledger-polars 0.1.0
File Size Uploaded Provenance Actions
johnnybt_ledger_polars-0.1.0.tar.gz 59.5 kB With provenance Details for johnnybt_ledger_polars-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for johnnybt-ledger-polars 0.1.0
File Actions
johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl
johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl
johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 28.5 MB

Release files / johnnybt_ledger_polars-0.1.0.tar.gz

Download URL johnnybt_ledger_polars-0.1.0.tar.gz
Size 59.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c8943e08ab13090b96170ad45716630a2060d987f4d206bbd18fd5716aac3a93
BLAKE2b-256 checksum
How to use checksums
9b65353e44f5506ed180702ac15c1dff4859a86fe6f1b2b131f9ed370b9ed683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl
Size 4.6 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
44bb309d4872cb0b188648b4a5eb42a2396f74f576d1fe371c975d134b630012
BLAKE2b-256 checksum
How to use checksums
8eb112e5aa443eee5d2e671d862d87e63952f2ddea3f09fa2a243c892eb0b27f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl
Size 5.0 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a2001ae0308b50e31a8d322b102799d74f37cab279fff4587ef203e3be163cf3
BLAKE2b-256 checksum
How to use checksums
d3ef812955004bb2c612d4613fb7cd21e77462b42035045720c53ffc8a070c7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8ec8d0e7dfb8b5bba00f9f90ce8868a1ec7899c9528f8e14fcd17bee33891d20
BLAKE2b-256 checksum
How to use checksums
53f7eb59bfa0dd05593622a99e3c54e815d21242877b6c7797d1035d979a7bc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
11362669afca8b3f607f13acc09bae06ee2b8ff2168e5b480cb7f9a39f3be997
BLAKE2b-256 checksum
How to use checksums
8ac83335ece2f41e521e85626ae64584c0acdf34bb921477c32b860b197fc189
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 4.5 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6833511bc5b304da3503cead986f0dd04c86ca0514b80904eebc832c0b77e4a2
BLAKE2b-256 checksum
How to use checksums
fa8f89e5d2bc11248ae0fa4eca5ae4a9cdcfa0d4ac031beac2569d50203b2ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Release files / johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.7 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0b1e6f1672f4d74bfbe8de8f156cd6d48e72be2a652af32ac3422847e5481bc2
BLAKE2b-256 checksum
How to use checksums
921d68081585ece2b1c40dbaf9a8eb6d75f5e8b6897da21b1a0c95abea9abcf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Security for johnnybt-ledger-polars 0.1.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 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for johnnybt_ledger_polars-0.1.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 Sep 10, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 release files Full provenance

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