Skip to content

Conversation

@AdAstraPerAsperaMX
Copy link
Contributor

No description provided.

AdAstraPerAsperaMX and others added 19 commits January 6, 2026 19:30
Implement new method to update contracts in TWS display groups for
both synchronous and asynchronous clients. The method allows changing
the displayed contract by providing a contract identifier.
* Add time zone map

* fix: correct China timezone mapping to Asia/Shanghai

- Create shared timezone utility in src/common/timezone.rs
- Map Chinese timezone names to Asia/Shanghai (UTC+8) instead of CST (UTC-6)
- Handle UTF-8 Chinese names: 中国标准时间, 北京时间
- Handle Windows name: China Standard Time
- Handle GB2312 mojibake by detecting U+FFFD replacement characters
- Update both connection and market_data modules to use shared utility
- Add tests for timezone mapping

---------

Co-authored-by: kingyond <900483@qq.com>
Co-authored-by: Wil Boayue <wil.boayue@gmail.com>
…#366)

Add helper methods to Notice struct:
- is_cancellation() - code 202 (order cancelled confirmation)
- is_warning() - codes 2100-2169
- is_system_message() - codes 1100, 1101, 1102, 1300 (connectivity)
- is_informational() - true if any of the above
- is_error() - true if NOT informational

Fixes wboayue#365
* fix: prevent scanner infinite hang on error messages (wboayue#370)

- Add explicit handling for IncomingMessages::Error in scanner decode
  functions (async and sync) to return Error::Message instead of
  Error::UnexpectedResponse
- Add bounded retry logic (max 10 attempts) to subscription next()
  methods to prevent infinite loops from unexpected responses
- Log warnings on retry attempts and errors when max retries exceeded

Fixes wboayue#370

* refactor: extract shared scanner decode function

Move scanner message type matching logic to decode_scanner_message()
in the common decoders module to avoid duplication between async and
sync implementations.

* refactor: extract retry decision logic to common module

Move retry checking and logging to check_retry() function in the
common module. This consolidates the retry decision logic that was
duplicated between async and sync subscription implementations.

- Add RetryDecision enum to represent continue/stop decisions
- Add check_retry() function that handles counting and logging
- Update async and sync subscriptions to use the shared function
- Add test for check_retry()

* style: fix variable naming and format code

Remove underscore prefix from 'err' variable since it is actually used
in the should_retry_error() call.
Reserve all order IDs upfront by calling next_order_id() for each
order instead of using base_id + offset calculation.

Fixes wboayue#374
… (wboayue#376)

Take profit and stop loss orders now inherit the outside_rth flag
from the parent order, enabling bracket orders to work correctly
during extended trading hours.
Allow market entry for bracket orders for immediate execution in scalping scenarios.
Fixes wboayue#379 - 10-second bar granularity was missing from BarSize enum.
…oayue#383)

Fixes wboayue#382. Symbol was incorrectly set to "EUR.USD" format instead of
just "EUR". Currency was hardcoded to "USD" instead of using the quote
parameter. Also removes unused amount field.
…ue#384)

* feat:
   add historical_data_streaming() with keepUpToDate=true support

   Add streaming historical data support for IBKR's reqHistoricalData API
   with keepUpToDate parameter enabled. This allows receiving continuous
   bar updates as they build, enabling live trading strategies to receive
   bars at any IBKR-supported resolution.

   Changes:
   - Add HistoricalBarUpdate enum to represent streaming updates
   - Add decode_historical_data_update() for message type 90
   - Add historical_data_streaming() async function that sets keepUpToDate=true
   - Add HistoricalDataStreamingSubscription for handling streaming responses

   IBKR behavior notes:
   - Same timestamp bars are sent ~4-6 seconds apart as they build
   - When a NEW timestamp appears, the previous bar is complete
   - Supported what_to_show: Trades, Midpoint, Bid, Ask only
   - end_date must be None when keepUpToDate=true

* add missing historical_data_streaming function

* Change channel-closed logs from warn to
  info

* fixed historical_data_streaming to properly received historical streaming data with keep_up_to_date=true

* fixed formatting and doc tests

* Revert "Change channel-closed logs from warn to"

This reverts commit 065a65e.

* fix: use proper contract builders in example

- Use Contract::forex() builder instead of manual field assignment
- Use struct initialization for futures query to satisfy clippy

---------

Co-authored-by: Wil Boayue <wil.boayue@gmail.com>
…wboayue#385)

* Add sync historical_data_streaming(), address PR wboayue#384 feedback

- Add blocking HistoricalDataStreamingSubscription with next/try_next/next_timeout
- Add Client::historical_data_streaming() for sync API
- Remove HistoricalEnd variant from HistoricalBarUpdate enum
- Fix doc example imports to use prelude types
- Replace fragile contains() test assertions with field index checks
- Remove unnecessary #[cfg(feature = "async")] from decoder

* Export historical_data_streaming doctest (ignore -> no_run)

* Bump version to 2.7.0
…boayue#386)

* Refactor: consolidate decoder context, add Client::decoder_context()

- Rename ResponseContext to DecoderContext
- Add server_version and time_zone fields to DecoderContext
- Change StreamDecoder::decode() signature to take &DecoderContext
- Add decoder_context() helper to sync and async Client
- Fix async SubscriptionBuilder to preserve time_zone
- Replace 20+ DecoderContext::new() calls with client.decoder_context()

* Format code
* feat(orders): add `last_n_days` and `specific_dates` to `ExecutionFilter`

* feat(connection): bump server `max_version` to `200` (PARAMETRIZED_DAYS_OF_EXECUTIONS)

* Add tests for encode_executions version-gated date fields

Tests verify:
- Version < 200: date fields not encoded
- Version >= 200: last_n_days and specific_dates encoded

* Update mock version responses to 200, improve doc comment

- Mock server responses now return v200 to match advertised range
- Add format spec and example to specific_dates doc

* Fix test helper to include issuer_id field for v200

Server version 200 >= BOND_ISSUERID (176), so encoder adds issuer_id.
Test helper was missing this field, causing packet mismatch with mock.

---------

Co-authored-by: Wil Boayue <wil.boayue@gmail.com>
@AdAstraPerAsperaMX
Copy link
Contributor Author

Sorry, this was a mistake

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.

6 participants