pub struct ScriptBuilder<O: PineOutput> { /* private fields */ }Implementations§
Source§impl<O: PineOutput> ScriptBuilder<O>
impl<O: PineOutput> ScriptBuilder<O>
pub fn with_code(source: &str) -> ScriptBuilder<O>
Sourcepub fn with_custom_variables(self, variables: HashMap<String, Value<O>>) -> Self
pub fn with_custom_variables(self, variables: HashMap<String, Value<O>>) -> Self
Host-supplied variables the script can reference, registered as consts alongside the builtin namespaces.
Sourcepub fn with_library_loader(self, loader: Box<dyn LibraryLoader>) -> Self
pub fn with_library_loader(self, loader: Box<dyn LibraryLoader>) -> Self
Resolves import statements. Without one, importing a library fails.
Sourcepub fn with_request_provider(self, provider: Box<dyn DataProvider>) -> Self
pub fn with_request_provider(self, provider: Box<dyn DataProvider>) -> Self
Supplies bars for request.security. Without one, request.security
returns na.
pub fn with_ticker(self, ticker: String) -> Self
Sourcepub fn with_timeframe(self, timeframe: Timeframe) -> Self
pub fn with_timeframe(self, timeframe: Timeframe) -> Self
The chart timeframe exposed to the script as timeframe.*. Without one,
the namespace is populated with defaults.
Sourcepub fn with_bar_count(self, bar_count: usize) -> Self
pub fn with_bar_count(self, bar_count: usize) -> Self
Run over only the last bar_count bars of the feed. Without one, the
whole feed is used.
Sourcepub fn with_data(self, data: Data) -> Self
pub fn with_data(self, data: Data) -> Self
The market to run over: the bars, and the symbol and timeframe they belong to.
The data describes itself, so it fills in syminfo.* and timeframe.*
too. An explicit [ScriptBuilder::with_syminfo] or
ScriptBuilder::with_timeframe still wins, whichever order they are
called in.
Sourcepub fn compile(self) -> Result<Script<O>, Error>where
O: LogOutput + PlotOutput + LabelOutput + BoxOutput + InputOutput + LineOutput + TableOutput + IndicatorOutput + GlobalOutput + AlertConditionOutput + FillOutput,
pub fn compile(self) -> Result<Script<O>, Error>where
O: LogOutput + PlotOutput + LabelOutput + BoxOutput + InputOutput + LineOutput + TableOutput + IndicatorOutput + GlobalOutput + AlertConditionOutput + FillOutput,
Compile PineScript source code into a Script with default output