pub struct Data {
pub syminfo: SymInfo,
pub bars: Vec<Bar>,
}Expand description
Everything a script needs to know about the market it is running on: the bars themselves, and the symbol they belong to.
These travel together because they come from the same place — whatever hands you BTCUSD candles also knows it is BTCUSD. Splitting them would let a caller describe bars as something they are not.
Fields§
§syminfo: SymInfoExposed to the script as syminfo.*.
bars: Vec<Bar>Oldest first. A script is replayed over all of them.
Implementations§
Source§impl Data
impl Data
Sourcepub fn new(bars: Vec<Bar>) -> Self
pub fn new(bars: Vec<Bar>) -> Self
Bars for an unnamed symbol. Use with_syminfo to
say what they actually are.
Sourcepub fn from_ohlcv(rows: impl IntoIterator<Item = Ohlcv>) -> Self
pub fn from_ohlcv(rows: impl IntoIterator<Item = Ohlcv>) -> Self
Build a series from raw rows, stamping on the positional metadata: the bar index, and the barstate flags that follow from where a bar sits.
Every bar of a completed series is closed, so they are all confirmed history; only the first and last are distinguished.
pub fn with_syminfo(self, syminfo: SymInfo) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnsafeUnpin for Data
impl UnwindSafe for Data
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