pub struct ForexClient<'a> { /* private fields */ }Expand description
High-level FX market facade for quote snapshots, technicals, and movers.
§Examples
use tvdata_rs::{Result, TradingViewClient};
#[tokio::main]
async fn main() -> Result<()> {
let client = TradingViewClient::builder().build()?;
let quote = client.forex().quote("FX:EURUSD").await?;
println!("{:?}", quote.close);
Ok(())
}Implementations§
Source§impl<'a> ForexClient<'a>
impl<'a> ForexClient<'a>
pub const fn new(client: &'a TradingViewClient) -> Self
pub fn client(&self) -> &'a TradingViewClient
Sourcepub async fn quote(&self, symbol: impl Into<Ticker>) -> Result<QuoteSnapshot>
pub async fn quote(&self, symbol: impl Into<Ticker>) -> Result<QuoteSnapshot>
Fetches a typed FX quote snapshot for a single symbol.
Sourcepub async fn quotes<I, T>(&self, symbols: I) -> Result<Vec<QuoteSnapshot>>
pub async fn quotes<I, T>(&self, symbols: I) -> Result<Vec<QuoteSnapshot>>
Fetches typed FX quote snapshots for multiple symbols while preserving the requested order.
pub async fn quotes_batch<I, T>( &self, symbols: I, ) -> Result<BatchResult<QuoteSnapshot>>
pub async fn technical_summary( &self, symbol: impl Into<Ticker>, ) -> Result<TechnicalSummary>
pub async fn technical_summaries<I, T>( &self, symbols: I, ) -> Result<Vec<TechnicalSummary>>
pub async fn overview(&self, symbol: impl Into<Ticker>) -> Result<ForexOverview>
pub async fn overviews<I, T>(&self, symbols: I) -> Result<Vec<ForexOverview>>
pub async fn top_gainers(&self, limit: usize) -> Result<Vec<QuoteSnapshot>>
pub async fn top_losers(&self, limit: usize) -> Result<Vec<QuoteSnapshot>>
Sourcepub async fn most_active(&self, limit: usize) -> Result<Vec<QuoteSnapshot>>
pub async fn most_active(&self, limit: usize) -> Result<Vec<QuoteSnapshot>>
Fetches the most active FX instruments by TradingView volume.
§Examples
use tvdata_rs::{Result, TradingViewClient};
#[tokio::main]
async fn main() -> Result<()> {
let client = TradingViewClient::builder().build()?;
let movers = client.forex().most_active(10).await?;
println!("movers: {}", movers.len());
Ok(())
}Trait Implementations§
Source§impl<'a> Clone for ForexClient<'a>
impl<'a> Clone for ForexClient<'a>
Source§fn clone(&self) -> ForexClient<'a>
fn clone(&self) -> ForexClient<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ForexClient<'a>
impl<'a> Debug for ForexClient<'a>
impl<'a> Copy for ForexClient<'a>
Auto Trait Implementations§
impl<'a> Freeze for ForexClient<'a>
impl<'a> !RefUnwindSafe for ForexClient<'a>
impl<'a> Send for ForexClient<'a>
impl<'a> Sync for ForexClient<'a>
impl<'a> Unpin for ForexClient<'a>
impl<'a> UnsafeUnpin for ForexClient<'a>
impl<'a> !UnwindSafe for ForexClient<'a>
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