Creating markets and capabilities
Describes stx-python 0.8.0, the current release.
PlayerStatLine
Section titled “PlayerStatLine”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.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
player_id |
str |
|
stat |
str |
|
line |
Union[float, int, Decimal] |
|
rule |
str |
CreateMarketResult
Section titled “CreateMarketResult”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…).
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
index |
int |
|
status |
str |
|
market_id |
Optional[str] |
|
reason |
Optional[str] |
|
ok |
bool |
True for created, exists and valid. |
EventPlayers
Section titled “EventPlayers”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.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
event_id |
Optional[str] |
|
teams |
List[EventTeam] |
|
stats |
List[EventStat] |
Methods
Section titled “Methods”players()
Section titled “players()”players() -> List[EventPlayer]Every player on every team.
stat_keys()
Section titled “stat_keys()”stat_keys() -> List[str]The stat keys this event accepts, e.g. ["ASSISTS", "GOALS"].
EventTeam
Section titled “EventTeam”One team’s roster, sorted by player name.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
team |
Optional[str] |
|
players |
List[EventPlayer] |
EventPlayer
Section titled “EventPlayer”One player on an event’s roster.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
player_id |
Optional[str] |
|
name |
Optional[str] |
|
jersey |
Optional[str] |
|
position |
Optional[str] |
EventStat
Section titled “EventStat”A stat a market on the event can be created on.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
stat |
Optional[str] |
|
name |
Optional[str] |
MarketType
Section titled “MarketType”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.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
partner_create |
Optional[bool] |
|
event_types |
Any |
|
fields |
Optional[Dict[str, Any]] |
Capabilities
Section titled “Capabilities”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).
Attributes
Section titled “Attributes”| 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 |
Methods
Section titled “Methods”available()
Section titled “available()”available(feature: str) -> boolTrue only when the exchange showed it has feature.
| Parameter | Type | Description |
|---|---|---|
feature |
str |
require()
Section titled “require()”require(feature: str) -> NoneRaise STXNotAvailableError when feature is known to be absent.
| Parameter | Type | Description |
|---|---|---|
feature |
str |
to_dict()
Section titled “to_dict()”to_dict() -> Dict[str, Optional[bool]]{feature: True | False | None}.
Feature
Section titled “Feature”One feature: available is True, False, or None when unknown.
how says what the exchange answered.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
id |
str |
|
available |
Optional[bool] |
|
how |
str |

