pub struct ChartOptions {
pub symbol: Option<Ustr>,
pub exchange: Option<Ustr>,
pub interval: Interval,
pub bar_count: u64,
pub range: Option<Range>,
pub replay_mode: bool,
pub replay_from: i64,
pub replay_session: Option<Ustr>,
pub adjustment: Option<MarketAdjustment>,
pub currency: Option<Currency>,
pub session_type: Option<SessionType>,
pub study_config: Option<StudyOptions>,
}Expand description
Configuration for a real-time chart data subscription.
Specifies the instrument, time interval, bar count, replay settings, and optional study configuration for a TradingView WebSocket chart session.
§Construction
Use the builder pattern via bon:
use tradingview::{ChartOptions, Interval};
let opts = ChartOptions::builder()
.symbol("BTCUSDT")
.exchange("BINANCE")
.interval(Interval::OneHour)
.bar_count(500)
.build()
.unwrap();Alternatively, pass an instrument string in "EXCHANGE:SYMBOL" format:
use tradingview::ChartOptions;
let opts = ChartOptions::builder()
.instrument("BINANCE:BTCUSDT")
.build()
.unwrap();Fields§
§symbol: Option<Ustr>§exchange: Option<Ustr>§interval: Interval§bar_count: u64§range: Option<Range>§replay_mode: bool§replay_from: i64§replay_session: Option<Ustr>§adjustment: Option<MarketAdjustment>§currency: Option<Currency>§session_type: Option<SessionType>§study_config: Option<StudyOptions>Implementations§
Source§impl ChartOptions
impl ChartOptions
pub fn interval(self, interval: Interval) -> Self
pub fn bar_count(self, bar_count: u64) -> Self
pub fn replay_mode(self, replay_mode: bool) -> Self
pub fn replay_from(self, replay_from: i64) -> Self
pub fn replay_session_id(self, replay_session_id: &str) -> Self
Sourcepub fn range(self, range: Range) -> Self
pub fn range(self, range: Range) -> Self
range: |r,1626220800:1628640000|1D|5d|1M|3M|6M|YTD|12M|60M|ALL|
pub fn adjustment(self, adjustment: MarketAdjustment) -> Self
pub fn currency(self, currency: Currency) -> Self
pub fn session_type(self, session_type: SessionType) -> Self
pub fn study_config( self, script_id: &str, script_version: &str, script_type: ScriptType, ) -> Self
pub fn builder<'f1, 'f2, 'f3, 'f4>() -> ChartOptionsBuilder<'f1, 'f2, 'f3, 'f4>
Trait Implementations§
Source§impl Clone for ChartOptions
impl Clone for ChartOptions
impl Copy for ChartOptions
Source§impl Debug for ChartOptions
impl Debug for ChartOptions
Source§impl Default for ChartOptions
impl Default for ChartOptions
Source§impl<'de> Deserialize<'de> for ChartOptions
impl<'de> Deserialize<'de> for ChartOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChartOptions
impl RefUnwindSafe for ChartOptions
impl Send for ChartOptions
impl Sync for ChartOptions
impl Unpin for ChartOptions
impl UnsafeUnpin for ChartOptions
impl UnwindSafe for ChartOptions
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
Mutably borrows from an owned value. Read more