Skip to content

feat(config): add paper trading mode support across all SDK bindings#551

Open
sunli829 wants to merge 1 commit into
mainfrom
feat/papertrading-config
Open

feat(config): add paper trading mode support across all SDK bindings#551
sunli829 wants to merge 1 commit into
mainfrom
feat/papertrading-config

Conversation

@sunli829

Copy link
Copy Markdown
Collaborator

Summary

  • Add LONGBRIDGE_PAPERTRADING environment variable and enable_papertrading() API to all language SDK bindings (Rust, Python, Node.js, Java, C, C++)
  • When set to true, the SDK declares the request targets the paper trading (simulation) environment; the server validates the token and returns an error if it belongs to a real-money account
  • Default is false — no restriction imposed by the server, both paper trading and real-money accounts are accepted
  • Add Paper Trading documentation section to all language READMEs and root README

Changes by language

  • Rust: new enable_papertrading field on Config, env var read (LONGBRIDGE_PAPERTRADING), enable_papertrading() builder, set_enable_papertrading() setter, HTTP header injection, 2 unit tests
  • Python: from_apikey/from_oauth new enable_papertrading param, type stub (openapi.pyi) updated
  • Node.js: ExtraConfigParams.enablePapertrading field, apply_extra handler
  • C: lb_config_enable_papertrading() function; longbridge.h auto-updated via cbindgen
  • Java: JNI Rust impl, SdkNative.configSetEnablePapertrading native method, Config.enablePapertrading() chainable method
  • C++: Config::enable_papertrading() method in header and implementation

Test plan

  • cargo clippy --all --all-features — no new errors
  • cargo +nightly fmt --all — no formatting changes
  • cargo test -p longbridge enable_papertrading — 2 tests pass
  • cargo build -p longbridge-c — C header auto-updated with lb_config_enable_papertrading
  • Review README Paper Trading sections for all languages

🤖 Generated with Claude Code

Add LONGBRIDGE_PAPERTRADING env var and enable_papertrading() API to all
language bindings (Rust, Python, Node.js, Java, C, C++).

When enabled, the SDK declares the request targets the paper trading
(simulation) environment; the server validates the token and returns an
error if it belongs to a real-money account. Default is false — no
restriction imposed by the server.

- Rust: new field, env read, builder/setter methods, HTTP header injection,
  unit tests
- Python: from_apikey/from_oauth new param, type stub updated
- Node.js: ExtraConfigParams new field, apply_extra handler
- C: lb_config_enable_papertrading() function, longbridge.h auto-updated
- Java: JNI impl, SdkNative native method, Config.enablePapertrading()
- C++: enable_papertrading() method in Config class
- All READMEs: Paper Trading section and env var table entry added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant