> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sportsxapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SportsX C# SDK: .NET 8 trading SDK overview

> STX.Sdk is the official .NET 8 package for SportsX. Register all services with one DI call and get typed GraphQL clients and WebSocket channels.

`STX.Sdk` is the official .NET SDK for the SportsX trading exchange. It wraps the GraphQL HTTP API and Phoenix WebSocket channels as a set of strongly-typed services you register into the .NET dependency-injection container and resolve anywhere in your app. The primary audience is market makers building low-latency .NET trading bots, but any integrator targeting SportsX from a .NET app can use it.

<Note>
  **Targets `net8.0`.** Published to NuGet as [**STX.Sdk**](https://www.nuget.org/packages/STX.Sdk). MIT-licensed.
</Note>

## What the SDK includes

One `ConfigureSTXServices` call registers every component the SDK provides:

* **HTTP services** for every exchange operation: login, markets, events, orders, trades, settlements, profile, terms-and-conditions, and geolocation.
* **WebSocket channel wrappers** for real-time data: portfolio balance, active orders, active trades, positions, market price ticks, and user info.
* **Automatic session management**: background services keep the JWT refreshed and the geolocation token current so your bot stays connected without manual intervention.

## Quick look

```bash theme={null}
dotnet add package STX.Sdk
```

```csharp theme={null}
// Register all services once in Program.cs
services.ConfigureSTXServices(
    graphQLUri:  "https://in-api-staging.stxapp.io/graphiql",
    channelsUri: "wss://in-api-staging.stxapp.io/socket/websocket?token={0}&vsn=2.0.0");

// Resolve and use anywhere via DI
var markets = await marketService.GetMarketInfosAsync();
```

## Where to go next

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/sdks/csharp/installation">
    NuGet setup, supported runtimes, and package dependencies.
  </Card>

  <Card title="Authentication" icon="key" href="/sdks/csharp/authentication">
    Email/password login, 2FA, token refresh, and background session keep-alive.
  </Card>

  <Card title="Configuration" icon="sliders" href="/sdks/csharp/configuration">
    DI registration, environment endpoints, and logging setup.
  </Card>

  <Card title="Market data" icon="chart-line" href="/sdks/csharp/markets">
    Query markets, events, sports, and competitions.
  </Card>

  <Card title="Trading" icon="arrows-rotate" href="/sdks/csharp/trading">
    Place, batch, and cancel orders; query order and trade history.
  </Card>

  <Card title="WebSockets" icon="bolt-lightning" href="/sdks/csharp/websockets">
    Phoenix channels for real-time orders, trades, balance, and price ticks.
  </Card>

  <Card title="Settlements" icon="circle-check" href="/sdks/csharp/settlements">
    Fetch settlement history and subscribe to live settlement events.
  </Card>

  <Card title="Errors & retries" icon="triangle-exclamation" href="/sdks/csharp/errors-and-retries">
    Typed exceptions, automatic Polly retries, and rate-limit guidance.
  </Card>
</CardGroup>

## Example apps

Two reference apps ship alongside the SDK:

* **`cssdk-console`** — CLI trading bot demonstrating login, market subscriptions, and order placement from a `BackgroundService`.
* **`cssdk-demo`** — ASP.NET web API that exposes the SDK services over HTTP for manual testing.

Both are MIT-licensed and make good starting points for your own project:

```bash theme={null}
git clone https://github.com/betstackai/cssdk-console.git
git clone https://github.com/betstackai/cssdk-demo.git
```
