pub struct StaticProvider { /* private fields */ }Expand description
A fixed dataset served as a provider.
Implementations§
Source§impl StaticProvider
impl StaticProvider
pub fn new(data: Data) -> Self
Sourcepub fn from_csv(path: impl AsRef<Path>) -> Result<Self, DataError>
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.
Sourcepub fn with_syminfo(self, syminfo: SymInfo) -> Self
pub fn with_syminfo(self, syminfo: SymInfo) -> Self
The symbol these bars belong to, exposed to scripts as syminfo.*.
Trait Implementations§
Source§impl DataProvider for StaticProvider
impl DataProvider for StaticProvider
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>>
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>
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>
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>
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>
fn splits(&self, _ticker: &str, _field: &str) -> Option<f64>
A splits field (
request.splits), e.g. "numerator"/"denominator".Auto Trait Implementations§
impl Freeze for StaticProvider
impl RefUnwindSafe for StaticProvider
impl Send for StaticProvider
impl Sync for StaticProvider
impl Unpin for StaticProvider
impl UnsafeUnpin for StaticProvider
impl UnwindSafe for StaticProvider
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
Mutably borrows from an owned value. Read more