DotGram.Finance 0.3.0

dotnet add package DotGram.Finance --version 0.3.0
                    
NuGet\Install-Package DotGram.Finance -Version 0.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotGram.Finance" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotGram.Finance" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="DotGram.Finance" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotGram.Finance --version 0.3.0
                    
#r "nuget: DotGram.Finance, 0.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotGram.Finance@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotGram.Finance&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=DotGram.Finance&version=0.3.0
                    
Install as a Cake Tool

DotGram.Finance

Reads and checks finance protocols and formats wherever they are kept rather than traded: logs, archives, files, message buses. Today that is FIX 4.2, FIX 4.4 and FIX 5.0 SP2 tag-value messages; other protocols and formats join the package as they are added. For netstandard2.0 and net10.0; DotGram compiles the grammar at build time, so applications need no DotGram runtime, grammar files, schema XML, reflection configuration or initialization step.

dotnet add package DotGram.Finance
using System;

using DotGram.Finance.Fix;
using DotGram.Finance.Fix.Fix44;

// One message, with the separator written as a pipe so it can be read on a page.
var wire = ("8=FIX.4.4|9=68|35=D|11=ORDER|55=ABC|54=1|60=20260915-12:00:00|" +
            "38=100|40=2|44=12.50|10=253|").Replace('|', '\u0001');

if (FixParser.TryParseMessage(wire, out var message, out var error) && message is FixMessage.NewOrderSingle order)
{
    Console.WriteLine(order.Symbol?.Value);
    Console.WriteLine(order.OrderQty?.Value);
}
else
{
    Console.WriteLine(error);
}

What it is for

  • Logs and archives. Every FIX engine journals what it sent and received, often with | for the separator and spaces around it. Incident review, audit, trade reconstruction, regulatory reporting and execution analysis are read from those journals — gigabytes a day, read from a stream in bounded memory, pipe-delimited or not.
  • Checking messages against a counterparty's dictionary before a certification or in a test suite: apply their data dictionary, and Validate reports every finding of a message at once, each with its rule, tag, position and path through the groups, rather than the first.
  • Buses and stores. Data kept in Kafka, a database or a queue — drop copy, post-trade, clearing — and read by a consumer that has no session to hold.
  • Files and other transports. End-of-day allocation and confirmation files, FIX carried over a queue, an HTTP or a WebSocket gateway.
  • Tools. Simulators, load generators, test harnesses, anonymizers, converters to other formats.
  • An engine of your own. Where the session layer is written in house, this is the parser and the checks under it.

Capabilities

  • FIX 4.2, FIX 4.4, FIX 5.0 SP2. Tag-value messages: fields, messages, streams, pipe-delimited logs, validation, dictionaries, and custom fields and messages. See the FIX document for all of it.

What it is not

It is not a FIX engine. There is no socket, no session: no logon, sequence numbers, heartbeats, resend requests, message store or schedule; a live trading connection needs an engine, which reads with its own parser. Where you hold the bytes, this reads them: ReadMessages takes the Stream your transport hands you.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 94 11/15/2026
0.2.0 160 10/1/2026
0.1.0 141 9/15/2026

Since 0.2.0. Validation is a question that keeps nothing, every finding says its way through the groups, the limits are the context's, and the types the reader builds are closed to code outside the package. The README has the whole surface; what follows is what changed and what to write instead.

BREAKING CHANGES, and what to write instead

- Validate keeps nothing. message.Validate(context) returns an IReadOnlyList<FixFinding>, empty when nothing is wrong and new on every call; InvalidFindings and IsValid are gone, and a second Validate asks again of the context it is given (it used to answer what the first call found). `if (!message.Validate(context)) Report(message.InvalidFindings)` -> `var findings = message.Validate(context); if (findings.Count > 0) Report(findings);`. Validate(context, findings) adds to a collection of the caller's and returns how many it added. What reading found is message.Findings, read-only and never null.
- FixFinding is a sealed class made by its factories: new FixFinding(rule, tag, position, field, entryIndex) -> FixFinding.Missing(tag), FixFinding.Of(rule, field) or FixFinding.Of(rule, tag), each with the path after it. EntryIndex -> Path, every group and entry on the way to the finding, outermost first, each a FixGroupStep(CounterTag, Index); a finding prints it (453[1].802[0] tag 803 at 86: DuplicateField). Position is -1 for a field the message does not have, where it was 0. Two findings are the same only if they are one object; a finding has no Deconstruct, and its properties no init, so a with expression over one no longer compiles.
- A custom message: OnValidate(context) -> OnValidate(context, findings), adding to the collection it is given. FixCustomMessage.AddFinding may be called only from Place, on the thread that reads the message; anywhere else it throws InvalidOperationException. FixMessage.AddFinding, SetStandardField and the setters of the standard header's and trailer's properties are the package's own.
- FixMessage.Invalid -> FixMessage.Unknown, the message of a MsgType nothing builds; its finding is UnknownMessageType.
- A group entry is built by the reader alone: the 644 entry classes lose their public constructor, and the entry's first field is a get-only property that is never null.
- FixField, the typed field classes under it and FixContext cannot be derived from outside the package: the constructors FixField(tag, isValid), FixField.Typed<T>(tag, value) and FixField.Typed<T>(tag, parsed) are gone. A field is built by its own class, new FixField.Decimal(tag, (true, value)).
- The limits are the context's. The largest message read from a reader or a stream is the context's MaxMessageLength (16 MiB unless given); the maxMessageLength parameter of ReadMessage, TryReadMessage, ReadMessages and ParseMessages and FixParser.DefaultMaxMessageLength are gone: ReadMessage(input, maxMessageLength: n) -> ReadMessage(input, context with { MaxMessageLength = n }). Fix44Context.WithLogFraming -> Fix44Context.Log, one shared value (likewise Fix42Context and Fix50Context). FixMessageFactory -> MessageFactory. The emitTo parameter of With, Load and LoadFile is gone: Load(text, directory) -> (context with { CheckSourceDirectory = directory }).Load(text). A Framing that is neither Wire nor Log throws ArgumentOutOfRangeException when it is set.
- FixDictionaryField takes its tag in its constructor, and applying a dictionary refuses a field stored under a key other than its tag.
- A null argument throws ArgumentNullException from every Try call; TryParseMessage of a null byte array used to answer false.
- What only the package's own readers use is no longer public: FixConvert, the FixField.Invalid constructors and FixParser.DefaultMaxRetained. A value is converted by reading its field (ParseFields), as its tag's type; FixParser.DefaultMaxRetained -> Fix44Context.Default.MaxRetained (likewise Fix42Context and Fix50Context).

CHANGED

- A coded field whose text does not read as its type (Side 54=XYZ) is an InvalidValue finding; Validate used to throw InvalidOperationException from its Value.
- Every finding inside a group carries its path, and a finding of the whole message about a field inside an entry (a length not followed by its data, an encoded field without MessageEncoding) carries that entry's.
- The Try calls are annotated for nullability: after true the message is not null, after false the error is not null.
- BuildMessage reads a log with padded separators when the context frames a log; TryBuildMessage is public; both take the octets as a ReadOnlyMemory<byte> as well as a string.
- A stream reads a BeginString of any length and accepts another version's BeginString as a buffer does; Validate reports it.
- A tag nothing defines keeps its text in FixField.Invalid.RawText, or its octets in RawBytes.

FASTER

- Against 0.2.0 on the release benchmark, a message reads about 26% faster (an Order 27%, a FIX 5.0 report 28%), with the same allocation; the reader stores every member in a field behind a get-only property. The fields underneath read about 3.5% faster, and a malformed message read from a log about 8% slower. The assembly and the generated sources are smaller.
- A long data field read from a string is narrowed with a vectorized path on .NET.

KNOWN ISSUES

- A stream cannot read a log padded with spaces (read it whole), and a BodyLength that is missing or malformed ends the stream with a diagnostic, since without it there is no telling where the message ends.