Skip to content

Commit 77bda69

Browse files
committed
fix: auth response parsing + multi-platform Python wheels
Auth: - AuthUser subscription fields are integers (0-3), not strings - Removed stale subscription_level field reference - Verified against live Nexus API (session established, data returned) Python SDK: - Build matrix: Linux + macOS + Windows wheels - Source distribution (sdist) for pip install from source - Fixes "no matching distribution" for non-Linux users
1 parent f1c73e1 commit 77bda69

9 files changed

Lines changed: 49 additions & 33 deletions

File tree

.github/workflows/python.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ on:
77

88
jobs:
99
build:
10-
name: Build wheels
11-
runs-on: ubuntu-latest
10+
name: Build wheels (${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
1215
steps:
1316
- uses: actions/checkout@v4
1417
- uses: dtolnay/rust-toolchain@stable
@@ -19,24 +22,40 @@ jobs:
1922
with:
2023
repo-token: ${{ secrets.GITHUB_TOKEN }}
2124
- run: pip install maturin
22-
- run: maturin build --release -m sdks/python/Cargo.toml -o dist/
25+
- name: Build wheel
26+
run: maturin build --release -m sdks/python/Cargo.toml -o dist/
2327
env:
2428
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
2529
- uses: actions/upload-artifact@v4
2630
with:
27-
name: python-wheels
31+
name: wheels-${{ matrix.os }}
2832
path: dist/*.whl
2933

34+
sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.12"
42+
- run: pip install maturin
43+
- run: maturin sdist -m sdks/python/Cargo.toml -o dist/
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: sdist
47+
path: dist/*.tar.gz
48+
3049
publish:
3150
name: Publish to PyPI
3251
runs-on: ubuntu-latest
33-
needs: build
52+
needs: [build, sdist]
3453
if: startsWith(github.ref, 'refs/tags/v')
3554
steps:
3655
- uses: actions/download-artifact@v4
3756
with:
38-
name: python-wheels
3957
path: dist/
58+
merge-multiple: true
4059
- uses: pypa/gh-action-pypi-publish@release/v1
4160
with:
4261
password: ${{ secrets.PYPI_API_TOKEN }}

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/thetadatadx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thetadatadx"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
55
rust-version = "1.85"
66
authors = ["userFRM"]

crates/thetadatadx/src/auth/nexus.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ pub struct AuthResponse {
9898
#[serde(rename_all = "camelCase")]
9999
pub struct AuthUser {
100100
pub email: Option<String>,
101-
pub subscription_level: Option<String>,
102-
pub stock_subscription: Option<String>,
103-
pub options_subscription: Option<String>,
104-
pub indices_subscription: Option<String>,
105-
pub interest_rate_subscription: Option<String>,
101+
/// Per-asset subscription tiers (integer: 0=FREE, 1=VALUE, 2=STANDARD, 3=PRO).
102+
#[serde(default)]
103+
pub stock_subscription: Option<i32>,
104+
#[serde(default)]
105+
pub options_subscription: Option<i32>,
106+
#[serde(default)]
107+
pub indices_subscription: Option<i32>,
108+
#[serde(default)]
109+
pub interest_rate_subscription: Option<i32>,
106110
}
107111

108112
impl AuthUser {
@@ -117,22 +121,15 @@ impl AuthUser {
117121
/// Source: Java terminal `MddsConnectionManager` — `2^subscription_tier`.
118122
pub fn max_concurrent_requests(&self) -> usize {
119123
let tier = [
120-
&self.stock_subscription,
121-
&self.options_subscription,
122-
&self.indices_subscription,
123-
&self.interest_rate_subscription,
124+
self.stock_subscription,
125+
self.options_subscription,
126+
self.indices_subscription,
127+
self.interest_rate_subscription,
124128
]
125129
.iter()
126-
.filter_map(|s| s.as_deref())
127-
.map(|s| match s.to_uppercase().as_str() {
128-
"FREE" => 0,
129-
"VALUE" => 1,
130-
"STANDARD" => 2,
131-
"PROFESSIONAL" | "PRO" => 3,
132-
_ => 0,
133-
})
130+
.filter_map(|s| *s)
134131
.max()
135-
.unwrap_or(0);
132+
.unwrap_or(0) as usize;
136133
1usize << tier // 2^tier: 1, 2, 4, 8
137134
}
138135
}

crates/thetadatadx/src/direct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl DirectClient {
247247

248248
tracing::debug!(
249249
session_id_prefix = %&session.session_uuid[..8.min(session.session_uuid.len())],
250-
subscription = ?auth_resp.user.as_ref().and_then(|u| u.subscription_level.as_deref()),
250+
stock_tier = ?auth_resp.user.as_ref().and_then(|u| u.stock_subscription),
251251
"session established (session_id redacted)"
252252
);
253253

ffi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thetadatadx-ffi"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
55
description = "C FFI layer for thetadatadx — used by Go and C++ SDKs"
66
license = "GPL-3.0-or-later"

sdks/python/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thetadatadx-py"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
55
description = "Python bindings for thetadatadx — native ThetaData SDK powered by Rust"
66

sdks/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "thetadatadx"
7-
version = "1.2.0"
7+
version = "1.2.1"
88
description = "No-JVM ThetaData Terminal — native Rust SDK for direct market data access (Python bindings)"
99
readme = "README.md"
1010
requires-python = ">=3.9"

0 commit comments

Comments
 (0)