Skip to content

C# SDK

STX.Sdk is the official .NET SDK for the STX trading exchange. It wraps the exchange HTTP API and Phoenix WebSocket channels as a set of services you register into the .NET dependency-injection container and resolve anywhere in your app.

One package, one ConfigureSTXServices call, dozens of typed service + channel clients.

  • Services for everything the exchange exposes: login, markets, events, orders, trades, settlements, profile, terms-and-conditions, geolocation.
  • Channel wrappers for real-time: portfolio balance, active orders/trades, positions, market updates, user info.
  • Automatic session management: optional background services keep the JWT refreshed and the geolocation token current.
dotnet add package STX.Sdk
// Register once in Program.cs / Startup.cs
services.ConfigureSTXServices(
STXEnvironment.OntarioDemo,
STXApiKeyCredentials.FromPemFile(keyId, "~/.stx/ontario.pem"));
// Resolve and use anywhere
var markets = await marketService.GetMarketInfosWithCountAsync();

Primarily targeted at market makers writing low-latency .NET trading bots, but the surface is generic, so any integrator building a .NET app against STX can use it.

The SDK speaks integer cents: price: 10 is 10¢, and Price, Fee and every other amount come back as integers in cents.

If you also read the REST and WebSocket documentation you will see prices written as dollar strings ("0.10"). Same prices, different surface. Pick one surface per component and the conversion never comes up; mix them and convert at the boundary.

Two reference apps live in one MIT-licensed repository:

  • console/: CLI trading bot showing authentication, market subscriptions, and order placement from a BackgroundService.
  • webapi/: ASP.NET Core 8 service exposing the SDK over HTTP, with Swagger UI.

Both run against the public demo environment out of the box:

git clone https://github.com/stxapp/stx-csharp-demo.git
v1.5.9Changelogllms.txtllms-full.txt