nautilus_infrastructure::sql::cache

Struct PostgresCacheDatabase

Source
pub struct PostgresCacheDatabase {
    pub pool: PgPool,
    /* private fields */
}

Fields§

§pool: PgPool

Implementations§

Source§

impl PostgresCacheDatabase

Source

pub async fn connect( host: Option<String>, port: Option<u16>, username: Option<String>, password: Option<String>, database: Option<String>, ) -> Result<Self, Error>

Trait Implementations§

Source§

impl CacheDatabaseAdapter for PostgresCacheDatabase

Source§

fn close(&mut self) -> Result<()>

Source§

fn flush(&mut self) -> Result<()>

Source§

fn load(&self) -> Result<HashMap<String, Bytes>>

Source§

fn load_currencies(&mut self) -> Result<HashMap<Ustr, Currency>>

Source§

fn load_instruments(&mut self) -> Result<HashMap<InstrumentId, InstrumentAny>>

Source§

fn load_synthetics( &mut self, ) -> Result<HashMap<InstrumentId, SyntheticInstrument>>

Source§

fn load_accounts(&mut self) -> Result<HashMap<AccountId, AccountAny>>

Source§

fn load_orders(&mut self) -> Result<HashMap<ClientOrderId, OrderAny>>

Source§

fn load_positions(&mut self) -> Result<HashMap<PositionId, Position>>

Source§

fn load_index_order_position(&self) -> Result<HashMap<ClientOrderId, Position>>

Source§

fn load_index_order_client(&self) -> Result<HashMap<ClientOrderId, ClientId>>

Source§

fn load_currency(&self, code: &Ustr) -> Result<Option<Currency>>

Source§

fn load_instrument( &self, instrument_id: &InstrumentId, ) -> Result<Option<InstrumentAny>>

Source§

fn load_synthetic( &self, instrument_id: &InstrumentId, ) -> Result<SyntheticInstrument>

Source§

fn load_account(&self, account_id: &AccountId) -> Result<Option<AccountAny>>

Source§

fn load_order( &self, client_order_id: &ClientOrderId, ) -> Result<Option<OrderAny>>

Source§

fn load_position(&self, position_id: &PositionId) -> Result<Position>

Source§

fn load_actor( &self, component_id: &ComponentId, ) -> Result<HashMap<String, Bytes>>

Source§

fn delete_actor(&self, component_id: &ComponentId) -> Result<()>

Source§

fn load_strategy( &self, strategy_id: &StrategyId, ) -> Result<HashMap<String, Bytes>>

Source§

fn delete_strategy(&self, component_id: &StrategyId) -> Result<()>

Source§

fn add(&self, key: String, value: Bytes) -> Result<()>

Source§

fn add_currency(&self, currency: &Currency) -> Result<()>

Source§

fn add_instrument(&self, instrument: &InstrumentAny) -> Result<()>

Source§

fn add_synthetic(&self, synthetic: &SyntheticInstrument) -> Result<()>

Source§

fn add_account(&self, account: &AccountAny) -> Result<()>

Source§

fn add_order(&self, order: &OrderAny, client_id: Option<ClientId>) -> Result<()>

Source§

fn add_position(&self, position: &Position) -> Result<()>

Source§

fn add_position_snapshot(&self, snapshot: &PositionSnapshot) -> Result<()>

Source§

fn add_order_book(&self, order_book: &OrderBook) -> Result<()>

Source§

fn add_quote(&self, quote: &QuoteTick) -> Result<()>

Source§

fn load_quotes(&self, instrument_id: &InstrumentId) -> Result<Vec<QuoteTick>>

Source§

fn add_trade(&self, trade: &TradeTick) -> Result<()>

Source§

fn load_trades(&self, instrument_id: &InstrumentId) -> Result<Vec<TradeTick>>

Source§

fn add_bar(&self, bar: &Bar) -> Result<()>

Source§

fn load_bars(&self, instrument_id: &InstrumentId) -> Result<Vec<Bar>>

Source§

fn add_signal(&self, signal: &Signal) -> Result<()>

Source§

fn load_signals(&self, name: &str) -> Result<Vec<Signal>>

Source§

fn add_custom_data(&self, data: &CustomData) -> Result<()>

Source§

fn load_custom_data(&self, data_type: &DataType) -> Result<Vec<CustomData>>

Source§

fn index_venue_order_id( &self, client_order_id: ClientOrderId, venue_order_id: VenueOrderId, ) -> Result<()>

Source§

fn index_order_position( &self, client_order_id: ClientOrderId, position_id: PositionId, ) -> Result<()>

Source§

fn update_actor(&self) -> Result<()>

Source§

fn update_strategy(&self) -> Result<()>

Source§

fn update_account(&self, account: &AccountAny) -> Result<()>

Source§

fn update_order(&self, event: &OrderEventAny) -> Result<()>

Source§

fn update_position(&self, position: &Position) -> Result<()>

Source§

fn snapshot_order_state(&self, order: &OrderAny) -> Result<()>

Source§

fn snapshot_position_state(&self, position: &Position) -> Result<()>

Source§

fn heartbeat(&self, timestamp: UnixNanos) -> Result<()>

Source§

impl Debug for PostgresCacheDatabase

Source§

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

Formats the value using the given formatter. Read more
Source§

impl IntoPy<Py<PyAny>> for PostgresCacheDatabase

Source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
Source§

impl PyClass for PostgresCacheDatabase

Source§

type Frozen = False

Whether the pyclass is frozen. Read more
Source§

impl PyClassImpl for PostgresCacheDatabase

Source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
Source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
Source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
Source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
Source§

type BaseType = PyAny

Base class
Source§

type ThreadChecker = SendablePyClass<PostgresCacheDatabase>

This handles following two situations: Read more
Source§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
Source§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
Source§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
Source§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
Source§

fn items_iter() -> PyClassItemsIter

Source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
Source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

§

fn dict_offset() -> Option<isize>

§

fn weaklist_offset() -> Option<isize>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PostgresCacheDatabase

Source§

type Holder = Option<PyRef<'py, PostgresCacheDatabase>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PostgresCacheDatabase

Source§

type Holder = Option<PyRefMut<'py, PostgresCacheDatabase>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl PyMethods<PostgresCacheDatabase> for PyClassImplCollector<PostgresCacheDatabase>

Source§

fn py_methods(self) -> &'static PyClassItems

Source§

impl PyTypeInfo for PostgresCacheDatabase

Source§

const NAME: &'static str = "PostgresCacheDatabase"

Class name.
Source§

const MODULE: Option<&'static str>

Module name, if any.
Source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
Source§

impl DerefToPyAny for PostgresCacheDatabase

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> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. 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,

§

impl<T> MaybeSendSync for T

§

impl<T> Ungil for T
where T: Send,