Skip to main content

ScriptBuilder

Struct ScriptBuilder 

Source
pub struct ScriptBuilder<O: PineOutput> { /* private fields */ }

Implementations§

Source§

impl<O: PineOutput> ScriptBuilder<O>

Source

pub fn with_code(source: &str) -> ScriptBuilder<O>

Source

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.

Source

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.

Source

pub fn with_library_loader(self, loader: Box<dyn LibraryLoader>) -> Self

Resolves import statements. Without one, importing a library fails.

Source

pub fn with_request_provider(self, provider: Box<dyn DataProvider>) -> Self

Supplies bars for request.security. Without one, request.security returns na.

Source

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.

Source

pub fn with_ticker(self, ticker: String) -> Self

Source

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.

Source

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.

Source

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.

Source

pub fn compile(self) -> Result<Script<O>, Error>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.