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.
STX.Sdk throws typed exceptions for every error condition you need to handle in application code. Network blips and transient HTTP failures are retried automatically via Polly before an exception ever reaches your code, so the exceptions you catch represent genuine problems that require action.
Exceptions
AllSTX-prefixed exceptions live in the STX.Sdk.Exceptions namespace.
| Exception | When thrown | Recommended action |
|---|---|---|
STXWrongCredentialsException | Email or password rejected at login | Prompt the user for fresh credentials |
STXTokenExpiredException | JWT expired; refresh token still valid | Call STXTokenService.RefreshTokenAsync |
STXSessionExpiredException | Both JWT and refresh token expired | Call STXLoginService.LoginAsync again |
STXCancelOnDisconnectNotEnabledException | ConfirmOrderAsync(cancelOnDisconnect: true) called before joining STXActiveOrdersChannel | Join the channel first, or set cancelOnDisconnect: false |
STXGeoComplyException | Geo-compliance check failed | User is outside a permitted jurisdiction — surface to your UI |
GraphQLHttpRequestException | Non-200 HTTP response after all retries exhausted | Treat as a service outage; back off and retry later |
Handle authentication failures
Handle session expiry in trading calls
If you are not usingkeepSessionAlive: true, wrap trading calls with a token-refresh retry to handle expiry gracefully:
Automatic transient retries
Every GraphQL mutation runs throughSTXGraphQLBaseService.SendMutationWithRetry, which uses Polly with the following default policy:
- Retry triggers:
HttpRequestException,TaskCanceledException(timeout), and 5xx responses. - Attempts: 3 retries after the initial failure (4 total).
- Backoff: exponential — 200 ms, 400 ms, 800 ms.
GraphQLHttpRequestException surfaces. Treat it as a service outage — back off and try again after a delay.
Rate limits
The exchange rate-limits by IP and account. Bursty order placement can produce HTTP 429 responses.Debug logging
EnableDebug-level logging to inspect full GraphQL request and response bodies, including operation names, variables, and elapsed time. This is usually enough to determine whether an error is a transient network issue or a schema mismatch:
See also
- Authentication — session management and
keepSessionAlive - Trading —
cancelOnDisconnectandSTXCancelOnDisconnectNotEnabledException - Configuration — logging setup