Skip to content

About

A low-level multi-language binding parser library for Interactive Brokers (IBKR) statements

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

statementkit

Parse brokerage statement content into actionable knowledge and numbers. A library for upper applications: a pure Rust core, a stable C ABI, and thin bindings for other languages on top.

Independent tool. Not affiliated with or endorsed by Interactive Brokers LLC.

Status

Version 0.2.0: exact-decimal numerics plus a streaming session over named statement targets, with optional ticker selection. The full stack is live: Rust core → Rust tests → C ABI → header → linked C consumer → published Python, Node, and Java bindings. Expect additive APIs at 0.x.

Layout

crates/statementkit      core: pure functions, no I/O, no FFI types
crates/statementkit-c    C ABI: status codes, out-params, panic-proofed
  include/statementkit.h hand-kept header; discriminants contractual
bindings/python          ctypes shim over the C ABI (pyo3 wheels later)
bindings/node            raw-WASM npm package, TypeScript types included
bindings/java            Panama FFM, JDK 22+, no JNI; Maven
                         io.github.heshiming:statementkit (natives embedded)
bindings/go              cgo over the static lib, plain `go test ./...`
tests/vectors/           shared ground-truth vectors every binding runs
scripts/c-smoke.sh       links tests/smoke.c against the static lib, runs it
scripts/bindings-test.sh builds all targets, runs every binding suite
scripts/docs.sh          builds the mdBook site (docs/); serve to preview
docs/                    mdBook site; src is the source of truth, docs/book/
                         is build output (deployed via .github/workflows/docs.yml)

All parsing logic lives in the core crate only. A binding that re-implements logic, or behaves differently from another binding, is a bug.

Quickstart

cargo test --workspace        # core unit + integration + FFI tests
scripts/c-smoke.sh            # builds release static lib, compiles and runs C smoke
scripts/bindings-test.sh      # python + go + node + java suites vs shared vectors

C usage — stream a CSV statement through a session:

#include "statementkit.h"
#include <stdio.h>
#include <stdlib.h>

const char *names[] = {"income", "trades"};
SkSession *s;
char err[256];
if (sk_session_open(&s, names, 2, NULL, 0, err, sizeof err) != SK_OK) { return 1; }

FILE *f = fopen("statement.csv", "rb");
unsigned char chunk[65536];
size_t n;
while ((n = fread(chunk, 1, sizeof chunk, f)) > 0) sk_session_feed(s, chunk, n);
fclose(f);
sk_session_end_file(s);

size_t len; sk_session_report_len(s, &len);
char *out = malloc(len + 1); sk_session_report(s, out, len + 1);
puts(out);                    /* compact JSON, numeric literals unquoted */
free(out);
sk_session_close(s);

Guarantees

  • No network I/O, no credentials, no telemetry — checkable in a network namespace.
  • No Rust panic ever crosses the FFI boundary (catch_unwind at every entry point; SK_PANIC as the last-resort status).
  • All test fixtures are synthetic. The library has never seen a real statement and ships none.
  • Money is exact decimal (Dec); binary float never carries a money value.

License

Apache-2.0. See LICENSE.

About

A low-level multi-language binding parser library for Interactive Brokers (IBKR) statements

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages