|
1 | 1 | ``ib_async`` Changelog
|
2 | 2 | ======================
|
3 | 3 |
|
| 4 | +2.0 |
| 5 | +--- |
| 6 | + |
| 7 | +Version 2.0.0 (2025-06-13) |
| 8 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 9 | + |
| 10 | +This major release includes significant new features, performance improvements, and critical bug fixes. The most notable addition is the custom defaults system, allowing users to customize how ib_async handles empty values and timestamps throughout the library. |
| 11 | + |
| 12 | +**Added** |
| 13 | + |
| 14 | +* **Custom Default Values**: Major new feature allowing customization of default values used throughout the library via ``IBDefaults`` object passed to ``IB()`` constructor |
| 15 | + |
| 16 | + * Customize ``emptyPrice``, ``emptySize``, ``unset`` values, and ``timezone`` settings |
| 17 | + * Replace IBKR's default values (``emptyPrice=-1``, ``emptySize=0``, ``unset=nan``) with your preferred defaults (e.g., ``None``) |
| 18 | + * Set custom timezone for timestamp display (e.g., ``pytz.timezone("US/Eastern")`` instead of UTC) |
| 19 | + |
| 20 | +* **Enhanced Ticker Data**: New ticker fields for improved market data analysis |
| 21 | + |
| 22 | + * ``timestamp``: Float format timestamp for easier mathematical operations alongside existing ``time`` field |
| 23 | + * ``shortable``: Shortability score (0-3) for instruments |
| 24 | + * ``volumeRate3Min``, ``volumeRate5Min``, ``volumeRate10Min``: IBKR-provided volume acceleration metrics |
| 25 | + * ``lastTimestamp``: Timestamp of the last trade event |
| 26 | + |
| 27 | +* **OrderStatus Enhancements**: Extended order management capabilities |
| 28 | + |
| 29 | + * New API status states added to ``OrderStatus`` enum |
| 30 | + * ``totalQuantity()`` method to report total order quantity |
| 31 | + * Additional helper methods for reading order states |
| 32 | + |
| 33 | +* **OrderState Conversion Helpers**: New utility methods for ``OrderState`` objects |
| 34 | + |
| 35 | + * ``numeric()``: Convert string values to numbers with optional digit rounding |
| 36 | + * ``formatted()``: Convert values to comma-separated formatted strings |
| 37 | + * Both methods handle ``UNSET_DOUBLE`` values automatically |
| 38 | + |
| 39 | +* **OptionComputation Mathematical Operations**: Options can now be added, subtracted, and multiplied |
| 40 | + |
| 41 | + * Enables direct calculation of Greeks for spreads (e.g., vertical spreads: ``longGreeks - shortGreeks``) |
| 42 | + |
| 43 | +* **Contract-from-params Abstraction**: Centralized logic for converting generic ``Contract`` objects to specific subclass types (e.g., ``Contract(secType="OPT")`` → ``Option()``) |
| 44 | + |
| 45 | +* **Enhanced Contract Support**: |
| 46 | + |
| 47 | + * Event Contracts ("EC" security type) recognition for binary event betting |
| 48 | + * Bag contracts can now be hashed using leg details, symbol, and exchange |
| 49 | + |
| 50 | +* **Improved Market Data Subscription Management**: |
| 51 | + |
| 52 | + * ``cancelMktData()`` now returns success/failure status instead of just logging |
| 53 | + * Contract lookups now use ``hash(contract)`` instead of ``id(contract)``, allowing reuse of equivalent contract objects |
| 54 | + |
| 55 | +**Changed** |
| 56 | + |
| 57 | +* **Breaking**: ``qualifyContractsAsync()`` behavior significantly improved |
| 58 | + |
| 59 | + * Now returns N results for N input contracts (previously returned fewer results if some failed) |
| 60 | + * Failed qualifications return ``None`` in corresponding position |
| 61 | + * New ``returnAll`` parameter: when ``True``, returns all possible matches as a list instead of failing for ambiguous contracts |
| 62 | + * Enables reliable ``zip(requestContracts, resultContracts)`` usage |
| 63 | + |
| 64 | +* **Ticker Previous Value Logic**: Simplified and more accurate tracking |
| 65 | + |
| 66 | + * Previous price/size now always reflects the truly previous values, regardless of whether they match current values |
| 67 | + * Removed conditional updating that caused inaccurate "previous" data representation |
| 68 | + * Better performance by eliminating unnecessary comparisons |
| 69 | + |
| 70 | +* **Type System Modernization**: Extensive type annotation improvements |
| 71 | + |
| 72 | + * ``Dict`` → ``dict``, ``List`` → ``list``, ``FrozenSet`` → ``frozenset`` throughout codebase |
| 73 | + * Enhanced ``Order`` class with proper type annotations and ``Decimal`` support for price/quantity fields |
| 74 | + * Converted ``NamedTuple`` instances to frozen dataclasses for better extensibility |
| 75 | + |
| 76 | +* **Event Loop Handling**: Updated for modern Python compatibility (recent asyncio API changes) |
| 77 | + |
| 78 | +**Fixed** |
| 79 | + |
| 80 | +* **Critical Order Management Bug**: Fixed order cache deletion issues that caused "phantom orders" |
| 81 | + |
| 82 | + * Orders are no longer incorrectly deleted from client state when modification validation fails |
| 83 | + * Warning messages are now logged to order history instead of causing state corruption |
| 84 | + * Prevents situation where orders appear cancelled locally but remain active at broker |
| 85 | + |
| 86 | +* **Order Modification Bug Prevention**: Added API-level validation to prevent common modification errors |
| 87 | + |
| 88 | + * Automatic handling of IBKR API field overwrites that conflict with user data |
| 89 | + * Prevents submission of unintended order updates from cached order objects |
| 90 | + |
| 91 | +* **TWS API Contract Matching Bug Workaround**: Fixed cross-instrument contract suggestions |
| 92 | + |
| 93 | + * When requesting FOP contracts, IBKR was incorrectly also returning Event Contracts |
| 94 | + * Now filters results to only return contracts matching the requested security type |
| 95 | + |
| 96 | +* **Bulk Data Tick Types**: Fixed default value handling in bulk tick processing |
| 97 | +* **Last Trade Timestamp Validation**: Improved handling of invalid '0' timestamps from ticker startup |
| 98 | +* **Volatility Order Type**: Corrected "VOL" → "VOLAT" order type specification |
| 99 | +* **Missing Import**: Added missing import that was causing import errors |
| 100 | +* **False Order Cache Deletion**: Additional fix for orders being incorrectly removed during modification validation |
| 101 | + |
| 102 | +**Performance** |
| 103 | + |
| 104 | +* **Tick Processing Optimization**: Significant performance improvements for market data handling |
| 105 | + |
| 106 | + * Replaced multi-case if/else branches with lookup maps for tick type processing |
| 107 | + * More efficient handling of generic ticks and Greek ticks |
| 108 | + * Added explicit error handling for unknown tick types to aid future development |
| 109 | + |
| 110 | +* **Ticker Update Performance**: Eliminated unnecessary comparison operations during ticker updates |
| 111 | + |
| 112 | + * Always replace fields instead of conditionally checking for changes |
| 113 | + * Faster processing of instruments with frequent same-price trades |
| 114 | + |
| 115 | +**Developer Experience** |
| 116 | + |
| 117 | +* **Enhanced Error Handling**: Better error messages and logging throughout |
| 118 | + |
| 119 | + * Unknown tick types now generate explicit error messages for easier debugging |
| 120 | + * More verbose validation error reporting |
| 121 | + |
| 122 | +* **Code Style**: Comprehensive formatting and linting improvements |
| 123 | + |
| 124 | + * Applied ``ruff format`` and ``ufmt`` formatting across entire codebase |
| 125 | + * Fixed various style warnings and modernized code patterns |
| 126 | + * Variable naming improvements (fixed illegal variable names like 'l') |
| 127 | + |
| 128 | +**Internal** |
| 129 | + |
| 130 | +* **Disconnection Logic**: Improved connection state management |
| 131 | + |
| 132 | + * Full state reset on disconnect/reconnect cycles |
| 133 | + * Returns connection status string with session details |
| 134 | + |
| 135 | +* **Utility Functions**: Modernized ``util.py`` with updated Python patterns and async compatibility |
| 136 | + |
| 137 | +**Migration Notes for v2.0.0:** |
| 138 | + |
| 139 | +1. **qualifyContractsAsync() users**: The return value now always contains the same number of elements as input contracts. Check for ``None`` values to detect failed qualifications. |
| 140 | + |
| 141 | +2. **Custom defaults users**: Consider using ``IBDefaults()`` to customize empty values if you've been manually handling ``-1`` prices or ``0`` sizes. |
| 142 | + |
| 143 | +3. **Ticker previous value users**: The logic for ``previousPrice``/``previousSize`` is now more accurate but may show different values if you were relying on the old conditional update behavior. |
| 144 | + |
| 145 | +4. **Order management users**: Order validation errors are now logged to order history instead of causing order deletions. Check order event logs for validation details. |
| 146 | + |
4 | 147 | 1.0
|
5 | 148 | ---
|
6 | 149 |
|
|
0 commit comments