This guide gets a working EntryPointClient running in less than a minute,
without a real B3 EntryPoint endpoint, by routing it to the in-memory FIXP
peer that ships with this repo.
- .NET 10 SDK (see
global.jsonfor the exact version pin)
dotnet run --project samples/B3.EntryPoint.QuickstartExpected output:
Connected. State=Established
Submitted 42
Terminated.
The full source is at
samples/B3.EntryPoint.Quickstart/Program.cs
and walks through the canonical lifecycle:
- Boot a local peer —
InMemoryFixpPeerlistens on a dynamic loopback port and answers Negotiate / Establish / Terminate. - Build options —
EntryPointClientOptionscarries the peer endpoint,SessionId,SessionVerId,EnteringFirm, andCredentials. ConnectAsync— runs the FIXP handshake (Negotiate → Establish) and starts the inbound loop.SubmitAsync(NewOrderRequest)— encodes aNewOrderSingleSBE frame and pushes it across the socket. Pre-tradeRiskGates(if registered) evaluate first.- Drain
Events()—IAsyncEnumerable<EntryPointEvent>of decodedOrderAccepted/OrderModified/OrderCancelled/OrderTrade/OrderRejected/BusinessReject. TerminateAsync— sends aTerminate(Finished)and tears the session down cleanly.
Swap the peer for a real address:
var options = new EntryPointClientOptions
{
Endpoint = new IPEndPoint(IPAddress.Parse("10.0.0.5"), 9_000),
SessionId = 12345,
SessionVerId = 1,
EnteringFirm = 1234,
Credentials = Credentials.FromUtf8(File.ReadAllText("/secrets/key")),
};Wire an ISessionStateStore (e.g. FileSessionStateStore) via
EntryPointClientOptions.SessionStateStore and the client will:
- Hydrate
LastOutboundSeqNum/ outstanding orders onConnectAsync. - Append an
OutboundDeltaafter every send. - Append
OrderClosedDeltaon terminal Execution Reports. - Compact every
StateCompactEveryDeltas(default 1024) updates.
options.SessionStateStore = new FileSessionStateStore("/var/lib/myapp/state");
options.StateCompactEveryDeltas = 512;Telemetry uses pure BCL primitives (no SDK dependency):
ActivitySource("B3.EntryPoint.Client")— spans for Connect/Negotiate/ Establish/Terminate and every Submit/Replace/Cancel/MassAction.Meter("B3.EntryPoint.Client")— counters (orders.submitted,orders.replaced,orders.cancelled,orders.mass_actions,risk.rejections,session.terminations) and a histogram (outbound.latencyin ms).
Hook them up with the OpenTelemetry .NET SDK in your host process — no configuration is needed in this library.