Skip to main content

BinanceSource

Struct BinanceSource 

Source
pub struct BinanceSource { /* private fields */ }
Expand description

Binance’s public klines endpoint, as a DataProvider: it fetches whatever symbol and timeframe are asked for.

let data = BinanceSource::new().limit(500).request("BTCUSDT", "60".parse()?)?;

Implementations§

Source§

impl BinanceSource

Source

pub fn new() -> Self

Source

pub fn limit(self, limit: usize) -> Self

How many of the most recent candles to ask for. Binance caps this at 1000.

Trait Implementations§

Source§

impl Clone for BinanceSource

Source§

fn clone(&self) -> BinanceSource

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DataProvider for BinanceSource

Source§

fn request( &self, symbol: &str, timeframe: Timeframe, ) -> Result<Data, ProviderError>

Source§

fn footprint( &self, _ticks_per_row: f64, _va_percent: f64, _imbalance_percent: f64, ) -> Option<Vec<FootprintRow>>

The volume footprint rows for the current bar (request.footprint), lowest price first. None — the default — means the host has no order-flow feed, so the script reads na.
Source§

fn financial(&self, _symbol: &str, _id: &str, _period: &str) -> Option<f64>

A fundamental financial metric (request.financial), e.g. id = "TOTAL_REVENUE", period = "FY"/"FQ". None — the default — means the host has no such feed, so the script reads na.
Source§

fn dividends(&self, _ticker: &str, _field: &str) -> Option<f64>

A dividend field (request.dividends), e.g. "gross"/"net".
Source§

fn earnings(&self, _ticker: &str, _field: &str) -> Option<f64>

An earnings field (request.earnings), e.g. "actual"/"estimate".
Source§

fn splits(&self, _ticker: &str, _field: &str) -> Option<f64>

A splits field (request.splits), e.g. "numerator"/"denominator".
Source§

fn economic(&self, _country: &str, _field: &str) -> Option<f64>

An economic series (request.economic), e.g. country = "US", field = "GDP".
Source§

fn currency_rate(&self, _from: &str, _to: &str) -> Option<f64>

The exchange rate fromto (request.currency_rate). Same-currency pairs are answered as 1.0 by the builtin without consulting the feed.
Source§

impl Debug for BinanceSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BinanceSource

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.