Skip to content

Creating markets and capabilities

Describes stx-python 0.8.0, the current release.

A player stat line market: over/under one player’s stat in one event.

line is a positive number ending in .5, e.g. 18.5. Whole numbers, quarter lines, zero and negatives are rejected with invalid_line.

Attribute Type Description
player_id str
stat str
line Union[float, int, Decimal]
rule str

The outcome for one requested market.

index is its position in the list given to create_markets. status is created or exists (both with market_id), valid (a dry run that would create it) or rejected (with reason: invalid_line, unsupported_stat, unknown_player, unsupported_rule, event_not_open, not_created…).

Attribute Type Description
index int
status str
market_id Optional[str]
reason Optional[str]
ok bool True for created, exists and valid.

GET /api/v1/events/{event_id}/players: rosters and the stats on offer.

teams is empty until the rosters are published, or when the event’s type has no player props.

Attribute Type Description
event_id Optional[str]
teams List[EventTeam]
stats List[EventStat]
players() -> List[EventPlayer]

Every player on every team.

stat_keys() -> List[str]

The stat keys this event accepts, e.g. ["ASSISTS", "GOALS"].

One team’s roster, sorted by player name.

Attribute Type Description
team Optional[str]
players List[EventPlayer]

One player on an event’s roster.

Attribute Type Description
player_id Optional[str]
name Optional[str]
jersey Optional[str]
position Optional[str]

A stat a market on the event can be created on.

Attribute Type Description
stat Optional[str]
name Optional[str]

One market type from market_types(), keyed there by rule.

partner_create says whether create_markets takes it. A creatable type lists the fields an entry takes and, in event_types, the event types it runs on (each with its sport and stats); one an app cannot create lists its event types as plain names.

Attribute Type Description
partner_create Optional[bool]
event_types Any
fields Optional[Dict[str, Any]]

What one exchange offers. Get it from client.capabilities().

features maps each id in stx.FEATURES to a Feature. api_version is the exchange build, oauth_metadata its RFC 8414 document when it publishes one, scopes_supported that document’s scopes and checked_at when it was asked (Unix seconds).

Attribute Type Description
host str
api_version Optional[str]
features Dict[str, Feature]
oauth_metadata Optional[Dict[str, Any]]
scopes_supported List[str]
checked_at float
available(feature: str) -> bool

True only when the exchange showed it has feature.

Parameter Type Description
feature str
require(feature: str) -> None

Raise STXNotAvailableError when feature is known to be absent.

Parameter Type Description
feature str
to_dict() -> Dict[str, Optional[bool]]

{feature: True | False | None}.

One feature: available is True, False, or None when unknown. how says what the exchange answered.

Attribute Type Description
id str
available Optional[bool]
how str