Describes stx-python 0.10.1, the current release.
Channel
Section titled “Channel”One joined topic.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
reply |
Dict[str, Any] |
|
snapshots |
Dict[str, Any] |
|
watches |
List[str] |
|
join_ref |
Optional[str] |
Methods
Section titled “Methods”leave()
Section titled “leave()”leave() -> NoneLeave the topic. The channel stops receiving and its iterator ends.
next()
Section titled “next()”next(timeout: Optional[float] = None) -> ChannelMessageThe next message on this channel. Raises asyncio.TimeoutError.
| Parameter | Type | Description |
|---|---|---|
timeout |
Optional[float] |
ping()
Section titled “ping()”ping() -> AnyChannel ping. On orders with cancel-on-disconnect armed this
resets the cancel deadline; on account and orders it keeps the
session alive.
push()
Section titled “push()”push(event: str, payload: Any = None, timeout: Optional[float] = None) -> AnySend event on this channel and return the reply’s response.
Raises STXChannelException when the reply status is error.
| Parameter | Type | Description |
|---|---|---|
event |
str |
|
payload |
Any |
|
timeout |
Optional[float] |
request_series()
Section titled “request_series()”request_series(market_ids: Sequence[str], range: str = 'all') -> Anymarket_stats: fetch history at range (day, week,
month, all) without changing the subscription.
| Parameter | Type | Description |
|---|---|---|
market_ids |
Sequence[str] |
|
range |
str |
request_snapshot()
Section titled “request_snapshot()”request_snapshot() -> Anymarket:<id>: ask for the market’s current state again; it
arrives as a push on this channel.
select_filters()
Section titled “select_filters()”select_filters(**filters: Optional[Sequence[str]]) -> Anyticker (sports, competitions) and trades
(market_ids, event_ids): change filters without rejoining.
| Parameter | Type | Description |
|---|---|---|
filters |
Optional[Sequence[str]] |
select_market_ids()
Section titled “select_market_ids()”select_market_ids(market_ids: Optional[Sequence[str]]) -> AnyChange the market_ids filter without rejoining.
On orders, fills, positions, settlements and
account None clears the filter; orderbook and
market_stats require at least one id. Returns the reply, whose
selected_market_ids is what the server applied.
| Parameter | Type | Description |
|---|---|---|
market_ids |
Optional[Sequence[str]] |
select_message_types()
Section titled “select_message_types()”select_message_types(message_types: Optional[Sequence[str]]) -> Anymarkets: receive market_created, market_updated or both.
| Parameter | Type | Description |
|---|---|---|
message_types |
Optional[Sequence[str]] |
select_rule_filters()
Section titled “select_rule_filters()”select_rule_filters(rule_filters: Optional[Sequence[str]]) -> Anymarkets: change the rules filter; None disables it.
| Parameter | Type | Description |
|---|---|---|
rule_filters |
Optional[Sequence[str]] |
wait_snapshot()
Section titled “wait_snapshot()”wait_snapshot(timeout: Optional[float] = 10.0) -> Dict[str, Any]Wait for the state-on-join and return it as {event: payload}.
orders gives {"all_orders": {...}}; account waits for all
four of its snapshots. market_stats and market:<id> return
{"reply": <join reply>}: the series, or the market in full. Channels with no snapshot (settlements,
ticker, trades, orderbook, markets,
market_updates) raise ValueError.
| Parameter | Type | Description |
|---|---|---|
timeout |
Optional[float] |
watch()
Section titled “watch()”watch(market_ids: Sequence[str]) -> Anymarket_updates: start receiving created/updated for
these markets. Re-sent automatically after a reconnect. Returns the
reply, whose subscriptions.watches lists what is watched.
| Parameter | Type | Description |
|---|---|---|
market_ids |
Sequence[str] |
ChannelMessage
Section titled “ChannelMessage”One pushed frame.
payload is the event’s JSON object as documented for the channel,
with money and quantities as strings. channel is the topic without
the user id ("orders" for orders:<user_id>). data is the
payload as a typed model on the combo channels, and None elsewhere.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
topic |
str |
|
event |
str |
|
payload |
Any |
|
ref |
Optional[str] |
|
join_ref |
Optional[str] |
|
data |
Any |
|
channel |
str |
|
is_snapshot |
bool |
True for the state-on-join events (all_orders, balances…). |

