pub struct InteractiveBrokersDataClient { /* private fields */ }Expand description
Interactive Brokers data client.
This client provides market data functionality using the rust-ibapi library.
It manages subscriptions, handles historical data requests, and streams
market data to NautilusTrader.
Implementations§
Source§impl InteractiveBrokersDataClient
impl InteractiveBrokersDataClient
Sourcepub fn new(
client_id: ClientId,
config: InteractiveBrokersDataClientConfig,
instrument_provider: Arc<InteractiveBrokersInstrumentProvider>,
) -> Result<Self>
pub fn new( client_id: ClientId, config: InteractiveBrokersDataClientConfig, instrument_provider: Arc<InteractiveBrokersInstrumentProvider>, ) -> Result<Self>
Sourcepub async fn batch_load_instruments(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<Vec<InstrumentId>>
pub async fn batch_load_instruments( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<Vec<InstrumentId>>
Sourcepub async fn fetch_option_chain_by_range(
&self,
underlying_symbol: &str,
exchange: Option<&str>,
currency: Option<&str>,
expiry_min: Option<&str>,
expiry_max: Option<&str>,
) -> Result<usize>
pub async fn fetch_option_chain_by_range( &self, underlying_symbol: &str, exchange: Option<&str>, currency: Option<&str>, expiry_min: Option<&str>, expiry_max: Option<&str>, ) -> Result<usize>
Fetch option chain for an underlying contract with expiry filtering.
This method calls the provider’s fetch_option_chain_by_range with the data client’s IB client.
§Arguments
underlying_symbol- The underlying symbol (e.g., “AAPL”)exchange- The exchange (defaults to “SMART”)currency- The currency (defaults to “USD”)expiry_min- Minimum expiry date string (YYYYMMDD format, optional)expiry_max- Maximum expiry date string (YYYYMMDD format, optional)
§Errors
Returns an error if:
- The client is not connected
- The provider method fails
Sourcepub async fn fetch_futures_chain(
&self,
symbol: &str,
exchange: Option<&str>,
currency: Option<&str>,
min_expiry_days: Option<u32>,
max_expiry_days: Option<u32>,
) -> Result<usize>
pub async fn fetch_futures_chain( &self, symbol: &str, exchange: Option<&str>, currency: Option<&str>, min_expiry_days: Option<u32>, max_expiry_days: Option<u32>, ) -> Result<usize>
Fetch futures chain for a given underlying symbol.
This method calls the provider’s fetch_futures_chain with the data client’s IB client.
§Arguments
symbol- The underlying symbol (e.g., “ES”)exchange- The exchange (defaults to empty string for all exchanges)currency- The currency (defaults to “USD”)
§Errors
Returns an error if:
- The client is not connected
- The provider method fails
Sourcepub async fn fetch_bag_contract(&self, bag_contract: &Contract) -> Result<usize>
pub async fn fetch_bag_contract(&self, bag_contract: &Contract) -> Result<usize>
Source§impl InteractiveBrokersDataClient
impl InteractiveBrokersDataClient
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns whether the client is connected.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns whether the client is disconnected.
Sourcepub fn get_instrument_provider(
&self,
) -> PyResult<InteractiveBrokersInstrumentProvider>
pub fn get_instrument_provider( &self, ) -> PyResult<InteractiveBrokersInstrumentProvider>
Get the instrument provider.
§Errors
Returns an error indicating the provider should be accessed through data client methods.
Trait Implementations§
Source§impl DataClient for InteractiveBrokersDataClient
impl DataClient for InteractiveBrokersDataClient
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
true if the client is currently connected.Source§fn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
true if the client is currently disconnected.Source§fn subscribe_quotes(&mut self, cmd: SubscribeQuotes) -> Result<()>
fn subscribe_quotes(&mut self, cmd: SubscribeQuotes) -> Result<()>
Source§fn subscribe_index_prices(&mut self, cmd: SubscribeIndexPrices) -> Result<()>
fn subscribe_index_prices(&mut self, cmd: SubscribeIndexPrices) -> Result<()>
Source§fn subscribe_option_greeks(&mut self, cmd: SubscribeOptionGreeks) -> Result<()>
fn subscribe_option_greeks(&mut self, cmd: SubscribeOptionGreeks) -> Result<()>
Source§fn unsubscribe_quotes(&mut self, cmd: &UnsubscribeQuotes) -> Result<()>
fn unsubscribe_quotes(&mut self, cmd: &UnsubscribeQuotes) -> Result<()>
Source§fn unsubscribe_index_prices(
&mut self,
cmd: &UnsubscribeIndexPrices,
) -> Result<()>
fn unsubscribe_index_prices( &mut self, cmd: &UnsubscribeIndexPrices, ) -> Result<()>
Source§fn unsubscribe_option_greeks(
&mut self,
cmd: &UnsubscribeOptionGreeks,
) -> Result<()>
fn unsubscribe_option_greeks( &mut self, cmd: &UnsubscribeOptionGreeks, ) -> Result<()>
Source§fn subscribe_trades(&mut self, cmd: SubscribeTrades) -> Result<()>
fn subscribe_trades(&mut self, cmd: SubscribeTrades) -> Result<()>
Source§fn unsubscribe_trades(&mut self, cmd: &UnsubscribeTrades) -> Result<()>
fn unsubscribe_trades(&mut self, cmd: &UnsubscribeTrades) -> Result<()>
Source§fn subscribe_bars(&mut self, cmd: SubscribeBars) -> Result<()>
fn subscribe_bars(&mut self, cmd: SubscribeBars) -> Result<()>
Source§fn unsubscribe_bars(&mut self, cmd: &UnsubscribeBars) -> Result<()>
fn unsubscribe_bars(&mut self, cmd: &UnsubscribeBars) -> Result<()>
Source§fn subscribe_book_deltas(&mut self, cmd: SubscribeBookDeltas) -> Result<()>
fn subscribe_book_deltas(&mut self, cmd: SubscribeBookDeltas) -> Result<()>
Source§fn unsubscribe_book_deltas(&mut self, cmd: &UnsubscribeBookDeltas) -> Result<()>
fn unsubscribe_book_deltas(&mut self, cmd: &UnsubscribeBookDeltas) -> Result<()>
Source§fn request_instrument(&self, cmd: RequestInstrument) -> Result<()>
fn request_instrument(&self, cmd: RequestInstrument) -> Result<()>
Source§fn request_instruments(&self, cmd: RequestInstruments) -> Result<()>
fn request_instruments(&self, cmd: RequestInstruments) -> Result<()>
Source§fn request_quotes(&self, cmd: RequestQuotes) -> Result<()>
fn request_quotes(&self, cmd: RequestQuotes) -> Result<()>
Source§fn request_trades(&self, cmd: RequestTrades) -> Result<()>
fn request_trades(&self, cmd: RequestTrades) -> Result<()>
Source§fn request_bars(&self, cmd: RequestBars) -> Result<()>
fn request_bars(&self, cmd: RequestBars) -> Result<()>
§fn subscribe(&mut self, cmd: SubscribeCustomData) -> Result<(), Error>
fn subscribe(&mut self, cmd: SubscribeCustomData) -> Result<(), Error>
§fn subscribe_instruments(
&mut self,
cmd: SubscribeInstruments,
) -> Result<(), Error>
fn subscribe_instruments( &mut self, cmd: SubscribeInstruments, ) -> Result<(), Error>
§fn subscribe_instrument(
&mut self,
cmd: SubscribeInstrument,
) -> Result<(), Error>
fn subscribe_instrument( &mut self, cmd: SubscribeInstrument, ) -> Result<(), Error>
§fn subscribe_book_depth10(
&mut self,
cmd: SubscribeBookDepth10,
) -> Result<(), Error>
fn subscribe_book_depth10( &mut self, cmd: SubscribeBookDepth10, ) -> Result<(), Error>
§fn subscribe_mark_prices(
&mut self,
cmd: SubscribeMarkPrices,
) -> Result<(), Error>
fn subscribe_mark_prices( &mut self, cmd: SubscribeMarkPrices, ) -> Result<(), Error>
§fn subscribe_funding_rates(
&mut self,
cmd: SubscribeFundingRates,
) -> Result<(), Error>
fn subscribe_funding_rates( &mut self, cmd: SubscribeFundingRates, ) -> Result<(), Error>
§fn subscribe_instrument_status(
&mut self,
cmd: SubscribeInstrumentStatus,
) -> Result<(), Error>
fn subscribe_instrument_status( &mut self, cmd: SubscribeInstrumentStatus, ) -> Result<(), Error>
§fn subscribe_instrument_close(
&mut self,
cmd: SubscribeInstrumentClose,
) -> Result<(), Error>
fn subscribe_instrument_close( &mut self, cmd: SubscribeInstrumentClose, ) -> Result<(), Error>
§fn subscribe_blocks(&mut self, cmd: SubscribeBlocks) -> Result<(), Error>
fn subscribe_blocks(&mut self, cmd: SubscribeBlocks) -> Result<(), Error>
§fn subscribe_pool(&mut self, cmd: SubscribePool) -> Result<(), Error>
fn subscribe_pool(&mut self, cmd: SubscribePool) -> Result<(), Error>
§fn subscribe_pool_swaps(&mut self, cmd: SubscribePoolSwaps) -> Result<(), Error>
fn subscribe_pool_swaps(&mut self, cmd: SubscribePoolSwaps) -> Result<(), Error>
§fn subscribe_pool_liquidity_updates(
&mut self,
cmd: SubscribePoolLiquidityUpdates,
) -> Result<(), Error>
fn subscribe_pool_liquidity_updates( &mut self, cmd: SubscribePoolLiquidityUpdates, ) -> Result<(), Error>
§fn subscribe_pool_fee_collects(
&mut self,
cmd: SubscribePoolFeeCollects,
) -> Result<(), Error>
fn subscribe_pool_fee_collects( &mut self, cmd: SubscribePoolFeeCollects, ) -> Result<(), Error>
§fn subscribe_pool_flash_events(
&mut self,
cmd: SubscribePoolFlashEvents,
) -> Result<(), Error>
fn subscribe_pool_flash_events( &mut self, cmd: SubscribePoolFlashEvents, ) -> Result<(), Error>
§fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<(), Error>
fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<(), Error>
§fn unsubscribe_instruments(
&mut self,
cmd: &UnsubscribeInstruments,
) -> Result<(), Error>
fn unsubscribe_instruments( &mut self, cmd: &UnsubscribeInstruments, ) -> Result<(), Error>
§fn unsubscribe_instrument(
&mut self,
cmd: &UnsubscribeInstrument,
) -> Result<(), Error>
fn unsubscribe_instrument( &mut self, cmd: &UnsubscribeInstrument, ) -> Result<(), Error>
§fn unsubscribe_book_depth10(
&mut self,
cmd: &UnsubscribeBookDepth10,
) -> Result<(), Error>
fn unsubscribe_book_depth10( &mut self, cmd: &UnsubscribeBookDepth10, ) -> Result<(), Error>
§fn unsubscribe_mark_prices(
&mut self,
cmd: &UnsubscribeMarkPrices,
) -> Result<(), Error>
fn unsubscribe_mark_prices( &mut self, cmd: &UnsubscribeMarkPrices, ) -> Result<(), Error>
§fn unsubscribe_funding_rates(
&mut self,
cmd: &UnsubscribeFundingRates,
) -> Result<(), Error>
fn unsubscribe_funding_rates( &mut self, cmd: &UnsubscribeFundingRates, ) -> Result<(), Error>
§fn unsubscribe_instrument_status(
&mut self,
cmd: &UnsubscribeInstrumentStatus,
) -> Result<(), Error>
fn unsubscribe_instrument_status( &mut self, cmd: &UnsubscribeInstrumentStatus, ) -> Result<(), Error>
§fn unsubscribe_instrument_close(
&mut self,
cmd: &UnsubscribeInstrumentClose,
) -> Result<(), Error>
fn unsubscribe_instrument_close( &mut self, cmd: &UnsubscribeInstrumentClose, ) -> Result<(), Error>
§fn unsubscribe_blocks(&mut self, cmd: &UnsubscribeBlocks) -> Result<(), Error>
fn unsubscribe_blocks(&mut self, cmd: &UnsubscribeBlocks) -> Result<(), Error>
§fn unsubscribe_pool(&mut self, cmd: &UnsubscribePool) -> Result<(), Error>
fn unsubscribe_pool(&mut self, cmd: &UnsubscribePool) -> Result<(), Error>
§fn unsubscribe_pool_swaps(
&mut self,
cmd: &UnsubscribePoolSwaps,
) -> Result<(), Error>
fn unsubscribe_pool_swaps( &mut self, cmd: &UnsubscribePoolSwaps, ) -> Result<(), Error>
§fn unsubscribe_pool_liquidity_updates(
&mut self,
cmd: &UnsubscribePoolLiquidityUpdates,
) -> Result<(), Error>
fn unsubscribe_pool_liquidity_updates( &mut self, cmd: &UnsubscribePoolLiquidityUpdates, ) -> Result<(), Error>
§fn unsubscribe_pool_fee_collects(
&mut self,
cmd: &UnsubscribePoolFeeCollects,
) -> Result<(), Error>
fn unsubscribe_pool_fee_collects( &mut self, cmd: &UnsubscribePoolFeeCollects, ) -> Result<(), Error>
§fn unsubscribe_pool_flash_events(
&mut self,
cmd: &UnsubscribePoolFlashEvents,
) -> Result<(), Error>
fn unsubscribe_pool_flash_events( &mut self, cmd: &UnsubscribePoolFlashEvents, ) -> Result<(), Error>
§fn request_data(&self, request: RequestCustomData) -> Result<(), Error>
fn request_data(&self, request: RequestCustomData) -> Result<(), Error>
§fn request_book_snapshot(
&self,
request: RequestBookSnapshot,
) -> Result<(), Error>
fn request_book_snapshot( &self, request: RequestBookSnapshot, ) -> Result<(), Error>
§fn request_funding_rates(
&self,
request: RequestFundingRates,
) -> Result<(), Error>
fn request_funding_rates( &self, request: RequestFundingRates, ) -> Result<(), Error>
§fn request_forward_prices(
&self,
request: RequestForwardPrices,
) -> Result<(), Error>
fn request_forward_prices( &self, request: RequestForwardPrices, ) -> Result<(), Error>
Source§impl Debug for InteractiveBrokersDataClient
impl Debug for InteractiveBrokersDataClient
Source§impl Drop for InteractiveBrokersDataClient
impl Drop for InteractiveBrokersDataClient
Source§impl<'py> IntoPyObject<'py> for InteractiveBrokersDataClient
impl<'py> IntoPyObject<'py> for InteractiveBrokersDataClient
Source§type Target = InteractiveBrokersDataClient
type Target = InteractiveBrokersDataClient
Source§type Output = Bound<'py, <InteractiveBrokersDataClient as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <InteractiveBrokersDataClient as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for InteractiveBrokersDataClient
impl PyClass for InteractiveBrokersDataClient
Source§impl PyClassImpl for InteractiveBrokersDataClient
impl PyClassImpl for InteractiveBrokersDataClient
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Interactive Brokers data client.
///
/// This client provides market data functionality using the `rust-ibapi` library.
/// It manages subscriptions, handles historical data requests, and streams
/// market data to NautilusTrader.
const RAW_DOC: &'static CStr = /// Interactive Brokers data client. /// /// This client provides market data functionality using the `rust-ibapi` library. /// It manages subscriptions, handles historical data requests, and streams /// market data to NautilusTrader.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<InteractiveBrokersDataClient as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<InteractiveBrokersDataClient>
type Layout = <<InteractiveBrokersDataClient as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<InteractiveBrokersDataClient>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForInteractiveBrokersDataClient
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for InteractiveBrokersDataClient
impl PyClassNewTextSignature for InteractiveBrokersDataClient
const TEXT_SIGNATURE: &'static str = "(_msgbus, _cache, _clock, instrument_provider, config)"
Source§impl PyTypeInfo for InteractiveBrokersDataClient
impl PyTypeInfo for InteractiveBrokersDataClient
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for InteractiveBrokersDataClient
impl ExtractPyClassWithClone for InteractiveBrokersDataClient
Auto Trait Implementations§
impl !Freeze for InteractiveBrokersDataClient
impl !RefUnwindSafe for InteractiveBrokersDataClient
impl Send for InteractiveBrokersDataClient
impl Sync for InteractiveBrokersDataClient
impl Unpin for InteractiveBrokersDataClient
impl UnsafeUnpin for InteractiveBrokersDataClient
impl !UnwindSafe for InteractiveBrokersDataClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more