pub struct MarketDatabaseService { /* private fields */ }Expand description
Service for managing market data persistence in PostgreSQL
Implementations§
Source§impl MarketDatabaseService
impl MarketDatabaseService
Sourcepub async fn initialize_database(&self) -> Result<(), Error>
pub async fn initialize_database(&self) -> Result<(), Error>
Initializes the database tables and triggers
Sourcepub async fn store_market_hierarchy(
&self,
hierarchy: &[MarketNode],
) -> Result<(), Error>
pub async fn store_market_hierarchy( &self, hierarchy: &[MarketNode], ) -> Result<(), Error>
Stores the complete market hierarchy in the database
Sourcepub async fn store_filtered_market_nodes(
&self,
hierarchy: &[MarketNode],
symbol_map: &HashMap<&str, &str>,
table_name: &str,
) -> Result<(), Error>
pub async fn store_filtered_market_nodes( &self, hierarchy: &[MarketNode], symbol_map: &HashMap<&str, &str>, table_name: &str, ) -> Result<(), Error>
Stores filtered market nodes with specific epic format in a custom table Only processes MarketNode.children where epic has format “XX.X.XXXXXXX.XX.XX” (4 dots) Adds a symbol field based on the provided HashMap mapping
Sourcepub fn is_valid_epic_format(&self, epic: &str) -> bool
pub fn is_valid_epic_format(&self, epic: &str) -> bool
Checks if epic has the required format: “XX.X.XXXXXXX.XX.XX” (exactly 4 dots)
Sourcepub fn find_symbol_for_market(
&self,
instrument_name: &str,
symbol_map: &HashMap<&str, &str>,
) -> String
pub fn find_symbol_for_market( &self, instrument_name: &str, symbol_map: &HashMap<&str, &str>, ) -> String
Finds the appropriate symbol for a market based on its name
Sourcepub fn convert_update_time(
&self,
update_time: &Option<String>,
) -> Option<DateTime<Utc>>
pub fn convert_update_time( &self, update_time: &Option<String>, ) -> Option<DateTime<Utc>>
Converts updateTime from milliseconds to formatted timestamp
Sourcepub fn convert_market_data_to_instrument(
&self,
market: &MarketData,
node_id: &str,
) -> MarketInstrument
pub fn convert_market_data_to_instrument( &self, market: &MarketData, node_id: &str, ) -> MarketInstrument
Converts MarketData to MarketInstrument
Sourcepub async fn get_market_hierarchy(
&self,
) -> Result<Vec<MarketHierarchyNode>, Error>
pub async fn get_market_hierarchy( &self, ) -> Result<Vec<MarketHierarchyNode>, Error>
Retrieves market hierarchy from the database
Sourcepub async fn get_instruments_by_node(
&self,
node_id: &str,
) -> Result<Vec<MarketInstrument>, Error>
pub async fn get_instruments_by_node( &self, node_id: &str, ) -> Result<Vec<MarketInstrument>, Error>
Retrieves market instruments for a specific node
Sourcepub async fn search_instruments(
&self,
search_term: &str,
) -> Result<Vec<MarketInstrument>, Error>
pub async fn search_instruments( &self, search_term: &str, ) -> Result<Vec<MarketInstrument>, Error>
Searches for instruments by name or epic
Sourcepub async fn get_statistics(&self) -> Result<DatabaseStatistics, Error>
pub async fn get_statistics(&self) -> Result<DatabaseStatistics, Error>
Gets statistics about the stored data
Auto Trait Implementations§
impl Freeze for MarketDatabaseService
impl !RefUnwindSafe for MarketDatabaseService
impl Send for MarketDatabaseService
impl Sync for MarketDatabaseService
impl Unpin for MarketDatabaseService
impl !UnwindSafe for MarketDatabaseService
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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