pub struct News { /* private fields */ }Expand description
News API endpoints
Implementations§
Source§impl News
impl News
Sourcepub async fn get_stock_news(
&self,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_stock_news( &self, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get general stock news
§Arguments
page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let news = client.news().get_stock_news(Some(0), Some(50)).await?;
for article in news {
println!("{}: {}", article.symbol.unwrap_or_default(), article.title);
}Sourcepub async fn get_symbol_news(
&self,
symbol: &str,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_symbol_news( &self, symbol: &str, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get news for a specific symbol
§Arguments
symbol- Stock symbol (e.g., “AAPL”)page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let news = client.news().get_symbol_news("AAPL", Some(0), Some(10)).await?;
for article in news {
println!("{}: {}", article.published_date, article.title);
}Sourcepub async fn get_symbols_news(
&self,
symbols: &[&str],
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_symbols_news( &self, symbols: &[&str], page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get news for multiple symbols
§Arguments
symbols- List of stock symbolspage- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let symbols = vec!["AAPL", "MSFT", "GOOGL"];
let news = client.news().get_symbols_news(&symbols, Some(0), Some(20)).await?;
for article in news {
println!("{}: {}", article.symbol.unwrap_or_default(), article.title);
}Sourcepub async fn get_crypto_news(
&self,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_crypto_news( &self, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get cryptocurrency news
§Arguments
page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let news = client.news().get_crypto_news(Some(0), Some(20)).await?;
for article in news {
println!("{}: {}", article.symbol.unwrap_or_default(), article.title);
}Sourcepub async fn get_forex_news(
&self,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_forex_news( &self, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get forex news
§Arguments
page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let news = client.news().get_forex_news(Some(0), Some(20)).await?;
for article in news {
println!("{}: {}", article.symbol.unwrap_or_default(), article.title);
}Sourcepub async fn get_general_news(
&self,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<NewsArticle>>
pub async fn get_general_news( &self, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<NewsArticle>>
Get general news (all types)
§Arguments
page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let news = client.news().get_general_news(Some(0), Some(50)).await?;
for article in news {
println!("{}: {}", article.published_date, article.title);
}Sourcepub async fn get_press_releases(
&self,
symbol: &str,
page: Option<u32>,
limit: Option<u32>,
) -> Result<Vec<PressRelease>>
pub async fn get_press_releases( &self, symbol: &str, page: Option<u32>, limit: Option<u32>, ) -> Result<Vec<PressRelease>>
Get press releases for a symbol
§Arguments
symbol- Stock symbol (e.g., “AAPL”)page- Page number (optional)limit- Number of results per page (optional)
§Example
let client = FmpClient::new()?;
let releases = client.news().get_press_releases("AAPL", Some(0), Some(10)).await?;
for release in releases {
println!("{}: {}", release.date, release.title);
}Auto Trait Implementations§
impl Freeze for News
impl !RefUnwindSafe for News
impl Send for News
impl Sync for News
impl Unpin for News
impl !UnwindSafe for News
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