Skip to content

Latest commit

ย 

History

100 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ KPR

Financial analytics and instrument pricing for Excel/VBA

Explicit conventions ยท Defensible numerics ยท Source-first engineering ยท Excel-native delivery ยท Reviewable evidence


Excel VBA Platform Status Development Focus License


Release Issues Stars Last commit


Overview ย ยทย  Status ย ยทย  Target scope ย ยทย  Architecture ย ยทย  Quality model ย ยทย  Installation ย ยทย  Contributing ย ยทย  Security


KPR โ€” multi-screen market quotations, rate curves and instrument-pricing analytics for Excel/VBA


โœจ Overview

KPR is a new Excel/VBA library for financial analytics and instrument pricing.

The project is designed for practitioners who need transparent calculations in Excel without surrendering the model contract to an opaque workbook formula or an undocumented convention. Its intended foundation is a set of reusable, source-controlled components that make dates, conventions, cash flows, numerical methods, prices, and analytical results explicit.

KPR aims to sit between two unsatisfactory extremes:

Extreme KPR's intended response
A one-off workbook with formulas that are difficult to review and reuse Exported, modular VBA with documented public contracts
A black-box pricing stack that is difficult to inspect from Excel Transparent algorithms, attributable references, and reproducible tests

Important

KPR is in pre-release development. main contains the implemented v0.0.2 date-layer candidate, but it has no supported installation package or production release yet. The wider scope described below is a development direction, not a claim that every capability is already implemented.


โญ Why KPR

Design goal Practical value
๐Ÿ“ Convention-explicit Day counts, calendars, settlement, compounding, quotation, signs, and curve rules are part of the contract.
๐Ÿงฎ Numerically defensible Results are compared with independent references, invariants, boundaries, and stated tolerances.
๐Ÿ“Š Excel-native The library is intended for worksheet UDFs and VBA callers without hiding the analytical logic.
๐Ÿ” Reviewable source Exported .bas, .cls, .frm, .frx, and RibbonX files provide a diffable engineering record.
๐Ÿงฑ API-disciplined Supported entry points are separated from callbacks, infrastructure, and internal helpers.
๐Ÿ”’ Caller-safe Workbook content and global Excel state remain caller-owned unless an API explicitly establishes mutation scope.
โš™๏ธ Deployment-conscious Design targets managed Windows environments and both 32-bit and 64-bit Office.
๐Ÿงพ Evidence-led Validation reports what ran, on which environment, against which reference, and what remains unverified.

๐Ÿšง Project status

KPR is pre-release. The v0.0.1 tag records repository setup only. The v0.0.2 date-layer contract is frozen and its 22-name calculation surface is implemented on main; registration, complete generated fixtures and evidence, UI integration, demo assembly, and exact-candidate certification are still in progress.

Status legend

โœ… Established     present and usable as repository policy
๐Ÿšง In progress     actively being defined or migrated
๐Ÿงญ Target          planned direction; not yet a supported contract
โ€”  Not published  no supported functional release artifact or API exists yet

Current baseline

Area Status Boundary
Repository identity and governance โœ… KPR-native README, conduct, contribution, security, and changelog baselines
Date-layer contract โœ… The normative v0.0.2 behavior and exact 22-name surface are frozen in docs/DATE_LAYER_CONTRACT.md
Supported release API โ€” The implemented date surface is still an untagged candidate, not a supported functional release
KPR analytical source ๐Ÿšง Gregorian primitives, strict parsing, host/date-system policy, pillar conversion, and scalar/array wrappers are implemented but not release-certified
Numerical reference sets ๐Ÿงญ Evidence format and provenance will be defined with each analytical surface
Regression harness ๐Ÿšง Focused scalar, host, pillar, surface, shape, and parity suites exist; complete generated fixtures and release evidence remain open work
Installable workbook or add-in โ€” No official package is available
Tagged release โœ… v0.0.1 certifies repository setup only; no functional production release exists

Warning

Files on main are development material. Do not describe them as a supported KPR release or use them as the sole basis for a material financial decision.

Current v0.0.2 development surface

  • KPR_DATES_DAYS.bas exposes exactly 22 KPR_Dates_* functions.
  • The 21 value-taking functions share one scalar/array-capable surface; KPR_Dates_HostDateSystem() remains scalar-only.
  • Text dates accept ISO YYYY-MM-DD only, and the supported date window is 1900-03-01 .. 9999-12-31.
  • Multi-cell behavior is claimed only for dynamic-array Excel; no legacy CSE claim is made.
  • Focused Windows Excel results for the implemented array surface are recorded on issue #17. They support that issue's closure but do not replace the final exact-source certification owned by issue #29.

See the date-layer contract for behavior and the implementation plan for remaining scope and sequencing.


๐Ÿงญ Target scope

KPR is intended to grow in layers, with foundational contracts landing before instrument pricing that depends on them.

1. Dates and conventions

Capability Intended coverage
๐Ÿ“… Date handling Validated Excel/VBA dates, serial boundaries, and deterministic parsing rules
๐Ÿฆ Business calendars Reusable holiday calendars, weekends, and calendar composition
โ†ช๏ธ Date rolling Unadjusted, following, preceding, modified, and nearest-style conventions where specified
โฑ๏ธ Day counts Explicit accrual conventions with documented boundary behavior
๐Ÿ—“๏ธ Schedules Coupon/payment schedules, stubs, end-of-month behavior, and adjusted/unadjusted dates

2. Rates, discounting, and curves

Capability Intended coverage
๐Ÿ“ˆ Rate mathematics Simple, compounded, continuously compounded, and discount-factor transformations
๐Ÿ’ฐ Time value Present value, future value, annuity, and cash-flow primitives
๐Ÿ“‰ Interpolation Explicit interpolation/extrapolation methods and domains
๐Ÿงฑ Curves Reviewable curve representations and, later, calibration/bootstrapping components

3. Cash flows and instruments

Capability Intended coverage
๐Ÿงพ Cash flows Dated, signed, currency-aware cash-flow structures
๐Ÿท๏ธ Money-market products Deposits and related short-rate instruments
๐Ÿ“œ Fixed income Bond cash flows, accrued interest, clean/dirty price, and yield relationships
๐Ÿ” Linear derivatives FRAs, futures-style analytics, and interest-rate swaps as foundations mature
๐Ÿงฉ Extensions Additional instruments only when conventions, references, and tests are defensible

4. Analytics and risk

Capability Intended coverage
๐ŸŽฏ Sensitivities Transparent finite-difference or analytical measures with bump conventions
๐ŸŒก๏ธ Scenarios Deterministic input transformations and reproducible result comparisons
๐Ÿ”Ž Diagnostics Convergence, domain, convention, and missing-input information
๐Ÿ“Š Aggregation Cash-flow and analytical summaries with explicit units and signs

This is a directional scope, not a release commitment. Exact functions, signatures, defaults, and sequencing will be documented as they are designed and validated.


๐Ÿ“ Financial contracts

Every supported calculation should answer the questions that determine its meaning:

Contract dimension Examples
๐Ÿงพ Instrument Cash flows, payoff, rights, obligations, and optionality
๐Ÿ“… Dates Valuation, trade, settlement, fixing, payment, and maturity
๐Ÿ’ฑ Units Currency, notional, price scale, rate scale, and output units
๐Ÿ—“๏ธ Conventions Calendar, roll, day count, frequency, stub, and end-of-month rule
๐Ÿ“ˆ Quotation Price, yield, rate, spread, volatility, discount factor, or probability
๐Ÿ” Compounding Simple, periodic, continuous, or another stated convention
โž• Signs Long/short, payer/receiver, asset/liability, and cash-flow direction
๐Ÿ“‰ Curves Input type, interpolation, extrapolation, compounding, and missing data
๐Ÿšง Domain Valid, invalid, ambiguous, and unsupported inputs
โš ๏ธ Failure Error, structured outcome, non-convergence, and unavailable result
๐ŸŽฏ Accuracy Precision, rounding, absolute/relative tolerance, and reference quality

A formula without its financial conventions is not a reusable pricing contract.


๐Ÿ—๏ธ Architecture

KPR is intended to separate Excel-facing convenience from financial and numerical logic.

flowchart TB
    X["Excel UDFs and VBA callers"] --> A["Supported KPR API"]
    A --> P["Pricing and analytics engines"]
    P --> C["Cash flows and curves"]
    C --> F["Dates ยท conventions ยท numerics"]
Loading

Layer responsibilities

Layer Responsibility Must not silently decide
๐Ÿ“Š Excel surface Convert worksheet/VBA inputs and expose supported results Financial conventions from formatting or locale
๐Ÿงฑ Public API Validate contracts and provide stable caller-facing behavior Undocumented defaults or compatibility changes
๐Ÿงฎ Engines Apply pricing and analytical algorithms Data ownership or Excel host state
๐Ÿงพ Cash flows and curves Represent dated values and market structures Missing-data or extrapolation policy without a contract
๐Ÿ“… Foundations Dates, calendars, conventions, solvers, and numerical primitives Instrument-specific assumptions

Public versus internal surface

A VBA member being technically Public does not automatically make it supported consumer API. Excel UDF resolution, RibbonX, Application.Run, callbacks, tests, or packaging may require public visibility for infrastructure members.

The v0.0.2 candidate calculation API is documented explicitly in the date-layer contract. Everything outside that 22-name surface is infrastructure or internal implementation unless separately classified. No candidate API becomes a supported release merely by existing on main.


๐Ÿ›ก๏ธ Engineering principles

Source-first

The authoritative engineering record is exported, reviewable source. Binary workbooks and add-ins are distribution artifacts, not substitutes for source.

Caller-owned state

KPR must not infer permission to modify workbook content or global Excel state. Temporary state changes require explicit ownership, bounded scope, cleanup, and failure handling.

Deterministic failures

An invalid domain, ambiguous convention, non-convergence, or missing input must not produce a plausible-looking result. Failure behavior is part of the public contract.

No self-referencing evidence

The implementation under test must not generate its own expected results. Reference values require independent provenance or independently derived invariants and limits.

Environment honesty

Compatibility claims must name the Excel, Windows, Office bitness, locale, and date system actually tested. Untested configurations remain unverified.


๐Ÿงช Quality model

KPR's intended validation stack is layered:

Layer Question answered
๐Ÿ› ๏ธ Compile Does the complete imported VBA project compile?
๐Ÿ”ฌ Unit Does each financial/numerical primitive honor its local contract?
๐Ÿ› Regression Does every corrected defect remain permanently covered?
๐Ÿ“š Reference Does output match independent values within a justified tolerance?
โš–๏ธ Invariant Do parity, bounds, monotonicity, symmetry, round trips, and limits hold?
โ†”๏ธ Boundary Are date, domain, discontinuity, and convergence edges explicit?
๐Ÿ“Š Integration Do worksheet and VBA entry paths preserve the same financial meaning?
๐Ÿ“ฆ Artifact Does the packaged workbook/add-in correspond to the tested source?

Numerical evidence record

A numerical claim should identify:

function and contract
input domain
reference source and precision
absolute / relative tolerance rule
worst observed error and location
Excel / Windows / Office environment
what the evidence does not cover

KPR does not currently publish a certified regression count or numerical accuracy envelope. Those badges and claims will appear only after evidence is generated and committed or attached to a release.


๐Ÿ“‚ Repository structure

KPR/
โ”œโ”€ .github/
โ”‚  โ”œโ”€ ISSUE_TEMPLATE/          bug and feature intake
โ”‚  โ”œโ”€ scripts/
โ”‚  โ”‚  โ””โ”€ labels-sync.mjs      label validation and reconciliation
โ”‚  โ”œโ”€ workflows/
โ”‚  โ”‚  โ”œโ”€ labels-sync.yml      declarative label synchronization
โ”‚  โ”‚  โ””โ”€ static-checks.yml    hosted repository-integrity gate
โ”‚  โ”œโ”€ labels.json             canonical issue-label manifest
โ”‚  โ””โ”€ PULL_REQUEST_TEMPLATE.md
โ”œโ”€ assets/
โ”‚  โ””โ”€ social-preview.png      archive-safe README and social-preview source
โ”œโ”€ docs/
โ”‚  โ”œโ”€ DATE_LAYER_CONTRACT.md  normative v0.0.2 behavior
โ”‚  โ”œโ”€ IMPLEMENTATION_PLAN.md  scope, sequencing, and milestone register
โ”‚  โ””โ”€ VBE_EXPORT.md           VBE export/import format
โ”œโ”€ src/
โ”‚  โ””โ”€ modules/
โ”‚     โ”œโ”€ KPR_Core_Err.bas     condition and native-error policy
โ”‚     โ”œโ”€ KPR_Core_Parse.bas   strict scalar parsing and host classification
โ”‚     โ”œโ”€ KPR_Core_Dates.bas   pure Gregorian and pillar calculations
โ”‚     โ”œโ”€ KPR_Core_Array.bas   shape, broadcasting, and materialization services
โ”‚     โ””โ”€ KPR_DATES_DAYS.bas   22-name worksheet-facing date facade
โ”œโ”€ test/
โ”‚  โ””โ”€ modules/
โ”‚     โ””โ”€ KPR_REGRESSION_TESTS.bas
โ”œโ”€ tools/
โ”‚  โ””โ”€ check_repo.py           static gate and self-test harness
โ”œโ”€ VERSION                     machine-readable current version
โ”œโ”€ .gitattributes               source and line-ending policy
โ”œโ”€ .gitignore                   local and generated-file exclusions
โ”œโ”€ .editorconfig                shared editor baseline
โ”œโ”€ README.md                    project overview and status
โ”œโ”€ INSTALLATION.md              future release installation guidance
โ”œโ”€ CONTRIBUTING.md              engineering and evidence standards
โ”œโ”€ CODE_OF_CONDUCT.md           community expectations
โ”œโ”€ SECURITY.md                  security model and disclosure policy
โ”œโ”€ CHANGELOG.md                 version history from the first release
โ””โ”€ LICENSE                      MIT License

The tracked tree is KPR-native. KPR_DATES_DAYS.bas and its four cores are development source, not a release-certified package. The current regression module is focused development infrastructure; generated fixtures, final evidence, demo, registration, and UI files will be added only by their owning milestone issues.


๐Ÿ–ฅ๏ธ Requirements

These are the intended host requirements, pending certification of the first release:

Requirement Intended baseline
Host Microsoft Excel desktop
Operating system Windows
Office architecture 32-bit and 64-bit
VBA Macros enabled through an organization-approved trust mechanism
Host format Macro-enabled workbook/add-in where deployment requires VBA
Runtime dependencies No mandatory third-party runtime dependency intended
Network No network access intended for core calculations

Actual supported versions will be stated only after they have been tested.


๐Ÿ“ฆ Installation

No supported KPR installation package exists yet.

Warning

Do not install or redistribute development files from main as an official KPR workbook or add-in.

The Installation Guide currently provides contributor-only source-import guidance and will be completed when the first installable release candidate defines:

  • supported Excel and Windows versions;
  • source-import and/or add-in deployment;
  • references and macro-trust requirements;
  • compilation and post-install validation;
  • upgrade and compatibility rules; and
  • clean removal.

Future official artifacts will be published only through GitHub Releases.


๐Ÿ” Security

KPR runs inside Excel with the permissions of the current user. It is not a sandbox or authorization layer.

Read SECURITY.md before deploying macro-enabled code or reporting a vulnerability. Use synthetic examples and disclose suspected vulnerabilities privately.


๐Ÿค Contributing

Contributions are welcome once their financial contract and validation boundary are explicit.

Before contributing, read:

For material features, pricing models, API changes, dependencies, or architectural work, open an issue before implementation.


๐Ÿ—บ๏ธ Development sequence

The intended sequence is dependency-led:

  1. complete and certify v0.0.2 date primitives and their Excel integration;
  2. add calendars, weekend masks, holiday sets, and composition in v0.0.3;
  3. add business-day arithmetic and roll conventions in v0.0.4;
  4. establish rate mathematics and numerical primitives;
  5. add cash-flow and curve representations;
  6. add instruments only with independent references and contract tests; and
  7. publish functional releases with reproducible demos, installation guidance, and exact-source validation evidence.

This sequence may change as design work and evidence reveal better boundaries.


๐Ÿ“œ Versioning and changelog

KPR follows Semantic Versioning and maintains release notes in Keep a Changelog format.

v0.0.1 is published as a repository-setup pre-release. It certifies governance, automation, and the repository baseline; it is not a functional or production-ready release and does not provide a supported installation package. See CHANGELOG.md.


โš–๏ธ Financial-model disclaimer

KPR is analytical software, not financial, investment, legal, accounting, or regulatory advice. Users remain responsible for independent model validation, market-convention verification, governance, suitability, controls, and review of all outputs used in a material decision or production process.


๐Ÿ“„ License

KPR is licensed under the MIT License.


KPR engineering principle

Define the convention ยท Expose the assumption ยท Prove the number ยท Preserve the caller ยท State the boundary


Maintained by Daniele Penza

About

An Excel/VBA library for financial analytics and instrument pricing.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages