Skip to content

Commit f3118b3

Browse files
userFRMclaude
andcommitted
fix: stale JSON docs, missing Python Greeks fields, stale CGo declaration
- docs/api-reference.md: removed false claim that tdx_fpss_next_event returns JSON -- it returns *mut TdxFpssEvent since PR #89 - ffi/README.md: same correction - sdks/go/client.go: fixed stale CGo declaration (char* -> TdxFpssEvent*) - sdks/python/src/lib.rs: added 15 missing Greeks fields to greeks_tick_to_dict (vanna, charm, vomma, veta, speed, zomma, color, ultima, d1, d2, dual_delta, dual_gamma, epsilon, lambda, vera) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 12b1769 commit f3118b3

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

docs/api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ ThetaDataDx exposes **61 typed methods** (plus 4 `_stream` variants) covering al
663663

664664
All 61 endpoints are exposed through the `thetadatadx-ffi` C ABI crate. Each method has a corresponding `extern "C"` function (e.g., `thetadatadx_stock_history_eod`). The Go and C++ SDKs wrap these FFI functions 1:1.
665665

666-
**No JSON crosses the FFI boundary for historical data, snapshots, or subscriptions.** All inputs and outputs for these endpoints use typed `#[repr(C)]` structs. The sole exception is `tdx_fpss_next_event`, which returns a pre-formatted JSON string for real-time streaming events:
666+
**No JSON crosses the FFI boundary.** All inputs and outputs use typed `#[repr(C)]` structs -- historical endpoints, streaming events, Greeks, and subscriptions alike. `tdx_fpss_next_event` and `tdx_unified_next_event` return `*mut TdxFpssEvent` (a tagged `#[repr(C)]` struct with quote/trade/open_interest/ohlcvc/control/raw_data variants), freed with `tdx_fpss_event_free`.
667667

668668
- **Bulk snapshot endpoints** (stock/index snapshot OHLC, trade, quote, market value, price) accept `symbols: *const *const c_char, symbols_len: usize` — a C array of C string pointers with a length.
669669
- **`tdx_all_greeks`** returns `*mut TdxGreeksResult` (22 `f64` fields). Caller frees with `tdx_greeks_result_free`.

ffi/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ All 61 endpoints are available as `tdx_stock_*`, `tdx_option_*`, `tdx_index_*`,
7474
| `tdx_fpss_is_authenticated` | Check if FPSS is authenticated |
7575
| `tdx_fpss_contract_lookup` | Look up contract by ID |
7676
| `tdx_fpss_active_subscriptions` | List active subscriptions (typed `TdxSubscriptionArray`) |
77-
| `tdx_fpss_next_event` | Poll for next event (JSON, blocks with timeout) |
77+
| `tdx_fpss_next_event` | Poll for next event (`*mut TdxFpssEvent`, blocks with timeout) |
7878
| `tdx_fpss_shutdown` | Shut down FPSS client |
7979
| `tdx_fpss_free` | Free the FPSS handle |
8080

@@ -87,7 +87,7 @@ All functions that can fail return null on error. Call `tdx_last_error()` to get
8787
- Opaque handles are heap-allocated via `Box::into_raw`, freed via `Box::from_raw` in the corresponding `*_free` function.
8888
- Data endpoints return typed `#[repr(C)]` struct arrays (e.g. `TdxEodTickArray { data, len }`) - free with the corresponding `tdx_*_array_free` function.
8989
- List endpoints return `TdxStringArray` - free with `tdx_string_array_free`.
90-
- `tdx_fpss_next_event` returns `*mut c_char` (JSON string) - free with `tdx_string_free`.
90+
- `tdx_fpss_next_event` / `tdx_unified_next_event` return `*mut TdxFpssEvent` (tagged `#[repr(C)]` struct) - free with `tdx_fpss_event_free`.
9191
- `tdx_fpss_active_subscriptions` returns `*mut TdxSubscriptionArray` - free with `tdx_subscription_array_free`.
9292
- `tdx_last_error()` returns a borrowed pointer - do NOT free it.
9393
- `tdx_unified_historical()` returns a borrowed pointer - do NOT free it.

sdks/go/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ extern int tdx_fpss_is_authenticated(const TdxFpssHandle* h);
154154
extern char* tdx_fpss_contract_lookup(const TdxFpssHandle* h, int id);
155155
extern TdxSubscriptionArray* tdx_fpss_active_subscriptions(const TdxFpssHandle* h);
156156
extern void tdx_subscription_array_free(TdxSubscriptionArray* arr);
157-
extern char* tdx_fpss_next_event(const TdxFpssHandle* h, uint64_t timeout_ms);
157+
extern TdxFpssEvent* tdx_fpss_next_event(const TdxFpssHandle* h, uint64_t timeout_ms);
158+
extern void tdx_fpss_event_free(TdxFpssEvent* event);
158159
extern void tdx_fpss_shutdown(const TdxFpssHandle* h);
159160
extern void tdx_fpss_free(TdxFpssHandle* h);
160161
*/

sdks/python/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,21 @@ fn greeks_tick_to_dict(py: Python<'_>, t: &tick::GreeksTick) -> Py<PyAny> {
261261
dict.set_item("vega", t.vega).unwrap();
262262
dict.set_item("rho", t.rho).unwrap();
263263
dict.set_item("iv_error", t.iv_error).unwrap();
264+
dict.set_item("vanna", t.vanna).unwrap();
265+
dict.set_item("charm", t.charm).unwrap();
266+
dict.set_item("vomma", t.vomma).unwrap();
267+
dict.set_item("veta", t.veta).unwrap();
268+
dict.set_item("speed", t.speed).unwrap();
269+
dict.set_item("zomma", t.zomma).unwrap();
270+
dict.set_item("color", t.color).unwrap();
271+
dict.set_item("ultima", t.ultima).unwrap();
272+
dict.set_item("d1", t.d1).unwrap();
273+
dict.set_item("d2", t.d2).unwrap();
274+
dict.set_item("dual_delta", t.dual_delta).unwrap();
275+
dict.set_item("dual_gamma", t.dual_gamma).unwrap();
276+
dict.set_item("epsilon", t.epsilon).unwrap();
277+
dict.set_item("lambda", t.lambda).unwrap();
278+
dict.set_item("vera", t.vera).unwrap();
264279
dict.set_item("date", t.date).unwrap();
265280
set_contract_id!(dict, t);
266281
dict.into_any().unbind()

0 commit comments

Comments
 (0)