Esg

Struct Esg 

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

ESG and Social API endpoints

Implementations§

Source§

impl Esg

Source

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

Get ESG scores for a company

Returns Environmental, Social, and Governance scores and ratings.

§Arguments
  • symbol - Stock symbol (e.g., “AAPL”)
§Example
let client = FmpClient::new()?;
let esg_scores = client.esg().get_esg_score("AAPL").await?;
for score in esg_scores.iter().take(3) {
    println!("{}: ESG Score = {:.1}",
        score.company_name.as_deref().unwrap_or("N/A"),
        score.esg_score.unwrap_or(0.0));
    println!("  E: {:.1}, S: {:.1}, G: {:.1}",
        score.environment_score.unwrap_or(0.0),
        score.social_score.unwrap_or(0.0),
        score.governance_score.unwrap_or(0.0));
}
Source

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

Get ESG risk ratings for a company

Returns ESG risk assessment and industry rankings.

§Arguments
  • symbol - Stock symbol
§Example
let client = FmpClient::new()?;
let esg_risk = client.esg().get_esg_risk_rating("TSLA").await?;
for risk in esg_risk.iter().take(3) {
    println!("{}: Risk Score = {:.1} ({})",
        risk.company_name.as_deref().unwrap_or("N/A"),
        risk.esg_risk_score.unwrap_or(0.0),
        risk.esg_risk_level.as_deref().unwrap_or("N/A"));
}
Source

pub async fn get_esg_sector_benchmark( &self, year: Option<&str>, ) -> Result<Vec<EsgBenchmark>>

Get ESG benchmark data by industry

Returns industry ESG benchmark scores for comparison.

§Arguments
  • year - Year for benchmark data (optional)
§Example
let client = FmpClient::new()?;
let benchmarks = client.esg().get_esg_sector_benchmark(Some("2023")).await?;
for benchmark in benchmarks.iter().take(5) {
    println!("{}: ESG Benchmark = {:.1}",
        benchmark.industry.as_deref().unwrap_or("N/A"),
        benchmark.esg_benchmark.unwrap_or(0.0));
}
Source

pub async fn get_senate_trading( &self, symbol: Option<&str>, ) -> Result<Vec<CongressionalTrading>>

Get Congressional trading data

Returns stock transactions by US Congress members.

§Arguments
  • symbol - Stock symbol (optional, filters by specific stock)
§Example
let client = FmpClient::new()?;
let congress_trades = client.esg().get_senate_trading(None).await?;
for trade in congress_trades.iter().take(10) {
    println!("{}: {} {} {} ({})",
        trade.transaction_date.as_deref().unwrap_or("N/A"),
        trade.representative.as_deref().unwrap_or("N/A"),
        trade.transaction.as_deref().unwrap_or("N/A"),
        trade.ticker.as_deref().unwrap_or("N/A"),
        trade.amount.as_deref().unwrap_or("N/A"));
}
Source

pub async fn get_house_disclosure( &self, symbol: Option<&str>, ) -> Result<Vec<CongressionalTrading>>

Get House of Representatives trading data

Returns stock transactions by US House members.

§Arguments
  • symbol - Stock symbol (optional)
§Example
let client = FmpClient::new()?;
let house_trades = client.esg().get_house_disclosure(None).await?;
for trade in house_trades.iter().take(10) {
    println!("{}: {} {} {} ({})",
        trade.transaction_date.as_deref().unwrap_or("N/A"),
        trade.representative.as_deref().unwrap_or("N/A"),
        trade.transaction.as_deref().unwrap_or("N/A"),
        trade.ticker.as_deref().unwrap_or("N/A"),
        trade.amount.as_deref().unwrap_or("N/A"));
}
Source

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

Get social sentiment data

Returns social media sentiment analysis for stocks.

§Arguments
  • symbol - Stock symbol
§Example
let client = FmpClient::new()?;
let sentiment = client.esg().get_social_sentiment("GME").await?;
for data in sentiment.iter().take(5) {
    println!("{}: Sentiment = {} (Twitter: {:.2}, StockTwits: {:.2})",
        data.date,
        data.general_sentiment.as_deref().unwrap_or("N/A"),
        data.twitter_sentiment.unwrap_or(0.0),
        data.stocktwits_sentiment.unwrap_or(0.0));
}

Auto Trait Implementations§

§

impl Freeze for Esg

§

impl !RefUnwindSafe for Esg

§

impl Send for Esg

§

impl Sync for Esg

§

impl Unpin for Esg

§

impl !UnwindSafe for Esg

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,