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 integrates with the standard .NET dependency-injection container through a single extension method. One call registers every HTTP service, WebSocket channel, background worker, and storage singleton the SDK provides. You then resolve services by their type anywhere in your app.
Register services
CallConfigureSTXServices during host setup, passing the GraphQL HTTP endpoint and the Phoenix WebSocket endpoint for your target environment:
{0} in channelsUri is a format placeholder. The SDK substitutes the current JWT automatically before opening the socket — you never need to interpolate it yourself.ConfigureSTXServices adds:
- GraphQL HTTP client and all typed services:
STXLoginService,STXMarketService,STXOrderService,STXTradeService,STXSettlementService,STXProfileService, and more. - Phoenix channel wrappers:
STXPortfolioChannel,STXActiveOrdersChannel,STXActiveTradesChannel,STXPositionsChannel,STXMarketChannel, and others. STXUserStorageas a singleton to hold the JWT between calls.- Two hosted background services:
STXSessionBackgroundService(JWT refresh) andSTXGeoLocationBackgroundService(geolocation token). These start automatically underIHost.
Endpoints per environment
| Environment | graphQLUri | channelsUri |
|---|---|---|
| Staging | https://in-api-staging.stxapp.io/graphiql | wss://in-api-staging.stxapp.io/socket/websocket?token={0}&vsn=2.0.0 |
| Production | https://in-api.stxapp.io/graphiql | wss://in-api.stxapp.io/socket/websocket?token={0}&vsn=2.0.0 |
appsettings.json:
appsettings.Production.json, or use environment variables (double-underscore as separator):
Dynamic endpoint resolution
If your endpoints depend on something inside the DI container — a tenant selector, feature flag service, or remote config provider — use the overload that takesFunc<IServiceProvider, string> callbacks:
Resolving services
Services are registered asTransient, so it’s safe to resolve a new instance per operation or inject them into scoped/transient components. Channel classes are registered as Singleton — the active socket and subscribed topics are shared across the app.
Inject them through the constructor as usual:
Logging
The SDK usesMicrosoft.Extensions.Logging. Configure the provider you prefer:
| Level | What gets logged |
|---|---|
Debug | Full GraphQL request and response bodies, including variables |
Information | Connection lifecycle events (connect, disconnect, reconnect) |
Warning | Transient failures before retry |
Error | Fatal errors that surface as exceptions |
Geolocation
ConfigureSTXServices registers STXGeoLocationBackgroundService internally. For server-side trading bots the default behavior is what you want — the geolocation token is fetched lazily and cached in the background. If you embed the SDK in a desktop or mobile client app, integrate with GeoComply’s native SDK per their documentation before calling LoginAsync.