pub struct Esg { /* private fields */ }Expand description
ESG and Social API endpoints
Implementations§
Source§impl Esg
impl Esg
Sourcepub async fn get_esg_score(&self, symbol: &str) -> Result<Vec<EsgScore>>
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));
}Sourcepub async fn get_esg_risk_rating(
&self,
symbol: &str,
) -> Result<Vec<EsgRiskRating>>
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"));
}Sourcepub async fn get_esg_sector_benchmark(
&self,
year: Option<&str>,
) -> Result<Vec<EsgBenchmark>>
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));
}Sourcepub async fn get_senate_trading(
&self,
symbol: Option<&str>,
) -> Result<Vec<CongressionalTrading>>
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"));
}Sourcepub async fn get_house_disclosure(
&self,
symbol: Option<&str>,
) -> Result<Vec<CongressionalTrading>>
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"));
}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> 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