Skip to content

Commit dc5c5bd

Browse files
userFRMclaude
andcommitted
Initial commit
Co-Authored-By: Claude <noreply@anthropic.com>
0 parents  commit dc5c5bd

67 files changed

Lines changed: 17803 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or unexpected behavior
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of the bug.
12+
13+
## Environment
14+
15+
- **thetadatadx version**: (e.g., 0.1.0)
16+
- **OS**: (e.g., Ubuntu 24.04, macOS 15)
17+
- **Rust version**: (output of `rustc --version`)
18+
- **SDK** (if applicable): Python / Go / C++
19+
- **ThetaData terminal version** (if applicable):
20+
- **ThetaData subscription tier** (if applicable): Free / Value / Standard / Pro
21+
22+
## Endpoint / Method Affected
23+
24+
Which API endpoint or client method is involved? (e.g., `DirectClient::get_quotes`, `FpssClient::subscribe`)
25+
26+
## Steps to Reproduce
27+
28+
1. ...
29+
2. ...
30+
3. ...
31+
32+
## Expected Behavior
33+
34+
What you expected to happen.
35+
36+
## Actual Behavior
37+
38+
What actually happened. Include error messages, stack traces, or logs if available.
39+
40+
## Minimal Reproduction
41+
42+
```rust
43+
// Minimal code to reproduce the issue, if possible
44+
```
45+
46+
## Additional Context
47+
48+
Any other context, screenshots, or packet captures that might help.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or improvement
4+
title: "[FEATURE] "
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
## Summary
10+
11+
A clear and concise description of the feature you'd like.
12+
13+
## Motivation
14+
15+
Why is this feature needed? What problem does it solve?
16+
17+
## Proposed Solution
18+
19+
Describe how you'd like this to work. Include API sketches if relevant:
20+
21+
```rust
22+
// Example API surface
23+
```
24+
25+
## Alternatives Considered
26+
27+
Any alternative solutions or workarounds you've considered.
28+
29+
## Additional Context
30+
31+
Any other context, references, or screenshots about the feature request.
32+
33+
- Related ThetaData documentation:
34+
- Related issues:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Summary
2+
3+
Brief description of what this PR does and why.
4+
5+
## Changes
6+
7+
- ...
8+
9+
## Checklist
10+
11+
- [ ] `cargo fmt --all -- --check` passes
12+
- [ ] `cargo clippy --workspace -- -D warnings` passes
13+
- [ ] `cargo test --workspace` passes
14+
- [ ] Updated `CHANGELOG.md` (if user-facing change)
15+
- [ ] Updated documentation (if public API changed)
16+
- [ ] FFI/SDK bindings updated (if core API changed)
17+
18+
## Testing
19+
20+
How was this tested? Include relevant test commands or scenarios.
21+
22+
## Related Issues
23+
24+
Closes #

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
check:
15+
name: Format & Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
20+
with:
21+
components: rustfmt, clippy
22+
- uses: Swatinem/rust-cache@v2
23+
- uses: arduino/setup-protoc@v3
24+
with:
25+
repo-token: ${{ secrets.GITHUB_TOKEN }}
26+
- run: cargo fmt --all -- --check
27+
- run: cargo clippy --workspace -- -D warnings
28+
29+
test:
30+
name: Test
31+
runs-on: ubuntu-latest
32+
needs: check
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@stable
36+
- uses: Swatinem/rust-cache@v2
37+
- uses: arduino/setup-protoc@v3
38+
with:
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
- run: cargo test --workspace
41+
42+
build-ffi:
43+
name: Build FFI
44+
runs-on: ubuntu-latest
45+
needs: check
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: dtolnay/rust-toolchain@stable
49+
- uses: Swatinem/rust-cache@v2
50+
- uses: arduino/setup-protoc@v3
51+
with:
52+
repo-token: ${{ secrets.GITHUB_TOKEN }}
53+
- run: cargo build --release -p thetadatadx-ffi
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: ffi-linux-x86_64
57+
path: |
58+
target/release/libthetadatadx_ffi.so
59+
target/release/libthetadatadx_ffi.a
60+
61+
publish-crate:
62+
name: Publish to crates.io
63+
runs-on: ubuntu-latest
64+
needs: [test, build-ffi]
65+
if: startsWith(github.ref, 'refs/tags/v')
66+
steps:
67+
- uses: actions/checkout@v4
68+
- uses: dtolnay/rust-toolchain@stable
69+
- uses: arduino/setup-protoc@v3
70+
with:
71+
repo-token: ${{ secrets.GITHUB_TOKEN }}
72+
- run: cargo publish -p thetadatadx --allow-dirty
73+
env:
74+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
75+
76+
release:
77+
name: GitHub Release
78+
runs-on: ubuntu-latest
79+
needs: [publish-crate, build-ffi]
80+
if: startsWith(github.ref, 'refs/tags/v')
81+
permissions:
82+
contents: write
83+
steps:
84+
- uses: actions/checkout@v4
85+
- uses: actions/download-artifact@v4
86+
with:
87+
name: ffi-linux-x86_64
88+
path: artifacts/
89+
- uses: softprops/action-gh-release@v2
90+
with:
91+
generate_release_notes: true
92+
files: |
93+
artifacts/libthetadatadx_ffi.so
94+
artifacts/libthetadatadx_ffi.a

.github/workflows/python.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Python SDK
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: Build wheels
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
- uses: arduino/setup-protoc@v3
19+
with:
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
- run: pip install maturin
22+
- run: maturin build --release -m sdks/python/Cargo.toml -o dist/
23+
env:
24+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: python-wheels
28+
path: dist/*.whl
29+
30+
publish:
31+
name: Publish to PyPI
32+
runs-on: ubuntu-latest
33+
needs: build
34+
if: startsWith(github.ref, 'refs/tags/v')
35+
steps:
36+
- uses: actions/download-artifact@v4
37+
with:
38+
name: python-wheels
39+
path: dist/
40+
- uses: pypa/gh-action-pypi-publish@release/v1
41+
with:
42+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/target
2+
**/target
3+
*.whl
4+
.venv/
5+
venv/
6+
*.so
7+
*.dylib
8+
*.dll
9+
*.a
10+
creds.txt
11+
config.toml
12+
config.properties
13+
__pycache__/
14+
*.pyc
15+
*.egg-info/
16+
dist/
17+
build/
18+
.env

CHANGELOG.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
See [TODO.md](TODO.md) for the production readiness checklist and performance roadmap.
11+
12+
## [1.0.0] - 2026-03-26
13+
14+
### Added
15+
16+
- **DirectClient** for MDDS gRPC — 19 typed endpoints for historical market data
17+
(stock/option/index: list, history, snapshot, at-time, greeks)
18+
- **FpssClient** for FPSS streaming — real-time quotes, trades, open interest, OHLC
19+
via TLS/TCP with heartbeat and manual reconnection
20+
- **Auth module** — Nexus API authentication (email/password → session UUID)
21+
- **FIT/FIE codec** — nibble-based tick compression/decompression (ported from Java)
22+
- **Greeks calculator** — full Black-Scholes: 22 Greeks + IV bisection solver with
23+
precomputed shared intermediates and edge-case guards (t=0, v=0)
24+
- **All tick types** — TradeTick, QuoteTick, OhlcTick, EodTick, OpenInterestTick,
25+
SnapshotTradeTick, TradeQuoteTick with fixed-point Price encoding
26+
- **80+ DataType enum codes** — quotes, trades, OHLC, all Greek orders, dividends,
27+
splits, fundamentals
28+
- **Proto definitions** — extracted via runtime FileDescriptor reflection from
29+
ThetaData Terminal v202603181 (endpoints.proto + v3_endpoints.proto)
30+
- **Runtime configuration**`DirectConfig` with all JVM-equivalent tuning knobs
31+
- `contract_lookup(id)` on `FpssClient` for single-entry hot-path lookup
32+
- `FpssEvent::Error` variant for surfacing protocol parse failures
33+
- Date parameter validation on all `DirectClient` methods
34+
- `async-zstd` feature flag for optional streaming decompression
35+
- **Python SDK** (PyO3/maturin) — wraps the Rust crate, not a reimplementation
36+
- **Go SDK** — CGo FFI bindings over the C ABI layer
37+
- **C++ SDK** — RAII C++ wrapper over the C header
38+
- **C FFI crate** (`thetadatadx-ffi`) — stable `extern "C"` ABI for all SDKs
39+
- **Documentation** — architecture (Mermaid), API reference, reverse-engineering guide, JVM deviations
40+
- **CI/CD** — GitHub Actions (fmt, clippy, test, FFI build, crates.io publish, PyPI publish, GitHub Release)
41+
- **Project infrastructure** — CHANGELOG, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT,
42+
clippy.toml, cliff.toml, rust-toolchain.toml, LICENSE (GPL-3.0-or-later)
43+
44+
### Security
45+
46+
- Credential `Debug` redaction — passwords never appear in debug output
47+
- `AuthRequest` does not derive `Debug` (prevents password in error traces)
48+
- Session UUID redaction — bearer tokens logged at `debug!` level only, first 8 chars
49+
- `assert!` on FPSS frame size limits — enforced in release builds
50+
- Unified TLS via rustls for all connections (MDDS gRPC + FPSS TCP + Nexus HTTP)
51+
- Timeouts on all network operations (auth 10s/5s, gRPC keepalive, FPSS connect, FPSS read 10s)
52+
- 7 credential/account errors treated as permanent disconnect (no futile reconnect loops)
53+
- Contract root length validated before wire serialization
54+
- FIT decoder uses i64 accumulator with i32 saturation (no silent overflow)
55+
- Price type range enforced with `assert!` in release builds
56+
57+
[Unreleased]: https://github.com/userFRM/ThetaDataDx/compare/v1.0.0...HEAD
58+
[1.0.0]: https://github.com/userFRM/ThetaDataDx/releases/tag/v1.0.0

CODE_OF_CONDUCT.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Code of Conduct
2+
3+
This project follows the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) (v2.1).
4+
5+
## Summary
6+
7+
We are committed to providing a welcoming and inclusive experience for everyone. We pledge to act and interact in ways that contribute to an open, diverse, and healthy community.
8+
9+
Unacceptable behavior includes harassment, trolling, derogatory comments, personal attacks, and publishing private information without consent.
10+
11+
## Enforcement
12+
13+
Instances of unacceptable behavior may be reported by opening an issue or contacting the maintainers. All complaints will be reviewed and investigated promptly and fairly.
14+
15+
## Scope
16+
17+
This applies to all project spaces (issues, PRs, discussions, Discord) and when representing the project publicly.
18+
19+
For the full text, see https://www.contributor-covenant.org/version/2/1/code_of_conduct/

0 commit comments

Comments
 (0)