Virtufin Lib
A C#/.NET 10 financial services library implementing the Entity-Attribute-Value (EAV) pattern, a Variant discriminated union, FlatBuffers binary serialization, and reactive observables for NATS / WebSocket / Valkey data sources.
Key Features
| Feature | Description |
|---|---|
| EAV Framework | Registry-based entity-attribute-value model with pluggable value providers |
Variant Type |
Sealed discriminated union (None / Bool / Int32 / String / Dictionary / Array) with implicit C# conversions |
DecimalAmount |
Arbitrary-precision decimal arithmetic with explicit precision (Whole/Fraction/N) |
| FlatBuffers Serialization | Cross-language binary format — Variant round-trips with C#, Python, and TypeScript |
| Reactive Observables | IObservable<T> adapters for NATS subjects, WebSocket frames, and Valkey keyspaces — with auto-reconnect |
DecimalAmount-Backed Cash |
Currency-aware money with mismatched-currency rejection |
| Position / Scenario / Contract Primitives | Financial-domain types for trading and risk workflows |
| .NET 10 / AOT-compatible | Source-generated JSON contexts; NativeAOT-ready; nullable reference types throughout |
Project Layout
The library is split into 4 projects with a strict dependency direction:
flowchart LR
Util --> Core
Core --> Base
Data --> Core
Data --> Base
Base --> Core
Util --> Base
Virtufin.Core— EAV abstractions, financial traits,DecimalAmount,Variant-related helpers. No dependency onVirtufin.Base.Virtufin.Base— Concrete implementations of the traits inCore:Currency,Cash,Position,PositionSize,Transaction,Scenario, etc.Virtufin.Data—Varianttype, FlatBuffers schema + serialization, NATS / WebSocket / ValkeyIObservable<T>adapters.Virtufin.Util— Utility helpers (time, formatting, etc.).
Get Started
- Overview — What the library is and what it isn't
- Getting Started — Install via NuGet, instantiate
Variant, register an entity - Architecture — Project boundaries, dependency direction, and the trait/concrete split
- API Reference — Full public API (DocFX-generated from C# XML doc comments)
Project README
The full project README (build commands, test commands, project overview) lives in the GitHub repo.