Skip to content

fix(longbridge): convert order writes to SDK Decimal - #1114

Open
RainMona wants to merge 1 commit into
TraderAlice:devfrom
RainMona:cursor/longbridge-native-decimal-1744
Open

fix(longbridge): convert order writes to SDK Decimal#1114
RainMona wants to merge 1 commit into
TraderAlice:devfrom
RainMona:cursor/longbridge-native-decimal-1744

Conversation

@RainMona

Copy link
Copy Markdown
Contributor

Summary

Longbridge submit/replace currently passes decimal.js values into the SDK's native Decimal fields via as unknown as never. The N-API binding cannot unwrap those values, so paper/live order writes fail at submittedQuantity / replace quantity and the matching price fields.

This is an in-house reimplementation of the diagnosis in #959 and the write-boundary conversion proposed in #704. Credit: @fanfpy, added to CONTRIBUTORS.md.

The adapter still uses decimal.js internally. At the Longbridge write boundary it now does new LongbridgeDecimal(value.toString()) for:

  • submit: quantity, limit price, trigger price, trailing percent
  • replace: quantity, limit price, trigger price

Verification

  • pnpm vitest run services/uta/src/domain/trading/brokers/longbridge/LongbridgeBroker.spec.ts — 72/72 passed
  • npx tsc --noEmit — passed
  • pnpm -F @traderalice/uta-broker-longbridge typecheck — passed
  • pnpm test — 4546 passed; 25 unrelated CLI installer / Supervisor PTY failures in this environment (ERR_UNKNOWN_FILE_EXTENSION on packages/cli/bin/openalice.ts)
  • Live-paper: not run (no independently verified Longbridge paper account in this environment)

Boundary touch

  • trading

Non-goals

Longbridge N-API submit/replace cannot unwrap decimal.js values.
Convert quantity, price, trigger, and trailing fields through a
string at the write boundary, and credit @fanfpy for TraderAlice#959/TraderAlice#704.

Co-authored-by: RainMona <RainMona@users.noreply.github.com>
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@cursoragent is attempting to deploy a commit to the luokerenx4's Team Team on Vercel.

A member of the Team first needs to authorize it.

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.

2 participants