stx-python 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stx_python-0.6.0/CHANGELOG.md +26 -0
- stx_python-0.6.0/LICENSE +21 -0
- stx_python-0.6.0/PKG-INFO +121 -0
- stx_python-0.6.0/README.md +82 -0
- stx_python-0.6.0/pyproject.toml +116 -0
- stx_python-0.6.0/setup.cfg +4 -0
- stx_python-0.6.0/stx/__init__.py +61 -0
- stx_python-0.6.0/stx/_async_client.py +923 -0
- stx_python-0.6.0/stx/_base.py +64 -0
- stx_python-0.6.0/stx/_client.py +502 -0
- stx_python-0.6.0/stx/_config.py +107 -0
- stx_python-0.6.0/stx/_http.py +131 -0
- stx_python-0.6.0/stx/_money.py +122 -0
- stx_python-0.6.0/stx/_operations.py +259 -0
- stx_python-0.6.0/stx/_paging.py +59 -0
- stx_python-0.6.0/stx/_results.py +29 -0
- stx_python-0.6.0/stx/_retry.py +80 -0
- stx_python-0.6.0/stx/_settings.py +203 -0
- stx_python-0.6.0/stx/_signing.py +229 -0
- stx_python-0.6.0/stx/_version.py +12 -0
- stx_python-0.6.0/stx/_ws.py +1016 -0
- stx_python-0.6.0/stx/enums.py +13 -0
- stx_python-0.6.0/stx/exceptions.py +156 -0
- stx_python-0.6.0/stx/models.py +2034 -0
- stx_python-0.6.0/stx/py.typed +0 -0
- stx_python-0.6.0/stx_python.egg-info/PKG-INFO +121 -0
- stx_python-0.6.0/stx_python.egg-info/SOURCES.txt +30 -0
- stx_python-0.6.0/stx_python.egg-info/dependency_links.txt +1 -0
- stx_python-0.6.0/stx_python.egg-info/requires.txt +16 -0
- stx_python-0.6.0/stx_python.egg-info/scm_file_list.json +27 -0
- stx_python-0.6.0/stx_python.egg-info/scm_version.json +8 -0
- stx_python-0.6.0/stx_python.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.6.0 (2026-10-02)
|
|
4
|
+
|
|
5
|
+
First release on PyPI. Install it with `pip install stx-python`; while 0.6.0 is a release candidate, use `pip install --pre stx-python`.
|
|
6
|
+
|
|
7
|
+
- `STX` and `AsyncSTX`: a blocking client and an asyncio client for the STX API, with a method for every route (markets, events, orders, fills, positions, balance, per-market account stats and portfolio history). `STX` works inside a program or notebook that already runs an event loop.
|
|
8
|
+
- API-key authentication: every request and the WebSocket handshake are signed with your API key (Ed25519). There is no login call and no session to refresh. Keys come from arguments, `STX_*` environment variables or a profile in `~/.stx/credentials`, and `signer=` accepts a callable for keys held in an HSM or KMS.
|
|
9
|
+
- Built-in environments: select an exchange by name with `region` and `env` (`region="us", env="demo"`; `region="ontario", env="production"`), or point at any host with `host=`.
|
|
10
|
+
- `STXWebSocket`: the documented WebSocket channels on one signed connection: `orderbook`, `ticker`, `trades`, `markets`, `market_stats`, `market_updates`, and your own `orders`, `fills`, `positions`, `settlements`, `balances`, `account` and `user_info`. It handles heartbeats, snapshots, filters, cancel-on-disconnect pings and automatic reconnect with rejoin, and calls `on_reconnect` so you can refresh state.
|
|
11
|
+
- Pagination: list methods return a `Page` with a `cursor`, and each has an `iter_*` twin that walks every page for you.
|
|
12
|
+
- Typed responses: every response is a pydantic model. Money and quantities are strings exactly as the API sends them, never floats.
|
|
13
|
+
- Typed errors (`STXException` and one subclass per failure) and a configurable retry policy. An order is never sent twice after an uncertain failure.
|
|
14
|
+
- Python 3.9 to 3.13. MIT license.
|
|
15
|
+
|
|
16
|
+
### Changes from the 0.5 alphas
|
|
17
|
+
|
|
18
|
+
The 0.5 alphas were published to TestPyPI only and used a different API. Code written against them needs to be updated:
|
|
19
|
+
|
|
20
|
+
- Sign in with an API key instead of an email and password. `login()`, two-factor authentication, token refresh, registration and payments are gone.
|
|
21
|
+
- Methods take plain keyword arguments and return typed models, in place of `params={"input": ...}` and `Selection`/`PRESETS`.
|
|
22
|
+
- `STXWebSocket` joins the documented channels by name, built from your client with `client.websocket()`.
|
|
23
|
+
- Exceptions are named after the failure (`STXAuthenticationException`, `STXRejectedException`, `STXRateLimitException` and so on).
|
|
24
|
+
- `env` accepts `"demo"` and `"production"`. Other deployments are reached with `host=`.
|
|
25
|
+
|
|
26
|
+
Guides and the API reference: https://docs.stxapp.io/sdks/python/
|
stx_python-0.6.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 STX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stx-python
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Official Python SDK for the STX exchange
|
|
5
|
+
Author-email: STX <support@stxapp.io>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://docs.stxapp.io/sdks/python/
|
|
8
|
+
Project-URL: Documentation, https://docs.stxapp.io/sdks/python/
|
|
9
|
+
Project-URL: Changelog, https://docs.stxapp.io/changelog/
|
|
10
|
+
Project-URL: Support, https://docs.stxapp.io/support/
|
|
11
|
+
Keywords: stx,exchange,trading,prediction-market,sdk
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: httpx<1,>=0.25
|
|
26
|
+
Requires-Dist: websockets>=12.0
|
|
27
|
+
Requires-Dist: pydantic<3,>=2.0
|
|
28
|
+
Requires-Dist: cryptography>=41.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff==0.16.9; extra == "dev"
|
|
34
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pre-commit>=3.5; extra == "dev"
|
|
37
|
+
Requires-Dist: griffe==2.3.0; python_version >= "3.10" and extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# stx-python
|
|
41
|
+
|
|
42
|
+
The official Python SDK for the [STX](https://stxapp.io) exchange.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install stx-python
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Python 3.9 or newer.
|
|
49
|
+
|
|
50
|
+
## Quickstart
|
|
51
|
+
|
|
52
|
+
You need an API key for the STX exchange you are building against. [Environments](https://docs.stxapp.io/environments/) lists the exchanges and where to get a key, and [Authentication](https://docs.stxapp.io/sdks/python/authentication/) shows how to give it to the SDK.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from stx import STX
|
|
56
|
+
|
|
57
|
+
# Reads your API key and exchange from STX_* environment variables or ~/.stx/credentials.
|
|
58
|
+
with STX() as client:
|
|
59
|
+
# status "open": markets that have opened for trading (not scheduled, closed or settled).
|
|
60
|
+
# trading=True: only markets accepting orders right now (an open market can be paused).
|
|
61
|
+
# limit: markets per page. Looping over page gives this page; client.iter_markets() walks every page.
|
|
62
|
+
page = client.markets(status="open", trading=True, limit=5)
|
|
63
|
+
|
|
64
|
+
for market in page:
|
|
65
|
+
# bids are what buyers will pay, offers what sellers will accept, best price first.
|
|
66
|
+
# Prices are dollars per contract, as strings; a winning contract pays market.max_price.
|
|
67
|
+
bid = market.bids[0].price if market.bids else "-" # "-" when nobody is bidding
|
|
68
|
+
offer = market.offers[0].price if market.offers else "-"
|
|
69
|
+
print(f"{market.event_title}: {market.title} bid {bid} offer {offer}")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Sample output:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
New York Yankees at San Diego Padres: Padres First Run bid - offer -
|
|
76
|
+
New York Yankees at San Diego Padres: Yankees First Run bid 0.4200 offer -
|
|
77
|
+
Norfolk State Spartans at Old Dominion Monarchs: Old Dominion Score Last bid - offer -
|
|
78
|
+
Norfolk State Spartans at Old Dominion Monarchs: Norfolk St Score Last bid - offer -
|
|
79
|
+
Tampa Bay Rays at Philadelphia Phillies: MLB TB @ PHI bid - offer -
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
A bid of `0.4200` on a market whose winning contract pays `1.0000` means a buyer will pay 42 cents for a contract that pays $1 if the Yankees score first.
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>One market from the response (selected fields)</summary>
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"market_id": "ddb216af-e752-422c-8688-52f95630b219",
|
|
90
|
+
"symbol": "STXMLB-26SEP042140NYYSD-ESLAWAYFIRSTRUNNA",
|
|
91
|
+
"event_title": "New York Yankees at San Diego Padres",
|
|
92
|
+
"title": "Yankees First Run",
|
|
93
|
+
"question": "Will New York Yankees score the first run of the game?",
|
|
94
|
+
"status": "open",
|
|
95
|
+
"trading": true,
|
|
96
|
+
"event_start": "2026-09-05T01:40:00.000000Z",
|
|
97
|
+
"max_price": "1.0000",
|
|
98
|
+
"last_traded_price": null,
|
|
99
|
+
"bids": [
|
|
100
|
+
{ "price": "0.4200", "quantity": "5.00" },
|
|
101
|
+
{ "price": "0.2400", "quantity": "4.00" },
|
|
102
|
+
{ "price": "0.2300", "quantity": "2.00" }
|
|
103
|
+
],
|
|
104
|
+
"offers": []
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Every market is a `stx.models.Market`; `market.model_dump()` gives you the dict. Every field is described in the [API reference](https://docs.stxapp.io/api/rest/).
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
For asyncio, `AsyncSTX` has the same methods to `await`, and `client.websocket()` streams the order book, trades and your own orders, fills and balance.
|
|
113
|
+
|
|
114
|
+
## Documentation
|
|
115
|
+
|
|
116
|
+
- [Python SDK guide](https://docs.stxapp.io/sdks/python/)
|
|
117
|
+
- [API reference](https://docs.stxapp.io/api/rest/)
|
|
118
|
+
- [Release notes](https://docs.stxapp.io/changelog/)
|
|
119
|
+
- [Support](https://docs.stxapp.io/support/)
|
|
120
|
+
|
|
121
|
+
MIT license. Use of the STX API and exchange is subject to the STX terms of use and privacy policy: United States ([terms of use](https://config.stxapp.io/us/terms_of_use.pdf), [privacy policy](https://config.stxapp.io/us/privacy_policy.pdf)), Ontario ([terms of use](https://config.stxapp.ca/on/terms-of-use.pdf), [privacy policy](https://config.stxapp.ca/on/privacy-policy.pdf)).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# stx-python
|
|
2
|
+
|
|
3
|
+
The official Python SDK for the [STX](https://stxapp.io) exchange.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install stx-python
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Python 3.9 or newer.
|
|
10
|
+
|
|
11
|
+
## Quickstart
|
|
12
|
+
|
|
13
|
+
You need an API key for the STX exchange you are building against. [Environments](https://docs.stxapp.io/environments/) lists the exchanges and where to get a key, and [Authentication](https://docs.stxapp.io/sdks/python/authentication/) shows how to give it to the SDK.
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from stx import STX
|
|
17
|
+
|
|
18
|
+
# Reads your API key and exchange from STX_* environment variables or ~/.stx/credentials.
|
|
19
|
+
with STX() as client:
|
|
20
|
+
# status "open": markets that have opened for trading (not scheduled, closed or settled).
|
|
21
|
+
# trading=True: only markets accepting orders right now (an open market can be paused).
|
|
22
|
+
# limit: markets per page. Looping over page gives this page; client.iter_markets() walks every page.
|
|
23
|
+
page = client.markets(status="open", trading=True, limit=5)
|
|
24
|
+
|
|
25
|
+
for market in page:
|
|
26
|
+
# bids are what buyers will pay, offers what sellers will accept, best price first.
|
|
27
|
+
# Prices are dollars per contract, as strings; a winning contract pays market.max_price.
|
|
28
|
+
bid = market.bids[0].price if market.bids else "-" # "-" when nobody is bidding
|
|
29
|
+
offer = market.offers[0].price if market.offers else "-"
|
|
30
|
+
print(f"{market.event_title}: {market.title} bid {bid} offer {offer}")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Sample output:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
New York Yankees at San Diego Padres: Padres First Run bid - offer -
|
|
37
|
+
New York Yankees at San Diego Padres: Yankees First Run bid 0.4200 offer -
|
|
38
|
+
Norfolk State Spartans at Old Dominion Monarchs: Old Dominion Score Last bid - offer -
|
|
39
|
+
Norfolk State Spartans at Old Dominion Monarchs: Norfolk St Score Last bid - offer -
|
|
40
|
+
Tampa Bay Rays at Philadelphia Phillies: MLB TB @ PHI bid - offer -
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A bid of `0.4200` on a market whose winning contract pays `1.0000` means a buyer will pay 42 cents for a contract that pays $1 if the Yankees score first.
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary>One market from the response (selected fields)</summary>
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"market_id": "ddb216af-e752-422c-8688-52f95630b219",
|
|
51
|
+
"symbol": "STXMLB-26SEP042140NYYSD-ESLAWAYFIRSTRUNNA",
|
|
52
|
+
"event_title": "New York Yankees at San Diego Padres",
|
|
53
|
+
"title": "Yankees First Run",
|
|
54
|
+
"question": "Will New York Yankees score the first run of the game?",
|
|
55
|
+
"status": "open",
|
|
56
|
+
"trading": true,
|
|
57
|
+
"event_start": "2026-09-05T01:40:00.000000Z",
|
|
58
|
+
"max_price": "1.0000",
|
|
59
|
+
"last_traded_price": null,
|
|
60
|
+
"bids": [
|
|
61
|
+
{ "price": "0.4200", "quantity": "5.00" },
|
|
62
|
+
{ "price": "0.2400", "quantity": "4.00" },
|
|
63
|
+
{ "price": "0.2300", "quantity": "2.00" }
|
|
64
|
+
],
|
|
65
|
+
"offers": []
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Every market is a `stx.models.Market`; `market.model_dump()` gives you the dict. Every field is described in the [API reference](https://docs.stxapp.io/api/rest/).
|
|
70
|
+
|
|
71
|
+
</details>
|
|
72
|
+
|
|
73
|
+
For asyncio, `AsyncSTX` has the same methods to `await`, and `client.websocket()` streams the order book, trades and your own orders, fills and balance.
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
- [Python SDK guide](https://docs.stxapp.io/sdks/python/)
|
|
78
|
+
- [API reference](https://docs.stxapp.io/api/rest/)
|
|
79
|
+
- [Release notes](https://docs.stxapp.io/changelog/)
|
|
80
|
+
- [Support](https://docs.stxapp.io/support/)
|
|
81
|
+
|
|
82
|
+
MIT license. Use of the STX API and exchange is subject to the STX terms of use and privacy policy: United States ([terms of use](https://config.stxapp.io/us/terms_of_use.pdf), [privacy policy](https://config.stxapp.io/us/privacy_policy.pdf)), Ontario ([terms of use](https://config.stxapp.ca/on/terms-of-use.pdf), [privacy policy](https://config.stxapp.ca/on/privacy-policy.pdf)).
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# setuptools-scm derives the package version from git tags at build
|
|
3
|
+
# time, so we don't have to keep a static `version = "..."` here in
|
|
4
|
+
# sync with the tag we're about to push. One commit can carry multiple
|
|
5
|
+
# tags (`v0.5.0a1`, `v0.5.0rc1`, `v0.5.0`): same source, different
|
|
6
|
+
# wheel labels, without bump commits between each.
|
|
7
|
+
# setuptools>=77 is the first release that understands the SPDX
|
|
8
|
+
# `license = "MIT"` string form (PEP 639) used below.
|
|
9
|
+
requires = ["setuptools>=77.0", "setuptools-scm>=8"]
|
|
10
|
+
build-backend = "setuptools.build_meta"
|
|
11
|
+
|
|
12
|
+
[project]
|
|
13
|
+
name = "stx-python"
|
|
14
|
+
# `version` is dynamic: read from git via setuptools-scm. See
|
|
15
|
+
# [tool.setuptools_scm] below.
|
|
16
|
+
dynamic = ["version"]
|
|
17
|
+
description = "Official Python SDK for the STX exchange"
|
|
18
|
+
authors = [{ name = "STX", email = "support@stxapp.io" }]
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
license = "MIT"
|
|
21
|
+
license-files = ["LICENSE"]
|
|
22
|
+
requires-python = ">=3.9"
|
|
23
|
+
keywords = ["stx", "exchange", "trading", "prediction-market", "sdk"]
|
|
24
|
+
dependencies = [
|
|
25
|
+
# REST transport for AsyncSTX and the STX sync wrapper.
|
|
26
|
+
"httpx>=0.25,<1",
|
|
27
|
+
# Phoenix channels (STXWebSocket).
|
|
28
|
+
"websockets>=12.0",
|
|
29
|
+
# Response models (stx.models).
|
|
30
|
+
"pydantic>=2.0,<3",
|
|
31
|
+
# Ed25519 request signing.
|
|
32
|
+
"cryptography>=41.0",
|
|
33
|
+
]
|
|
34
|
+
classifiers = [
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3.9",
|
|
37
|
+
"Programming Language :: Python :: 3.10",
|
|
38
|
+
"Programming Language :: Python :: 3.11",
|
|
39
|
+
"Programming Language :: Python :: 3.12",
|
|
40
|
+
"Programming Language :: Python :: 3.13",
|
|
41
|
+
"Operating System :: OS Independent",
|
|
42
|
+
"Intended Audience :: Developers",
|
|
43
|
+
"Topic :: Office/Business :: Financial",
|
|
44
|
+
"Typing :: Typed",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://docs.stxapp.io/sdks/python/"
|
|
49
|
+
Documentation = "https://docs.stxapp.io/sdks/python/"
|
|
50
|
+
Changelog = "https://docs.stxapp.io/changelog/"
|
|
51
|
+
Support = "https://docs.stxapp.io/support/"
|
|
52
|
+
|
|
53
|
+
[project.optional-dependencies]
|
|
54
|
+
dev = [
|
|
55
|
+
"pytest>=7",
|
|
56
|
+
"pytest-asyncio>=0.23",
|
|
57
|
+
"python-dotenv>=1.0",
|
|
58
|
+
"ruff==0.16.9",
|
|
59
|
+
"build>=1.0",
|
|
60
|
+
"twine>=5.0",
|
|
61
|
+
"pre-commit>=3.5",
|
|
62
|
+
# tools/gen_reference.py (the API reference pages); pinned for stable output.
|
|
63
|
+
"griffe==2.3.0; python_version >= '3.10'",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.packages.find]
|
|
67
|
+
where = ["."]
|
|
68
|
+
include = ["stx*"]
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.package-data]
|
|
71
|
+
stx = ["py.typed"]
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
python_files = ["test_*.py"]
|
|
75
|
+
testpaths = ["tests"]
|
|
76
|
+
asyncio_mode = "auto"
|
|
77
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
78
|
+
markers = [
|
|
79
|
+
"live: talks to a real STX exchange (tests/e2e)",
|
|
80
|
+
"prod_readonly: GET-only checks against production (tests/prod)",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
[tool.ruff]
|
|
84
|
+
line-length = 100
|
|
85
|
+
target-version = "py39"
|
|
86
|
+
extend-exclude = ["venv", "dist", "build"]
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = ["E", "F", "W", "I", "B", "UP", "RUF"]
|
|
90
|
+
ignore = [
|
|
91
|
+
"E501", # long lines are left to the formatter
|
|
92
|
+
"UP006", # typing.List etc. stay readable on 3.9
|
|
93
|
+
"UP007", # Optional[...] instead of X | None, for 3.9
|
|
94
|
+
"UP035",
|
|
95
|
+
"UP045",
|
|
96
|
+
"RUF012",
|
|
97
|
+
"RUF022",
|
|
98
|
+
"B008",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
[tool.ruff.lint.per-file-ignores]
|
|
102
|
+
"stx/models.py" = ["RUF001", "RUF002", "RUF003"]
|
|
103
|
+
|
|
104
|
+
[tool.ruff.format]
|
|
105
|
+
exclude = ["stx/models.py", "stx/_operations.py"]
|
|
106
|
+
|
|
107
|
+
[tool.setuptools_scm]
|
|
108
|
+
# When the working tree has a tag at HEAD, that tag is the version.
|
|
109
|
+
# `tag_regex` strips the leading `v` so `v0.5.0a1` becomes `0.5.0a1`
|
|
110
|
+
# in the wheel filename + metadata.
|
|
111
|
+
tag_regex = "^v(?P<version>\\d.*)$"
|
|
112
|
+
# Source-only checkouts without git context (rare; usually only matters
|
|
113
|
+
# if someone downloads a tarball minus .git) get a clearly fake version
|
|
114
|
+
# instead of crashing the build. Real wheels published from CI always
|
|
115
|
+
# build from a tagged commit, so users never see this.
|
|
116
|
+
fallback_version = "0.0.0+nogit"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""The official Python SDK for the STX exchange.
|
|
2
|
+
|
|
3
|
+
``AsyncSTX`` and ``STX`` (blocking) make requests; ``STXWebSocket``
|
|
4
|
+
streams the documented channels. Money and quantities are strings exactly
|
|
5
|
+
as the API sends them.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from stx import models
|
|
9
|
+
from stx._async_client import AsyncSTX
|
|
10
|
+
from stx._client import STX
|
|
11
|
+
from stx._paging import Page
|
|
12
|
+
from stx._results import BatchOrderResult
|
|
13
|
+
from stx._retry import NO_RETRY, RetryPolicy
|
|
14
|
+
from stx._signing import ApiKeyCredentials
|
|
15
|
+
from stx._version import __version__
|
|
16
|
+
from stx._ws import Channel, ChannelMessage, ReconnectPolicy, STXWebSocket
|
|
17
|
+
from stx.enums import Environment, Region
|
|
18
|
+
from stx.exceptions import (
|
|
19
|
+
STXAPIException,
|
|
20
|
+
STXAuthenticationException,
|
|
21
|
+
STXChannelException,
|
|
22
|
+
STXConfigException,
|
|
23
|
+
STXException,
|
|
24
|
+
STXForbiddenException,
|
|
25
|
+
STXNotFoundException,
|
|
26
|
+
STXRateLimitException,
|
|
27
|
+
STXRejectedException,
|
|
28
|
+
STXServerException,
|
|
29
|
+
STXTransportException,
|
|
30
|
+
STXValidationException,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"STX",
|
|
35
|
+
"AsyncSTX",
|
|
36
|
+
"STXWebSocket",
|
|
37
|
+
"Channel",
|
|
38
|
+
"ChannelMessage",
|
|
39
|
+
"ReconnectPolicy",
|
|
40
|
+
"ApiKeyCredentials",
|
|
41
|
+
"Page",
|
|
42
|
+
"BatchOrderResult",
|
|
43
|
+
"RetryPolicy",
|
|
44
|
+
"NO_RETRY",
|
|
45
|
+
"models",
|
|
46
|
+
"Region",
|
|
47
|
+
"Environment",
|
|
48
|
+
"STXException",
|
|
49
|
+
"STXConfigException",
|
|
50
|
+
"STXAPIException",
|
|
51
|
+
"STXValidationException",
|
|
52
|
+
"STXAuthenticationException",
|
|
53
|
+
"STXForbiddenException",
|
|
54
|
+
"STXNotFoundException",
|
|
55
|
+
"STXRejectedException",
|
|
56
|
+
"STXRateLimitException",
|
|
57
|
+
"STXServerException",
|
|
58
|
+
"STXTransportException",
|
|
59
|
+
"STXChannelException",
|
|
60
|
+
"__version__",
|
|
61
|
+
]
|