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_inputs(self, inputs: HashMap<String, InputValue>) -> Self
pub fn with_inputs(self, inputs: HashMap<String, InputValue>) -> Self
Host overrides for the script’s input.* calls, keyed by input title.
Each input.* returns (and validates) the override for its title if one
is present, else its declared default. See inputs_from_json.
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.
Sourcepub fn with_broker(self, factory: Box<dyn BrokerFactory>) -> Self
pub fn with_broker(self, factory: Box<dyn BrokerFactory>) -> Self
Swaps the broker a strategy trades against. Without one, the built-in
DefaultBrokerFactory is used.
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 + MetadataOutput + GlobalOutput + AlertConditionOutput + FillOutput + DrawingOutput,
pub fn compile(self) -> Result<Script<O>, Error>where
O: LogOutput + PlotOutput + LabelOutput + BoxOutput + InputOutput + LineOutput + TableOutput + MetadataOutput + GlobalOutput + AlertConditionOutput + FillOutput + DrawingOutput,
Compile PineScript source code into a Script with default output
Auto Trait Implementations§
impl<O> !RefUnwindSafe for ScriptBuilder<O>
impl<O> !Send for ScriptBuilder<O>
impl<O> !Sync for ScriptBuilder<O>
impl<O> !UnwindSafe for ScriptBuilder<O>
impl<O> Freeze for ScriptBuilder<O>
impl<O> Unpin for ScriptBuilder<O>
impl<O> UnsafeUnpin for ScriptBuilder<O>
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.