Etf

Struct Etf 

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

ETF API endpoints

Implementations§

Source§

impl Etf

Source

pub async fn get_etf_list(&self) -> Result<Vec<EtfListItem>>

Get a list of all available ETFs

§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let etfs = client.etf().get_etf_list().await?;
     
    for etf in etfs.iter().take(5) {
        println!("{}: {}", etf.symbol, etf.name);
    }
    Ok(())
}
Source

pub async fn search_etf( &self, query: &str, limit: Option<u32>, exchange: Option<&str>, ) -> Result<Vec<EtfSearchResult>>

Search for ETFs by name or symbol

§Arguments
  • query - Search query (name or symbol fragment)
  • limit - Optional limit on number of results
  • exchange - Optional exchange filter (e.g., “NASDAQ”, “NYSE”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let results = client.etf().search_etf("vanguard", Some(10), None).await?;
     
    for etf in &results {
        println!("{}: {} ({})", etf.symbol, etf.name,
                 etf.exchange_short_name.as_deref().unwrap_or("N/A"));
    }
    Ok(())
}
Source

pub async fn get_etf_holder(&self, symbol: &str) -> Result<Vec<EtfHolder>>

Get institutional holders of an ETF (who holds this ETF)

§Arguments
  • symbol - ETF symbol (e.g., “SPY”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let holders = client.etf().get_etf_holder("SPY").await?;
     
    println!("Top holders of SPY:");
    for holder in holders.iter().take(10) {
        println!("  {}: {}%", holder.name,
                 holder.weight_percentage.unwrap_or(0.0));
    }
    Ok(())
}
Source

pub async fn get_etf_holdings(&self, symbol: &str) -> Result<Vec<EtfHolding>>

Get holdings of an ETF (what this ETF holds)

§Arguments
  • symbol - ETF symbol (e.g., “SPY”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let holdings = client.etf().get_etf_holdings("SPY").await?;
     
    println!("Top holdings in SPY:");
    for holding in holdings.iter().take(10) {
        println!("  {}: {:.2}% ({})",
                 holding.asset, holding.weight_percentage, holding.name);
    }
    Ok(())
}
Source

pub async fn get_etf_sector_weighting( &self, symbol: &str, ) -> Result<Vec<SectorWeighting>>

Get sector weighting of an ETF

§Arguments
  • symbol - ETF symbol (e.g., “SPY”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let sectors = client.etf().get_etf_sector_weighting("SPY").await?;
     
    println!("Sector allocation for SPY:");
    for sector in &sectors {
        println!("  {}: {}%", sector.sector, sector.weight_percentage);
    }
    Ok(())
}
Source

pub async fn get_etf_country_weighting( &self, symbol: &str, ) -> Result<Vec<CountryWeighting>>

Get country weighting of an ETF

§Arguments
  • symbol - ETF symbol (e.g., “SPY”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let countries = client.etf().get_etf_country_weighting("SPY").await?;
     
    println!("Country allocation for SPY:");
    for country in &countries {
        println!("  {}: {}%", country.country, country.weight_percentage);
    }
    Ok(())
}
Source

pub async fn get_etf_info(&self, symbol: &str) -> Result<Vec<EtfInfo>>

Get detailed information about an ETF

§Arguments
  • symbol - ETF symbol (e.g., “SPY”)
§Example
use fmp_rs::FmpClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = FmpClient::new()?;
    let info = client.etf().get_etf_info("SPY").await?;
     
    if let Some(etf) = info.first() {
        println!("ETF: {} ({})", etf.company_name, etf.symbol);
        println!("AUM: ${:.2}B", etf.aum / 1_000_000_000.0);
        println!("Expense Ratio: {:.2}%", etf.expense_ratio);
        println!("Holdings: {}", etf.holdings_count);
        println!("Inception: {}", etf.inception_date);
    }
    Ok(())
}

Auto Trait Implementations§

§

impl Freeze for Etf

§

impl !RefUnwindSafe for Etf

§

impl Send for Etf

§

impl Sync for Etf

§

impl Unpin for Etf

§

impl !UnwindSafe for Etf

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,