Skip to main content

Crate ibcore

Crate ibcore 

Source
Expand description

ibcore — Standalone IB Gateway integration layer.

Wraps ibapi::Client in a newtype IbClient that provides:

§Design

ibcore wraps ibapi rather than re-implementing it. All IB wire-protocol details are handled by the underlying ibapi crate; ibcore adds ergonomics, structured errors, and observability on top.

§Re-exports

Commonly-used ibapi types are re-exported so consumers need only depend on ibcore, never on ibapi directly:

Re-exports§

pub use client::IbClient;
pub use client::is_connection_dead;
pub use snapshots::StockSnapshot;
pub use snapshots::OptionSnapshot;
pub use chain::OptionChainData;
pub use diagnostics::DiagnosticEvent;
pub use diagnostics::FarmState;
pub use diagnostics::ConnectionState;
pub use diagnostics::AccountType;
pub use errors::IbError;
pub use exchange::get_primary_exchange;
pub use contract::build_option_contract;
pub use contract::parse_expiry;
pub use streaming::TickEvent;
pub use streaming::TickStream;
pub use orders::OpenOrder;
pub use orders::OrderStatusEvent;
pub use orders::OrderStatusStream;

Modules§

chain
Option chain data — expirations and strikes for an underlying.
client
Persistent IB Gateway client wrapper.
contract
Option contract construction helpers.
diagnostics
Diagnostic event types — structured notifications from the IB Gateway notice stream.
errors
Structured IB error types — maps raw ibapi error codes to typed variants.
exchange
Primary options exchange resolution for stock symbols.
historical
Historical market data.
order_builder
Helpers for constructing commonly used order templates. Free-function order constructors — the advanced / client-less layer.
orders
Order placement, cancellation, and status tracking.
snapshots
Market data snapshot types for stocks and options.
streaming
Real-time market data streaming.

Structs§

AccountSummaryTags
Constants for account summary tags used in account summary requests. These tags define which account information fields to retrieve.
Bar
Bar describes the historical data bar.
Client
Asynchronous TWS API Client
ClientBuilder
Builder for an async Client. Acquire via Client::builder.
Contract
Contract describes an instrument’s definition.
ContractMonth
Contract month for futures
Currency
Currency identifier
Cusip
CUSIP identifier
Duration
Duration specifier used in historical data requests (e.g. 1 D).
Exchange
Exchange identifier
ExecutionFilter
Filter criteria used to determine which execution reports are returned.
ExpirationDate
Date for option expiration
FamilyCode
Family code assigned to a group of accounts.
HistoricalData
Container for historical bar responses.
HistoricalDataBuilder
Builder for historical bar data requests.
HistoricalScheduleBuilder
Builder for the historical-schedule API.
HistoricalTicksBuilder
Builder for the historical-ticks API.
Isin
ISIN identifier
MarketDepthBuilder
Builder for level-2 (order book) market-depth subscriptions.
Notice
An error message from the TWS API.
NoticeStream
A handle for receiving globally routed notices on the async transport.
PnL
Aggregated profit and loss metrics for the entire account.
PnLSingle
Real-time profit and loss metrics for a single position.
Position
Open position held within the account.
Strike
Validated strike price (must be positive)
Subscription
Asynchronous subscription for streaming data.
Symbol
Strong type for trading symbols
TickByTickBuilder
Builder for tick-by-tick real-time subscriptions.

Enums§

AccountSummaryResult
Result of an account summary request emitted by the Client.
AccountUpdate
Account update events delivered while streaming high-level account data.
AccountUpdateMulti
Account update events scoped to an account/model code pair.
Action
Identifies the side. Generally available values are BUY and SELL. Additionally, SSHORT and SLONG are available in some institutional-accounts only. For general account types, a SELL order will be able to enter a short position automatically if the order quantity is larger than your current long position. SSHORT is only supported for institutional account configured with Long/Short account segments or clearing with a separate account. SLONG is available in specially-configured institutional accounts to indicate that long position not yet delivered is being sold.
BarSize
Request granularity for historical bars.
BondIdentifier
Bond identifier type
Error
The main error type for IBAPI operations.
ExecutionFilterSide
Side filter on outbound execution requests. IBKR’s wire vocabulary for ExecutionFilter.side is "BUY" / "SELL" only.
ExecutionSide
Side of an Execution report — direction of a filled order.
HistoricalBarSize
Request granularity for historical bars.
HistoricalWhatToShow
Enumerates the data payload returned when requesting historical data.
IgnoreSize
Whether a tick-by-tick subscription should drop tick size information.
LegAction
Trading action for spread/combo legs. Mirrors the IBKR wire vocabulary BUY / SELL / SSHORT. SLONG is not accepted on combo legs — only the SSHORT short-sale form is gated (SSHORT_COMBO_LEGS = 35, well below our floor of 210), so all three variants are unconditionally valid.
MarketDataType
Market data type for switching between real-time and frozen/delayed.
NoticeCategory
Typed classification of a Notice by TWS error-code range.
OptionRight
Option right (Call or Put). Matches IBKR’s wire vocabulary "C" / "P".
OrderStatusKind
The lifecycle state of an order, as reported by TWS.
OrderUpdate
Updates received when monitoring order activity. This enum is used by order_update_stream to deliver real-time order updates.
Orders
Enumerates possible results from querying an Order.
PlaceOrder
Responses from placing an order.
PositionUpdate
Messages emitted while streaming position updates.
PositionUpdateMulti
Messages emitted while streaming model-code scoped position updates.
RealtimeBarSize
Bar size for real-time bars.
RealtimeWhatToShow
Specifies the type of data to show for real-time bars.
SecurityType
SecurityType enumerates available security types
SmartDepth
Whether a market-depth subscription aggregates rows across exchanges.
SubscriptionItem
An item yielded by a Subscription.
TickTypes
Various types of market data ticks.
TradingHours
Specifies whether to include only regular trading hours or extended hours
WhatToShow
Enumerates the data payload returned when requesting historical data.

Constants§

IBAPI_VERSION
Version of the ibapi dependency this crate was built against.

Traits§

StreamExt
An extension trait for Streams that provides a variety of convenient combinator functions.
SubscriptionItemStreamExt
Extension trait that adds filter_data to any stream yielding Result<SubscriptionItem<T>, Error>. Async mirror of the sync SubscriptionItemIterExt.
ToDuration
Helper trait to convert integer counts into Durations.

Functions§

combo_limit_order
Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT
combo_market_order
Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution. Products: OPT, STK, FUT
version
Crate version string, from CARGO_PKG_VERSION at compile time.