stx-python 0.6.0rc1__py3-none-any.whl
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/__init__.py +61 -0
- stx/_async_client.py +923 -0
- stx/_base.py +64 -0
- stx/_client.py +502 -0
- stx/_config.py +107 -0
- stx/_http.py +131 -0
- stx/_money.py +122 -0
- stx/_operations.py +259 -0
- stx/_paging.py +59 -0
- stx/_results.py +29 -0
- stx/_retry.py +80 -0
- stx/_settings.py +203 -0
- stx/_signing.py +229 -0
- stx/_version.py +12 -0
- stx/_ws.py +1016 -0
- stx/enums.py +13 -0
- stx/exceptions.py +156 -0
- stx/models.py +2034 -0
- stx/py.typed +0 -0
- stx_python-0.6.0rc1.dist-info/METADATA +121 -0
- stx_python-0.6.0rc1.dist-info/RECORD +24 -0
- stx_python-0.6.0rc1.dist-info/WHEEL +5 -0
- stx_python-0.6.0rc1.dist-info/licenses/LICENSE +21 -0
- stx_python-0.6.0rc1.dist-info/top_level.txt +1 -0
stx/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stx-python
|
|
3
|
+
Version: 0.6.0rc1
|
|
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,24 @@
|
|
|
1
|
+
stx/__init__.py,sha256=MAL0HwyAymbYuywOpc5h6xzwWJAqYQTqz6clAYNRqdY,1572
|
|
2
|
+
stx/_async_client.py,sha256=ptM-qY8uofbP_BGfJgHh3oYvxQiGXtApIOUQxR8EZ24,35016
|
|
3
|
+
stx/_base.py,sha256=hVtML3jZVnPLakq9yfgqilwthwoqSyytOy8iMGJ0Uvc,2500
|
|
4
|
+
stx/_client.py,sha256=3xSPt31QgVJwRUEAUOF5x9Y0tNIGUgdomTO6fkABcxE,17990
|
|
5
|
+
stx/_config.py,sha256=FK6psgOM7-fY0zrl3VHFxdpdm1FS6PJ9lVm_zQRQ46E,3801
|
|
6
|
+
stx/_http.py,sha256=zSRbLtobI6v6oR2gzlqXcCDqHV1aa7spfeZQE8LHoiI,4536
|
|
7
|
+
stx/_money.py,sha256=dQYk8cWl7hYje-hhf-3Gtkg6g6piz2HXpuC5IaoG76s,4520
|
|
8
|
+
stx/_operations.py,sha256=8SqtczgIA4iT0FUUoSpOzVd0-QVgPRvtqYgUSoRTw3k,7135
|
|
9
|
+
stx/_paging.py,sha256=f7hkPfwtwdrq_D8kvkEk7RH3O_tuS_CJvM3O4x5WlQ4,1695
|
|
10
|
+
stx/_results.py,sha256=KrQE_jMZFyMNo3CCZ7v_zFOz5t5UPMV8vBi5iibcmKM,813
|
|
11
|
+
stx/_retry.py,sha256=NCOd7mWchlGiDa5YSMJ3VZDX53Mcuh3mOM1a5s64uJ4,2793
|
|
12
|
+
stx/_settings.py,sha256=RgjDSYFBLyV_dEaC1KFEhKAkOyhcv8voUIHZXnb3kzY,7026
|
|
13
|
+
stx/_signing.py,sha256=9q_W9ke-ZPO0zO3PHmtAZFwtkdt5AHgmfcRC_8xxFYw,8368
|
|
14
|
+
stx/_version.py,sha256=ccXu7DcvraXp5p7HfCR-fOyecMRd_e6QevT-JF9PayE,365
|
|
15
|
+
stx/_ws.py,sha256=WCeUkmpXfz6JON-ZOSmaio_gbID2tAAh15iMoOTC9CE,40751
|
|
16
|
+
stx/enums.py,sha256=-Mx-96ZSJRqYPIHm4kBa6kX00o6kMvH2ND9MJEsGq1I,228
|
|
17
|
+
stx/exceptions.py,sha256=UKDurLbZHzl52rxrk_MbpRK4AIyystbcKKqezGrCwtQ,5071
|
|
18
|
+
stx/models.py,sha256=pzMvi_gR0CtVrxBU0jf1wgl5OAjCWV9flYPKH9hvCbM,69455
|
|
19
|
+
stx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
stx_python-0.6.0rc1.dist-info/licenses/LICENSE,sha256=BO8tXq5Nk15qHHQSnCUFtwowziyPRQ7FGmQwGMg4Lmk,1060
|
|
21
|
+
stx_python-0.6.0rc1.dist-info/METADATA,sha256=E4k-xTpBlpHiMN2ofTjc_IRW2MBi_NMhweZf4hMZhxY,5154
|
|
22
|
+
stx_python-0.6.0rc1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
23
|
+
stx_python-0.6.0rc1.dist-info/top_level.txt,sha256=AAtWAp9b91wbzJ9LNEybit6Wu3j634-xaYGeE5C18Ow,4
|
|
24
|
+
stx_python-0.6.0rc1.dist-info/RECORD,,
|
|
@@ -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 @@
|
|
|
1
|
+
stx
|