NautilusKernel

Struct NautilusKernel 

Source
pub struct NautilusKernel {
Show 15 fields pub name: String, pub instance_id: UUID4, pub machine_id: String, pub config: Box<dyn NautilusKernelConfig>, pub cache: Rc<RefCell<Cache>>, pub clock: Rc<RefCell<dyn Clock>>, pub portfolio: Portfolio, pub log_guard: LogGuard, pub data_engine: Rc<RefCell<DataEngine>>, pub risk_engine: RiskEngine, pub exec_engine: ExecutionEngine, pub trader: Trader, pub ts_created: UnixNanos, pub ts_started: Option<UnixNanos>, pub ts_shutdown: Option<UnixNanos>,
}
Expand description

Core Nautilus system kernel.

Orchestrates data and execution engines, cache, clock, and messaging across environments.

Fields§

§name: String

The kernel name (for logging and identification).

§instance_id: UUID4

The unique instance identifier for this kernel.

§machine_id: String

The machine identifier (hostname or similar).

§config: Box<dyn NautilusKernelConfig>

The kernel configuration.

§cache: Rc<RefCell<Cache>>

The shared in-memory cache.

§clock: Rc<RefCell<dyn Clock>>

The clock driving the kernel.

§portfolio: Portfolio

The portfolio manager.

§log_guard: LogGuard

Guard for the logging subsystem (keeps logger thread alive).

§data_engine: Rc<RefCell<DataEngine>>

The data engine instance.

§risk_engine: RiskEngine

The risk engine instance.

§exec_engine: ExecutionEngine

The execution engine instance.

§trader: Trader

The trader component.

§ts_created: UnixNanos

The UNIX timestamp (nanoseconds) when the kernel was created.

§ts_started: Option<UnixNanos>

The UNIX timestamp (nanoseconds) when the kernel was last started.

§ts_shutdown: Option<UnixNanos>

The UNIX timestamp (nanoseconds) when the kernel was last shutdown.

Implementations§

Source§

impl NautilusKernel

Source

pub const fn builder( name: String, trader_id: TraderId, environment: Environment, ) -> NautilusKernelBuilder

Create a new NautilusKernelBuilder for fluent configuration.

Source

pub fn new<T: NautilusKernelConfig + 'static>( name: String, config: T, ) -> Result<Self>

Create a new NautilusKernel instance.

§Errors

Returns an error if the kernel fails to initialize.

Source

pub fn generate_timestamp_ns(&self) -> UnixNanos

Source

pub fn environment(&self) -> Environment

Returns the kernel’s environment context (Backtest, Sandbox, Live).

Source

pub const fn name(&self) -> &str

Returns the kernel’s name.

Source

pub fn trader_id(&self) -> TraderId

Returns the kernel’s trader ID.

Source

pub fn machine_id(&self) -> &str

Returns the kernel’s machine ID.

Source

pub const fn instance_id(&self) -> UUID4

Returns the kernel’s instance ID.

Source

pub const fn ts_created(&self) -> UnixNanos

Returns the UNIX timestamp (ns) when the kernel was created.

Source

pub const fn ts_started(&self) -> Option<UnixNanos>

Returns the UNIX timestamp (ns) when the kernel was last started.

Source

pub const fn ts_shutdown(&self) -> Option<UnixNanos>

Returns the UNIX timestamp (ns) when the kernel was last shutdown.

Source

pub fn load_state(&self) -> bool

Returns whether the kernel has been configured to load state.

Source

pub fn save_state(&self) -> bool

Returns whether the kernel has been configured to save state.

Source

pub fn clock(&self) -> Rc<RefCell<dyn Clock>>

Returns the kernel’s clock.

Source

pub fn cache(&self) -> Rc<RefCell<Cache>>

Returns the kernel’s cache.

Source

pub fn msgbus(&self) -> Rc<RefCell<MessageBus>>

Returns the kernel’s message bus. // TODO: TBD if this is necessary

Source

pub const fn portfolio(&self) -> &Portfolio

Returns the kernel’s portfolio.

Source

pub fn data_engine(&self) -> Ref<'_, DataEngine>

Returns the kernel’s data engine.

Source

pub const fn risk_engine(&self) -> &RiskEngine

Returns the kernel’s risk engine.

Source

pub const fn exec_engine(&self) -> &ExecutionEngine

Returns the kernel’s execution engine.

Source

pub const fn trader(&self) -> &Trader

Returns the kernel’s trader.

Source

pub async fn start_async(&mut self)

Starts the Nautilus system kernel.

Source

pub async fn stop_async(&mut self)

Stops the Nautilus system kernel.

Source

pub fn reset(&mut self)

Resets the Nautilus system kernel to its initial state.

Source

pub fn dispose(&mut self)

Disposes of the Nautilus system kernel, releasing resources.

Trait Implementations§

Source§

impl Debug for NautilusKernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,