Skip to main content
The market data services give you access to the full SportsX market and event catalog. STXMarketService handles everything market-related — from paginated listings to lightweight ID-based lookups — while STXEventService lets you fetch events together with their nested markets in a single call. Both services are registered as transient, so you can resolve them anywhere you inject dependencies. For task-oriented examples, see the Markets guide.

GetMarketInfosAsync

Returns a paginated list of full STXMarketInfo objects. Use STXMarketInfosFilter to narrow results by status, sport, competition, or event. Return type: Task<STXMarketInfosResponse<STXMarketInfo>>

Parameters

NameTypeRequiredDescription
filterSTXMarketInfosFilterNoFilter and pagination options. Omit to retrieve the default page of all markets.

Example

var filter = new STXMarketInfosFilter
{
    Sport = "basketball",
    Status = STXMarketInfosStatus.OPEN,
    Limit = 20,
    Offset = 0
};

STXMarketInfosResponse<STXMarketInfo> response =
    await _marketService.GetMarketInfosAsync(filter);

foreach (var market in response.MarketInfos)
{
    Console.WriteLine($"{market.MarketId}: {market.Title}");
}

GetMarketInfosWithCountAsync

Identical to GetMarketInfosAsync but the response includes a TotalCount field, which is useful when you need to render pagination controls. Return type: Task<STXMarketInfosWithCountResponse<STXMarketInfo>>

Parameters

NameTypeRequiredDescription
filterSTXMarketInfosFilterNoFilter and pagination options.

Example

var filter = new STXMarketInfosFilter { Limit = 10, Offset = 0 };

STXMarketInfosWithCountResponse<STXMarketInfo> response =
    await _marketService.GetMarketInfosWithCountAsync(filter);

Console.WriteLine($"Showing {response.MarketInfos.Count} of {response.TotalCount} markets");

GetMarketInfosAsync (generic)

A generic overload that lets you project the response into your own model type T. Use this when you only need a subset of market fields and want to avoid deserializing the full STXMarketInfo. Return type: Task<STXMarketInfosResponse<T>>

Parameters

NameTypeRequiredDescription
filterSTXMarketInfosFilterNoFilter and pagination options.

Example

// Only deserialize the fields your model defines
public record SlimMarket(string MarketId, string Title, string Status);

var response = await _marketService.GetMarketInfosAsync<SlimMarket>(filter);

GetMarketInfosWithCountAsync (generic)

Generic overload of GetMarketInfosWithCountAsync. Returns total count alongside your projected model. Return type: Task<STXMarketInfosWithCountResponse<T>>

Parameters

NameTypeRequiredDescription
filterSTXMarketInfosFilterNoFilter and pagination options.

GetShortMarketInfosAsync

Fetches lightweight market data — only ID, status, and title — for a specific list of market IDs. Use this when you already know the IDs you want and don’t need the full market payload. Return type: Task<STXMarketInfosResponse<STXShortMarketInfo>>

Parameters

NameTypeRequiredDescription
marketIdsIEnumerable<string>YesOne or more market IDs to look up.

Example

var ids = new[] { "market-abc123", "market-def456" };

STXMarketInfosResponse<STXShortMarketInfo> response =
    await _marketService.GetShortMarketInfosAsync(ids);

GetShortMarketInfosWithLimitAsync

Same as GetShortMarketInfosAsync but enforces a server-side result limit, guarding against oversized ID lists. Return type: Task<STXMarketInfosResponse<STXShortMarketInfo>>

Parameters

NameTypeRequiredDescription
marketIdsIEnumerable<string>YesMarket IDs to look up. The server caps the result set.

GetShortMarketInfosWithCountAsync

Returns short market info plus a TotalCount for the supplied ID list. Return type: Task<STXMarketInfosWithCountResponse<STXShortMarketInfo>>

Parameters

NameTypeRequiredDescription
marketIdsIEnumerable<string>YesMarket IDs to look up.

GetShortMarketInfosWithCountWithLimitAsync

Combines the server-side limit of GetShortMarketInfosWithLimitAsync with the count field of GetShortMarketInfosWithCountAsync. Return type: Task<STXMarketInfosWithCountResponse<STXShortMarketInfo>>

Parameters

NameTypeRequiredDescription
marketIdsIEnumerable<string>YesMarket IDs to look up.

GetSportAndCompetitionsAsync

Returns the complete sports and competitions catalog. Use this to populate sport/competition pickers or to discover valid filter values for STXMarketInfosFilter. Return type: Task<List<STXSportAndCompetitions>>

Parameters

This method takes no parameters.

Example

List<STXSportAndCompetitions> catalog =
    await _marketService.GetSportAndCompetitionsAsync();

foreach (var sport in catalog)
{
    Console.WriteLine($"{sport.Sport}: {string.Join(", ", sport.Competitions)}");
}

GetEventInfosAsync

Returns a list of events, each containing the nested STXMarketInfo objects that belong to it. Use STXEventInfosFilter to scope by sport, competition, status, or date window. Return type: Task<STXEventInfosResponse>

Parameters

NameTypeRequiredDescription
filterSTXEventInfosFilterNoFilter options. Omit to retrieve the default page of upcoming events.

Example

var filter = new STXEventInfosFilter
{
    Sport = "basketball",
    EventStatusFilter = new[] { STXEventStatus.UPCOMING, STXEventStatus.LIVE },
    EventStartFrom = DateTime.UtcNow,
    EventStartTo = DateTime.UtcNow.AddDays(7),
    Limit = 50
};

STXEventInfosResponse response =
    await _eventService.GetEventInfosAsync(filter);

foreach (STXEventInfo evt in response.EventInfos)
{
    Console.WriteLine($"{evt.Title}{evt.MarketInfos.Count} markets");
}

Filter and model reference

STXMarketInfosFilter

Use this class to control which markets are returned and how results are paginated.
public class STXMarketInfosFilter
{
    public STXMarketInfosStatus? Status { get; set; }   // OPEN, CLOSED, SETTLED, …
    public STXMarketInfosTrading? Trading { get; set; } // TRUE, FALSE, ALL
    public string Sport { get; set; }
    public string Competition { get; set; }
    public string EventId { get; set; }
    public int? Limit { get; set; }
    public int? Offset { get; set; }
}
Enum values for Status and Trading are defined in STX.Sdk.Enums. See the GitHub source for the complete list.

STXMarketInfo — key fields

FieldDescription
MarketIdUnique market identifier
EventIdID of the parent event
Statusopen, closed, settled, or similar
Sport, Competition, TitleHuman-readable descriptors
RulesMarket type — PLAYER_STAT_LINE, SPREAD, OVER_UNDER, and others
SpecifierLine value, e.g. 7.5 or "Player Name|id|STAT|value"
MaxPriceSettlement maximum in cents
ParticipantsTeams or players involved in the market

STXEventInfosFilter

public class STXEventInfosFilter
{
    public string Sport { get; set; }
    public string Competition { get; set; }
    public STXEventStatus[] EventStatusFilter { get; set; }
    public DateTime? EventStartFrom { get; set; }
    public DateTime? EventStartTo { get; set; }
    public int? Limit { get; set; }
}

STXEventInfo

public class STXEventInfo
{
    public string EventId { get; set; }
    public string Title { get; set; }
    public string Sport { get; set; }
    public string Competition { get; set; }
    public STXEventStatus Status { get; set; }
    public DateTime EventStart { get; set; }
    public List<STXMarketInfo> MarketInfos { get; set; }
}