pub struct DockerizedIBGateway { /* private fields */ }Expand description
Dockerized IB Gateway manager.
This struct manages the lifecycle of Interactive Brokers Gateway Docker containers, including creation, starting, stopping, and status checking.
Implementations§
Source§impl DockerizedIBGateway
impl DockerizedIBGateway
Sourcepub const CONTAINER_NAME: &'static str = "nautilus-ib-gateway"
pub const CONTAINER_NAME: &'static str = "nautilus-ib-gateway"
Base container name.
Sourcepub const HOST_PORTS: &'static [(&'static str, u16)]
pub const HOST_PORTS: &'static [(&'static str, u16)]
Host API ports by trading mode.
Sourcepub const CONTAINER_PORTS: &'static [(&'static str, u16)]
pub const CONTAINER_PORTS: &'static [(&'static str, u16)]
Container API ports exposed by the IB Gateway image.
Sourcepub const VNC_PORT_INTERNAL: u16 = 5900
pub const VNC_PORT_INTERNAL: u16 = 5900
Internal VNC port.
Sourcepub fn new(config: DockerizedIBGatewayConfig) -> Result<Self>
pub fn new(config: DockerizedIBGatewayConfig) -> Result<Self>
Create a new DockerizedIBGateway from configuration.
§Errors
Returns an error if:
- Configuration validation fails.
- Username or password is not provided and not available in environment variables.
- Docker client creation fails.
Sourcepub fn container_name(&self) -> &str
pub fn container_name(&self) -> &str
Get the container name.
Sourcepub async fn is_logged_in(&self, container_id: &str) -> Result<bool>
pub async fn is_logged_in(&self, container_id: &str) -> Result<bool>
Check if the container is logged in by examining logs.
§Errors
Returns an error if log retrieval fails.
Sourcepub async fn container_status(&self) -> Result<ContainerStatus>
pub async fn container_status(&self) -> Result<ContainerStatus>
Sourcepub async fn start(&mut self, wait: Option<u64>) -> Result<()>
pub async fn start(&mut self, wait: Option<u64>) -> Result<()>
Starts the gateway container, or reuses a running one, and waits for its login.
Waits up to wait seconds, or the configured timeout without one.
§Errors
Returns an error if:
- Container creation or startup fails.
- The gateway does not log in within the wait.
Sourcepub async fn safe_start(&mut self, wait: Option<u64>) -> Result<()>
pub async fn safe_start(&mut self, wait: Option<u64>) -> Result<()>
Starts the gateway like Self::start, and waits for the login of a container that
another caller has just created.
§Errors
Returns an error if:
- Startup fails for a reason other than that conflict.
- The gateway does not log in within the wait.
Trait Implementations§
Source§impl Clone for DockerizedIBGateway
impl Clone for DockerizedIBGateway
Source§impl Debug for DockerizedIBGateway
Available on crate feature gateway only.
impl Debug for DockerizedIBGateway
gateway only.impl DerefToPyAny for DockerizedIBGateway
Source§impl<'a, 'py> FromPyObject<'a, 'py> for DockerizedIBGatewaywhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for DockerizedIBGatewaywhere
Self: Clone,
Source§impl<'py> IntoPyObject<'py> for DockerizedIBGateway
impl<'py> IntoPyObject<'py> for DockerizedIBGateway
Source§type Target = DockerizedIBGateway
type Target = DockerizedIBGateway
Source§type Output = Bound<'py, DockerizedIBGateway>
type Output = Bound<'py, DockerizedIBGateway>
Source§fn into_pyobject(self, py: Python<'py>) -> PyResult<Bound<'py, Self>>
fn into_pyobject(self, py: Python<'py>) -> PyResult<Bound<'py, Self>>
Source§impl PyClass for DockerizedIBGateway
impl PyClass for DockerizedIBGateway
Source§impl PyClassImpl for DockerizedIBGateway
impl PyClassImpl for DockerizedIBGateway
Source§const RAW_DOC: &'static CStr = /// Dockerized IB Gateway manager.
///
/// This struct manages the lifecycle of Interactive Brokers Gateway Docker containers,
/// including creation, starting, stopping, and status checking.
const RAW_DOC: &'static CStr = /// Dockerized IB Gateway manager. /// /// This struct manages the lifecycle of Interactive Brokers Gateway Docker containers, /// including creation, starting, stopping, and status checking.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<DockerizedIBGateway as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<DockerizedIBGateway>
type Layout = <<DockerizedIBGateway as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<DockerizedIBGateway>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForDockerizedIBGateway
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 __traverse__(&self, visit: PyVisit<'_>) -> Result<(), PyTraverseError>
§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for DockerizedIBGateway
impl PyClassNewTextSignature for DockerizedIBGateway
const TEXT_SIGNATURE: &'static str = "(config)"
Source§impl PyStubType for DockerizedIBGateway
impl PyStubType for DockerizedIBGateway
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for DockerizedIBGateway
impl PyTypeInfo for DockerizedIBGateway
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.Auto Trait Implementations§
impl !RefUnwindSafe for DockerizedIBGateway
impl !UnwindSafe for DockerizedIBGateway
impl Freeze for DockerizedIBGateway
impl Send for DockerizedIBGateway
impl Sync for DockerizedIBGateway
impl Unpin for DockerizedIBGateway
impl UnsafeUnpin for DockerizedIBGateway
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<'py, T> FromPyObjectOwned<'py> for Twhere
T: for<'a> FromPyObject<'a, 'py>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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>where
Self: IntoPyObject<'py, Error = !>,
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>where
Self: IntoPyObject<'py, Error = !>,
self into a [Py<PyAny>] when the underlying conversion is infallible.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§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,
§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