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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

johnnybt_ledger_polars-0.1.0.tar.gz (59.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl (4.6 MB view details)

Uploaded CPython 3.11+Windows ARM64

johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file johnnybt_ledger_polars-0.1.0.tar.gz.

File metadata

  • Download URL: johnnybt_ledger_polars-0.1.0.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for johnnybt_ledger_polars-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c8943e08ab13090b96170ad45716630a2060d987f4d206bbd18fd5716aac3a93
MD5 039aa272b4c91ade6de2bc580114577d
BLAKE2b-256 9b65353e44f5506ed180702ac15c1dff4859a86fe6f1b2b131f9ed370b9ed683

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0.tar.gz:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 44bb309d4872cb0b188648b4a5eb42a2396f74f576d1fe371c975d134b630012
MD5 d025f1d3687613a68d0f913e1296fe84
BLAKE2b-256 8eb112e5aa443eee5d2e671d862d87e63952f2ddea3f09fa2a243c892eb0b27f

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_arm64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a2001ae0308b50e31a8d322b102799d74f37cab279fff4587ef203e3be163cf3
MD5 38e2f86e15675846f00ed8d2a7bcaee7
BLAKE2b-256 d3ef812955004bb2c612d4613fb7cd21e77462b42035045720c53ffc8a070c7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-win_amd64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ec8d0e7dfb8b5bba00f9f90ce8868a1ec7899c9528f8e14fcd17bee33891d20
MD5 34cc87dfd41a6623809b7f0503ebe34e
BLAKE2b-256 53f7eb59bfa0dd05593622a99e3c54e815d21242877b6c7797d1035d979a7bc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 11362669afca8b3f607f13acc09bae06ee2b8ff2168e5b480cb7f9a39f3be997
MD5 400e4d8e3ef0edeabe5296f764cd8ba1
BLAKE2b-256 8ac83335ece2f41e521e85626ae64584c0acdf34bb921477c32b860b197fc189

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6833511bc5b304da3503cead986f0dd04c86ca0514b80904eebc832c0b77e4a2
MD5 a8b79d48758d32bc3a29910e67233c3d
BLAKE2b-256 fa8f89e5d2bc11248ae0fa4eca5ae4a9cdcfa0d4ac031beac2569d50203b2ab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0b1e6f1672f4d74bfbe8de8f156cd6d48e72be2a652af32ac3422847e5481bc2
MD5 c85b4710d8bb9307ebd1871d145db515
BLAKE2b-256 921d68081585ece2b1c40dbaf9a8eb6d75f5e8b6897da21b1a0c95abea9abcf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for johnnybt_ledger_polars-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on quant-on-quest/johnnybt-ledger-polars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 files

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