redblack-python-sdk 0.1.0__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.
- redblack/__init__.py +105 -0
- redblack/_generated/__init__.py +39 -0
- redblack/_generated/contract.py +212 -0
- redblack/_generated/operation_specs.py +5115 -0
- redblack/_version.py +4 -0
- redblack/auth.py +352 -0
- redblack/client.py +512 -0
- redblack/config.py +576 -0
- redblack/downloads.py +410 -0
- redblack/errors.py +483 -0
- redblack/models/__init__.py +105 -0
- redblack/models/base.py +150 -0
- redblack/models/generated.py +11736 -0
- redblack/odata.py +75 -0
- redblack/pagination.py +184 -0
- redblack/polling.py +163 -0
- redblack/py.typed +1 -0
- redblack/raw.py +102 -0
- redblack/resources/__init__.py +65 -0
- redblack/resources/_base.py +212 -0
- redblack/resources/_collections.py +80 -0
- redblack/resources/_exports.py +215 -0
- redblack/resources/accounts.py +132 -0
- redblack/resources/cash_actions.py +260 -0
- redblack/resources/equivalents.py +144 -0
- redblack/resources/households.py +138 -0
- redblack/resources/orders.py +118 -0
- redblack/resources/restrictions.py +146 -0
- redblack/resources/review_sets.py +889 -0
- redblack/resources/securities.py +175 -0
- redblack/resources/tasks.py +291 -0
- redblack/resources/users.py +88 -0
- redblack/response.py +118 -0
- redblack/transport.py +606 -0
- redblack_python_sdk-0.1.0.dist-info/METADATA +151 -0
- redblack_python_sdk-0.1.0.dist-info/RECORD +38 -0
- redblack_python_sdk-0.1.0.dist-info/WHEEL +5 -0
- redblack_python_sdk-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: redblack-python-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed Python SDK for the RedBlack trading and portfolio rebalancing API
|
|
5
|
+
Classifier: Development Status :: 3 - Alpha
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: httpx<1,>=0.27
|
|
16
|
+
Requires-Dist: pydantic<3,>=2.6
|
|
17
|
+
Requires-Dist: python-dotenv<2,>=1.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
20
|
+
Requires-Dist: PyYAML<7,>=6; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
23
|
+
Requires-Dist: pyright>=1.1; extra == "dev"
|
|
24
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
25
|
+
|
|
26
|
+
# RedBlack Python SDK
|
|
27
|
+
|
|
28
|
+
Typed Python client for the RedBlack trading, portfolio-rebalancing, and
|
|
29
|
+
order-management API.
|
|
30
|
+
|
|
31
|
+
> **Alpha:** the SDK is implemented from the offline RedBlack `2026.3.0`
|
|
32
|
+
> contract. Live UAT validation has not yet been run. See
|
|
33
|
+
> [`docs/UAT_VALIDATION.md`](docs/UAT_VALIDATION.md).
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Python 3.11 or newer
|
|
38
|
+
- A RedBlack environment, API key, application client ID, and either:
|
|
39
|
+
- a RedBlack API username, password, and client secret; or
|
|
40
|
+
- an externally managed access token
|
|
41
|
+
|
|
42
|
+
## Install for development
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
python3 -m pip install -e '.[dev]'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from redblack import Environment, PasswordCredentials, RedBlackClient
|
|
52
|
+
|
|
53
|
+
credentials = PasswordCredentials(
|
|
54
|
+
client_secret="read-from-a-secret-store",
|
|
55
|
+
username="read-from-a-secret-store",
|
|
56
|
+
password="read-from-a-secret-store",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
with RedBlackClient(
|
|
60
|
+
environment=Environment.UAT,
|
|
61
|
+
api_version="2026.3.0",
|
|
62
|
+
api_key="read-from-a-secret-store",
|
|
63
|
+
client_id="read-from-a-secret-store",
|
|
64
|
+
credentials=credentials,
|
|
65
|
+
) as client:
|
|
66
|
+
page = client.accounts.list(top=100, order_by="id asc")
|
|
67
|
+
for account in page.items:
|
|
68
|
+
print(account)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The normal constructor never reads environment variables or files. Applications
|
|
72
|
+
that intentionally want configuration lookup can use
|
|
73
|
+
`RedBlackClient.from_env()` or `RedBlackClient.from_dotenv()`.
|
|
74
|
+
|
|
75
|
+
## Safety defaults
|
|
76
|
+
|
|
77
|
+
- UAT or production must be selected explicitly.
|
|
78
|
+
- TLS verification is on and ambient proxy/CA variables are ignored by default.
|
|
79
|
+
- Access tokens are cached in memory and concurrent refresh is single-flight.
|
|
80
|
+
- Automatic retries apply to safe reads only.
|
|
81
|
+
- `POST`, `PATCH`, and `DELETE` are never replayed automatically.
|
|
82
|
+
- Task updates/deletes require the exact ETag returned by task retrieval.
|
|
83
|
+
- Deleting all cash actions requires a separate explicit confirmation.
|
|
84
|
+
- Export storage downloads never receive RedBlack credentials.
|
|
85
|
+
- Unknown response fields and enum values are preserved.
|
|
86
|
+
|
|
87
|
+
## API shape
|
|
88
|
+
|
|
89
|
+
Endpoints are grouped under:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
client.accounts
|
|
93
|
+
client.households
|
|
94
|
+
client.restrictions
|
|
95
|
+
client.equivalents
|
|
96
|
+
client.cash_actions
|
|
97
|
+
client.securities
|
|
98
|
+
client.orders
|
|
99
|
+
client.review_sets
|
|
100
|
+
client.users
|
|
101
|
+
client.tasks
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Collection methods support RedBlack's OData options through Python arguments:
|
|
105
|
+
`filter`, `order_by`, `top`, `skip`, and `count`.
|
|
106
|
+
|
|
107
|
+
List Trade Blotter or Trade Reconciliation orders with the new Orders resource:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from redblack.models import OrderFilterType
|
|
111
|
+
|
|
112
|
+
page = client.orders.list(top=100, count=True) # Active Trade Blotter orders
|
|
113
|
+
for order in client.orders.iter_all(
|
|
114
|
+
filter_type=OrderFilterType.IN_RECONCILIATION,
|
|
115
|
+
order_by="id asc",
|
|
116
|
+
max_items=1_000,
|
|
117
|
+
):
|
|
118
|
+
print(order.id, order.quantity)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The SDK now defaults to `Accept-Version: 2026.3.0`; older API versions are not
|
|
122
|
+
supported by typed methods. Orders in review sets remain accessible through
|
|
123
|
+
`client.review_sets.list_pending_orders()`.
|
|
124
|
+
|
|
125
|
+
Friendly request and response types such as `Account`, `Task`, `TaskUpdate`,
|
|
126
|
+
and `CashActionCreate` are exported from `redblack.models`. Dictionary inputs
|
|
127
|
+
are also validated before an HTTP request is sent.
|
|
128
|
+
|
|
129
|
+
## Development commands
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
ruff format --check .
|
|
133
|
+
ruff check .
|
|
134
|
+
pyright
|
|
135
|
+
pytest
|
|
136
|
+
python3 tools/generate_sdk_models.py --check
|
|
137
|
+
python3 api-docs/tools/build_openapi_docs.py --check
|
|
138
|
+
python3 tools/check_operation_coverage.py
|
|
139
|
+
python3 -m build --no-isolation
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The normal test suite uses mock transports and must not call RedBlack.
|
|
143
|
+
|
|
144
|
+
## Documentation
|
|
145
|
+
|
|
146
|
+
- [`docs/REDBLACK_PRIMER.md`](docs/REDBLACK_PRIMER.md) — start here if you are
|
|
147
|
+
new to RedBlack, rebalancing, or trading workflows
|
|
148
|
+
- [`docs/USAGE.md`](docs/USAGE.md)
|
|
149
|
+
- [`docs/API_COVERAGE.md`](docs/API_COVERAGE.md)
|
|
150
|
+
- [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md)
|
|
151
|
+
- [`docs/UAT_VALIDATION.md`](docs/UAT_VALIDATION.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
redblack/__init__.py,sha256=iiD8qywLtfyhR0EXaUNh4JJmW_23FW8m5YwiZlk7jyw,2489
|
|
2
|
+
redblack/_version.py,sha256=1EKzEgmC4ZJduEmo4qy_RWt7QfGVRqIGMe5MK_13O0Q,104
|
|
3
|
+
redblack/auth.py,sha256=WkhTomLM0wA3fjN8JvRBIrAym3fjDPZdxv0mafscjDI,12418
|
|
4
|
+
redblack/client.py,sha256=oKaHLzxGsynl18C4cw-dI-DNwJN4NAWC-VDwj9ODmqg,17629
|
|
5
|
+
redblack/config.py,sha256=YhdoUmcx_dHnJb22D2O0jndDq_B1U4nyKv051ORvi8U,21358
|
|
6
|
+
redblack/downloads.py,sha256=aMhRabkEK-731NjSOXlAap5OEUVIKQTFdTw5urY6bHA,14770
|
|
7
|
+
redblack/errors.py,sha256=L4nB-ckbmy7MPj14Du5YWQLPfhvDhDge_lIYuyt94KY,14389
|
|
8
|
+
redblack/odata.py,sha256=2mVGtIQyyrLVPlGXHGeHUnntoDHB5fJJa1Tq3zjkfto,2698
|
|
9
|
+
redblack/pagination.py,sha256=h66JUy5C90w5ixdT4Qa_5EGDGk-W6n75XHu6LTi86W8,5795
|
|
10
|
+
redblack/polling.py,sha256=Q3IES7lNPTyMxw4bkl72F_QoGANdFUmpvOEKjbz7R_g,5996
|
|
11
|
+
redblack/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
+
redblack/raw.py,sha256=esUmIHPIc8EXXqF4Jzzpw8IMrh4qW_cIt5K7PizOk-U,3227
|
|
13
|
+
redblack/response.py,sha256=qDVJ6GkxoZ1FP0ITEIQnT5HyGG-DkYBf-M0lTm_-iq4,3580
|
|
14
|
+
redblack/transport.py,sha256=4Y1EzPNRuxv9zy-HcrAVEdf1fMKykyC9nSD-QlCr7uw,22700
|
|
15
|
+
redblack/_generated/__init__.py,sha256=oHV6B1s3O5YdD4PN2xZRELptwIVoMpuCgszb5wdVZwk,758
|
|
16
|
+
redblack/_generated/contract.py,sha256=y6l96kXyC8oKz4AyrglYCr1pf5OjMhwvhjlaZwFZc7g,7193
|
|
17
|
+
redblack/_generated/operation_specs.py,sha256=erWog2mbveV9PS6DSshSInSkz_6mK0RGoNQftd9Ixz4,213988
|
|
18
|
+
redblack/models/__init__.py,sha256=_bjll5YuPnVz35b3jFWzVvHd5jWkXdWJuKR1QaolcBI,3640
|
|
19
|
+
redblack/models/base.py,sha256=a988a0iqpmuQTODW27_1Ss32jOsodPSiQ8bV5-1U5Bo,4418
|
|
20
|
+
redblack/models/generated.py,sha256=Mp-rpgyCB3s_tstZztSuKAMWE9kC4IDYFoVdHzrR18I,984337
|
|
21
|
+
redblack/resources/__init__.py,sha256=9AFskG3GYw5RfpCUV5H4QK8hBjmyhevip45sDQKrQlk,1845
|
|
22
|
+
redblack/resources/_base.py,sha256=R2wksihXk_n93pwPuE4cxNNfBgIzr3SzrWHuQhtjt_k,7076
|
|
23
|
+
redblack/resources/_collections.py,sha256=hyHZXQn68ZDQoERjS1ScaxA0KKjuTwiD6foxIl7GLhM,2653
|
|
24
|
+
redblack/resources/_exports.py,sha256=dM0UsQHais13qQlDoNnsyCLEFn__T9hEl_ONYl01cag,7116
|
|
25
|
+
redblack/resources/accounts.py,sha256=aMz2VuAtzLNTNv2IcS-k59LFFJ0CVO-MMynEGuK80lo,4040
|
|
26
|
+
redblack/resources/cash_actions.py,sha256=aqMQBQDWHiPk6JrVc9_7XtdnyUj5crB9LnRRw8QUX30,8537
|
|
27
|
+
redblack/resources/equivalents.py,sha256=snq-4cFjtxAigg-87VGpeMGJKK1sGk20ddqFQAu5KMg,4397
|
|
28
|
+
redblack/resources/households.py,sha256=oPguVV2apBeUJ_pr_nv4Cdy2myyZsCXbi5aEM_j05lg,4150
|
|
29
|
+
redblack/resources/orders.py,sha256=ZuaykmmCAx78kEqNHnhRJPUpoHn_2EdNUeWfylwCVpQ,3724
|
|
30
|
+
redblack/resources/restrictions.py,sha256=c-_9XbfnSx3ra6-87r0TDCGoso1DDXV70oFCnQQGra4,4532
|
|
31
|
+
redblack/resources/review_sets.py,sha256=07DXWVJ3YI8WImoH-xX3rrNMOJiyL8u9OEEZUjkt5F0,30628
|
|
32
|
+
redblack/resources/securities.py,sha256=tvFql4JZ50XAg4n1ru8OOf4WQyxQ0oQSo9PZI9shp8o,4976
|
|
33
|
+
redblack/resources/tasks.py,sha256=EAWfm0reO5DgcY8QCdHS2sTzrdIpYh9VGyPB9ugyC5g,8336
|
|
34
|
+
redblack/resources/users.py,sha256=ELqQNb3af-AcarXqcwFDpaiuiInR2mPsPj_VYNc9VN0,2471
|
|
35
|
+
redblack_python_sdk-0.1.0.dist-info/METADATA,sha256=mYcM0B05sSjdZAngxtfTDbN9xmF2EZfLRva7AygXCW8,4756
|
|
36
|
+
redblack_python_sdk-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
37
|
+
redblack_python_sdk-0.1.0.dist-info/top_level.txt,sha256=h7EJCCLQPAM0UKlnQDOYeR_YeNAenEE_0LEzeIgDc7o,9
|
|
38
|
+
redblack_python_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
redblack
|