Skip to content

fix: conditional order visibility + ibkr ESM imports (#90, #94)#97

Merged
luokerenx4 merged 4 commits intomasterfrom
dev
Mar 31, 2026
Merged

fix: conditional order visibility + ibkr ESM imports (#90, #94)#97
luokerenx4 merged 4 commits intomasterfrom
dev

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

Test plan

  • 923 unit tests passing
  • Bybit e2e: conditional stop-loss order placed → getOrder finds it → cancelOrder cancels it
  • Bybit e2e: full order lifecycle (regular + conditional)
  • IBKR e2e: connectivity, order lifecycle, UTA flow (verified with live TWS)
  • pnpm build && node dist/main.js starts without ESM errors

🤖 Generated with Claude Code

Ame and others added 4 commits March 30, 2026 22:20
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>
@luokerenx4 luokerenx4 merged commit c9241d6 into master Mar 31, 2026
2 checks passed
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