pub struct FmpClient { /* private fields */ }Expand description
Async client for Financial Modeling Prep stable API endpoints.
Implementations§
Source§impl FmpClient
impl FmpClient
Sourcepub fn new(api_key: impl Into<String>) -> Result<Self>
pub fn new(api_key: impl Into<String>) -> Result<Self>
Builds a client using the default stable FMP base URL.
§Errors
Returns Error::InvalidBaseUrl only if the compiled-in default URL is invalid.
Sourcepub fn with_base_url(
api_key: impl Into<String>,
base_url: impl AsRef<str>,
) -> Result<Self>
pub fn with_base_url( api_key: impl Into<String>, base_url: impl AsRef<str>, ) -> Result<Self>
Builds a client using a custom base URL, primarily for tests.
§Errors
Returns Error::InvalidBaseUrl if base_url cannot be parsed, uses
an unsupported scheme, contains credentials, or contains query or
fragment components.
Sourcepub async fn by_symbol_list(
&self,
endpoint: Endpoint,
symbols: &[String],
) -> Result<Value>
pub async fn by_symbol_list( &self, endpoint: Endpoint, symbols: &[String], ) -> Result<Value>
Sourcepub async fn by_symbol_limit(
&self,
endpoint: Endpoint,
symbol: &str,
limit: Option<u16>,
) -> Result<Value>
pub async fn by_symbol_limit( &self, endpoint: Endpoint, symbol: &str, limit: Option<u16>, ) -> Result<Value>
Calls endpoint with ?symbol=...&limit=... (limit defaults to
NEWS_LIMIT).
§Errors
See module-level errors.
Sourcepub async fn by_symbol_date_range(
&self,
endpoint: Endpoint,
symbol: &str,
from: Option<&str>,
to: Option<&str>,
) -> Result<Value>
pub async fn by_symbol_date_range( &self, endpoint: Endpoint, symbol: &str, from: Option<&str>, to: Option<&str>, ) -> Result<Value>
Sourcepub async fn by_date_range(
&self,
endpoint: Endpoint,
from: Option<&str>,
to: Option<&str>,
) -> Result<Value>
pub async fn by_date_range( &self, endpoint: Endpoint, from: Option<&str>, to: Option<&str>, ) -> Result<Value>
Sourcepub async fn by_name_date_range(
&self,
endpoint: Endpoint,
name: &str,
from: Option<&str>,
to: Option<&str>,
) -> Result<Value>
pub async fn by_name_date_range( &self, endpoint: Endpoint, name: &str, from: Option<&str>, to: Option<&str>, ) -> Result<Value>
Calls endpoint with a required name plus optional from and to dates.
§Errors
See module-level errors.
Sourcepub async fn annual(
&self,
endpoint: Endpoint,
symbol: &str,
limit: Option<u16>,
) -> Result<Value>
pub async fn annual( &self, endpoint: Endpoint, symbol: &str, limit: Option<u16>, ) -> Result<Value>
Calls an annual endpoint with symbol and limit (defaulting to
ANNUAL_LIMIT).
§Errors
See module-level errors.
Sourcepub async fn annual_report_form(
&self,
endpoint: Endpoint,
symbol: &str,
year: u16,
period: &str,
) -> Result<Value>
pub async fn annual_report_form( &self, endpoint: Endpoint, symbol: &str, year: u16, period: &str, ) -> Result<Value>
Calls an annual report form endpoint with symbol, year, and fiscal period.
§Errors
See module-level errors.
Sourcepub async fn technical(
&self,
endpoint: Endpoint,
symbol: &str,
period_length: u16,
timeframe: &str,
) -> Result<Value>
pub async fn technical( &self, endpoint: Endpoint, symbol: &str, period_length: u16, timeframe: &str, ) -> Result<Value>
Calls a technical indicator endpoint with symbol, periodLength,
and timeframe.
§Errors
See module-level errors.