fix: conditional order visibility + ibkr ESM imports (#90, #94)#97
Merged
luokerenx4 merged 4 commits intomasterfrom Mar 31, 2026
Merged
fix: conditional order visibility + ibkr ESM imports (#90, #94)#97luokerenx4 merged 4 commits intomasterfrom
luokerenx4 merged 4 commits intomasterfrom
Conversation
CCXT exchanges store conditional orders (stop-loss, take-profit) on
separate endpoints. getOrder/cancelOrder/modifyOrder now fall back to
fetchOrder with { stop: true } so these orders are no longer invisible.
This also prevents the duplicate order placement described in #91.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CCXT's "unified API" behaves differently per exchange (Bybit needs fetchOpenOrder/fetchClosedOrder, others use fetchOrder). Instead of if/else patches, introduce an override system: - overrides.ts: interface + default impls + registry - exchanges/bybit.ts: Bybit-specific fetchOrderById override - CcxtBroker delegates to override ?? default Bybit conditional order e2e test confirms stop-loss orders are now visible to getOrder and cancellable — the core #90 fix verified against a real exchange. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Node.js ESM requires explicit file extensions on all imports. The decoder module and protobuf files had bare paths (e.g. from './base' instead of './base.js'), causing ERR_UNSUPPORTED_DIR_IMPORT when running `node dist/main.js`. - decoder/index.ts + client/base.ts + index.ts: 10 bare imports fixed - generate-proto.sh: add importSuffix=.js, regenerate 203 protobuf files - pnpm dev (tsx) was unaffected; this fixes production builds only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
waitFor(delivered.length) returns before handleFire completes (dedup.record + eventLog.append happen after send). Second fire hits the processing guard instead of dedup logic. Wait for heartbeat.done event instead to ensure full cycle completion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getOrder/cancelOrder/modifyOrderbecause CCXT stores them on separate endpoints requiring{ stop: true }. Introduced an exchange override system — tested exchanges (Bybit) get verified logic, others use a sensible default with{ stop: true }fallback.node dist/main.jscrashed withERR_UNSUPPORTED_DIR_IMPORTbecause the ibkr package had bare ESM imports. Added.jsextensions to 10 hand-written imports and regenerated 203 protobuf files withimportSuffix=.js.Test plan
getOrderfinds it →cancelOrdercancels itpnpm build && node dist/main.jsstarts without ESM errors🤖 Generated with Claude Code