Skip to main content

StaticProvider

Struct StaticProvider 

Source
pub struct StaticProvider { /* private fields */ }
Expand description

A fixed dataset served as a provider.

Implementations§

Source§

impl StaticProvider

Source

pub fn new(data: Data) -> Self

Source

pub fn from_csv(path: impl AsRef<Path>) -> Result<Self, DataError>

Serve the bars of a time,open,high,low,close,volume CSV. A header naming the columns is required; # comment lines are ignored. The symbol defaults to a placeholder — set it with with_syminfo.

Source

pub fn with_syminfo(self, syminfo: SymInfo) -> Self

The symbol these bars belong to, exposed to scripts as syminfo.*.

Source

pub fn data(&self) -> &Data

The bars and symbol this provider serves.

Trait Implementations§

Source§

impl DataProvider for StaticProvider

Source§

fn request( &self, symbol: &str, timeframe: Timeframe, ) -> Result<Data, ProviderError>

Source§

fn footprint( &self, _ticks_per_row: f64, _va_percent: f64, _imbalance_percent: f64, ) -> Option<Vec<FootprintRow>>

The volume footprint rows for the current bar (request.footprint), lowest price first. None — the default — means the host has no order-flow feed, so the script reads na.
Source§

fn financial(&self, _symbol: &str, _id: &str, _period: &str) -> Option<f64>

A fundamental financial metric (request.financial), e.g. id = "TOTAL_REVENUE", period = "FY"/"FQ". None — the default — means the host has no such feed, so the script reads na.
Source§

fn dividends(&self, _ticker: &str, _field: &str) -> Option<f64>

A dividend field (request.dividends), e.g. "gross"/"net".
Source§

fn earnings(&self, _ticker: &str, _field: &str) -> Option<f64>

An earnings field (request.earnings), e.g. "actual"/"estimate".
Source§

fn splits(&self, _ticker: &str, _field: &str) -> Option<f64>

A splits field (request.splits), e.g. "numerator"/"denominator".
Source§

fn economic(&self, _country: &str, _field: &str) -> Option<f64>

An economic series (request.economic), e.g. country = "US", field = "GDP".
Source§

fn currency_rate(&self, _from: &str, _to: &str) -> Option<f64>

The exchange rate fromto (request.currency_rate). Same-currency pairs are answered as 1.0 by the builtin without consulting the feed.

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.

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, 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.