Skip to main content

pine_core/
lib.rs

1mod bar;
2mod library;
3mod output;
4mod series_buffer;
5mod syminfo;
6mod timeframe;
7mod version;
8
9pub use bar::{Bar, Data, Ohlcv};
10pub use library::{FileResolver, LibraryLoader};
11pub use output::{
12    AlertCondition, AlertConditionOutput, BoxOutput, Color, DefaultPineOutput, FillObject,
13    FillOutput, GlobalContext, GlobalOutput, Indicator, IndicatorOutput, Input, InputOutput,
14    InputValue, Label, LabelOutput, LineObject, LineOutput, LogEntry, LogLevel, LogOutput, PineBox,
15    PineOutput, Plot, PlotOutput, Plotarrow, Plotbar, Plotcandle, Plotchar, Plotshape, Table,
16    TableCell, TableOutput,
17};
18pub use series_buffer::{SeriesBuffer, MAX_LOOKBACK};
19pub use syminfo::SymInfo;
20pub use timeframe::{Timeframe, TimeframeError, TimeframeUnit};
21pub use version::{PineVersion, VersionError};
22
23/// The error a [`DataProvider`] fails with.
24pub type ProviderError = Box<dyn std::error::Error + Send + Sync>;
25
26/// A source of market data: given a symbol and a Pine timeframe, produce its
27/// bars.
28pub trait DataProvider {
29    fn request(&self, symbol: &str, timeframe: Timeframe) -> Result<Data, ProviderError>;
30}