Skip to content

Conversation

@wboayue
Copy link
Owner

@wboayue wboayue commented Feb 9, 2026

Summary

  • Add ConnectionOptions struct with fluent builder API (.tcp_no_delay(), .startup_callback())
  • Add Client::connect_with_options(address, client_id, options) to both sync and async clients
  • Existing connect / connect_with_callback delegate to the new method
  • TCP_NODELAY applied on initial connect and reconnect for both sync (TcpSocket) and async (AsyncConnection) paths
  • ConnectionOptions re-exported via ibapi::ConnectionOptions and ibapi::prelude::*

Closes #390

Test plan

  • cargo test (default async)
  • cargo test --no-default-features --features sync
  • cargo test --all-features
  • cargo clippy --features async / --features sync / --all-features
  • cargo fmt --check

Replace per-call-site env var approach with a fluent builder API.
ConnectionOptions absorbs tcp_no_delay and startup_callback into a
single options struct. Existing connect/connect_with_callback methods
delegate to new connect_with_options on both sync and async clients.

TCP_NODELAY is applied on initial connect and reconnect for both
sync (TcpSocket) and async (AsyncConnection) paths.
Dedup callback-to-options conversion in 3 call sites.
Push TcpStream creation and TCP_NODELAY into Connection<TcpSocket>::connect_with_options
and TcpSocket::connect, mirroring the async delegation pattern.
- All connect variants converge on init() instead of chaining
- Revert connect_with_callback to Box (matching async signature)
- Remove Arc dependency from sync connection
@wboayue wboayue merged commit ae0554e into main Feb 9, 2026
3 checks passed
@wboayue wboayue deleted the feature/connection-options branch February 9, 2026 06:51
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.

feat: add opt-in TCP_NODELAY support for low-latency trading

1 participant