Skip to main content

RedBlack Python SDK

Typed Python client for the RedBlack trading, portfolio-rebalancing, and order-management API.

Alpha: the SDK is implemented from the offline RedBlack 2026.3.0 contract. Live UAT validation has not yet been run. See docs/UAT_VALIDATION.md.

Requirements

  • Python 3.11 or newer
  • A RedBlack environment, API key, application client ID, and either:
    • a RedBlack API username, password, and client secret; or
    • an externally managed access token

Install for development

python3 -m pip install -e '.[dev]'

Quick start

from redblack import Environment, PasswordCredentials, RedBlackClient

credentials = PasswordCredentials(
    client_secret="read-from-a-secret-store",
    username="read-from-a-secret-store",
    password="read-from-a-secret-store",
)

with RedBlackClient(
    environment=Environment.UAT,
    api_version="2026.3.0",
    api_key="read-from-a-secret-store",
    client_id="read-from-a-secret-store",
    credentials=credentials,
) as client:
    page = client.accounts.list(top=100, order_by="id asc")
    for account in page.items:
        print(account)

The normal constructor never reads environment variables or files. Applications that intentionally want configuration lookup can use RedBlackClient.from_env() or RedBlackClient.from_dotenv().

Safety defaults

  • UAT or production must be selected explicitly.
  • TLS verification is on and ambient proxy/CA variables are ignored by default.
  • Access tokens are cached in memory and concurrent refresh is single-flight.
  • Automatic retries apply to safe reads only.
  • POST, PATCH, and DELETE are never replayed automatically.
  • Task updates/deletes require the exact ETag returned by task retrieval.
  • Deleting all cash actions requires a separate explicit confirmation.
  • Export storage downloads never receive RedBlack credentials.
  • Unknown response fields and enum values are preserved.

API shape

Endpoints are grouped under:

client.accounts
client.households
client.restrictions
client.equivalents
client.cash_actions
client.securities
client.orders
client.review_sets
client.users
client.tasks

Collection methods support RedBlack's OData options through Python arguments: filter, order_by, top, skip, and count.

List Trade Blotter or Trade Reconciliation orders with the new Orders resource:

from redblack.models import OrderFilterType

page = client.orders.list(top=100, count=True)  # Active Trade Blotter orders
for order in client.orders.iter_all(
    filter_type=OrderFilterType.IN_RECONCILIATION,
    order_by="id asc",
    max_items=1_000,
):
    print(order.id, order.quantity)

The SDK now defaults to Accept-Version: 2026.3.0; older API versions are not supported by typed methods. Orders in review sets remain accessible through client.review_sets.list_pending_orders().

Friendly request and response types such as Account, Task, TaskUpdate, and CashActionCreate are exported from redblack.models. Dictionary inputs are also validated before an HTTP request is sent.

Development commands

ruff format --check .
ruff check .
pyright
pytest
python3 tools/generate_sdk_models.py --check
python3 api-docs/tools/build_openapi_docs.py --check
python3 tools/check_operation_coverage.py
python3 -m build --no-isolation

The normal test suite uses mock transports and must not call RedBlack.

Documentation

Metadata

Release files for redblack-python-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redblack-python-sdk 0.2.0
File Size Uploaded Provenance Actions
redblack_python_sdk-0.2.0.tar.gz 626.5 kB Without provenance Details for redblack_python_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redblack-python-sdk 0.2.0
File Interpreter ABI Platform Actions
redblack_python_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for redblack_python_sdk-0.2.0-py3-none-any.whl

Total release size: 818.2 kB

Release files / redblack_python_sdk-0.2.0.tar.gz

Download URL redblack_python_sdk-0.2.0.tar.gz
Size 626.5 kB
Tags Source
SHA-256 checksum
How to use checksums
39a97bc51deda4a1a553e96e0bce04a32b9962255bfc6e8b54617e4fd78af6c5
BLAKE2b-256 checksum
How to use checksums
3f1ee13c4ade2a2b970e7603d71dfde19b8a486789b82c0594f63e76096e2216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / redblack_python_sdk-0.2.0-py3-none-any.whl

Download URL redblack_python_sdk-0.2.0-py3-none-any.whl
Size 191.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52b3a6f900395f7423520bd4d5843d5dd61f9dc324d37289e5ec7efe46e21efe
BLAKE2b-256 checksum
How to use checksums
fa44f1397bdbff6a09ebf6da0f0cd17d2d0d56da5ba3bd3eb59775ff6290f311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for redblack-python-sdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page