pub struct TechnicalIndicators { /* private fields */ }Expand description
Technical Indicators API endpoints
Implementations§
Source§impl TechnicalIndicators
impl TechnicalIndicators
Sourcepub async fn get_sma(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<SmaData>>
pub async fn get_sma( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<SmaData>>
Get Simple Moving Average (SMA)
Returns SMA values for a symbol over specified period.
§Arguments
symbol- Stock symbol (e.g., “AAPL”)period- Period for calculation (e.g., 20)from- Start date (optional, format: YYYY-MM-DD)to- End date (optional, format: YYYY-MM-DD)
§Example
let client = FmpClient::new()?;
let sma = client.technical_indicators().get_sma("AAPL", 20, None, None).await?;
for point in sma.iter().take(5) {
println!("{}: SMA20 = {:.2}", point.date, point.sma.unwrap_or(0.0));
}Sourcepub async fn get_ema(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<EmaData>>
pub async fn get_ema( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<EmaData>>
Get Exponential Moving Average (EMA)
Returns EMA values for a symbol over specified period.
§Arguments
symbol- Stock symbolperiod- Period for calculationfrom- Start date (optional)to- End date (optional)
§Example
let client = FmpClient::new()?;
let ema = client.technical_indicators().get_ema("AAPL", 12, None, None).await?;
for point in ema.iter().take(5) {
println!("{}: EMA12 = {:.2}", point.date, point.ema.unwrap_or(0.0));
}Sourcepub async fn get_wma(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<WmaData>>
pub async fn get_wma( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<WmaData>>
Get Weighted Moving Average (WMA)
Returns WMA values for a symbol over specified period.
§Arguments
symbol- Stock symbolperiod- Period for calculationfrom- Start date (optional)to- End date (optional)
Sourcepub async fn get_dema(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<DemaData>>
pub async fn get_dema( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<DemaData>>
Get Double Exponential Moving Average (DEMA)
Sourcepub async fn get_tema(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<TemaData>>
pub async fn get_tema( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<TemaData>>
Get Triple Exponential Moving Average (TEMA)
Sourcepub async fn get_rsi(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<RsiData>>
pub async fn get_rsi( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<RsiData>>
Get Relative Strength Index (RSI)
Returns RSI values (0-100 scale) for momentum analysis.
§Example
let client = FmpClient::new()?;
let rsi = client.technical_indicators().get_rsi("AAPL", 14, None, None).await?;
for point in rsi.iter().take(5) {
let rsi_val = point.rsi.unwrap_or(0.0);
let signal = if rsi_val > 70.0 { "Overbought" }
else if rsi_val < 30.0 { "Oversold" }
else { "Neutral" };
println!("{}: RSI = {:.1} ({})", point.date, rsi_val, signal);
}Sourcepub async fn get_adx(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<AdxData>>
pub async fn get_adx( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<AdxData>>
Get Average Directional Index (ADX)
Sourcepub async fn get_standardized(
&self,
symbol: &str,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<StandardizedIndicator>>
pub async fn get_standardized( &self, symbol: &str, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<StandardizedIndicator>>
Get standardized technical data
Sourcepub async fn get_williams_r(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<WilliamsRData>>
pub async fn get_williams_r( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<WilliamsRData>>
Get Williams %R indicator
Sourcepub async fn get_cci(
&self,
symbol: &str,
period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<CciData>>
pub async fn get_cci( &self, symbol: &str, period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<CciData>>
Get Commodity Channel Index (CCI)
Sourcepub async fn get_macd(
&self,
symbol: &str,
fast_period: u32,
slow_period: u32,
signal_period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<MacdData>>
pub async fn get_macd( &self, symbol: &str, fast_period: u32, slow_period: u32, signal_period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<MacdData>>
Get MACD (Moving Average Convergence Divergence)
Returns MACD line, signal line, and histogram for trend analysis.
§Example
let client = FmpClient::new()?;
let macd = client.technical_indicators().get_macd("AAPL", 12, 26, 9, None, None).await?;
for point in macd.iter().take(5) {
if let (Some(macd_val), Some(signal)) = (point.macd, point.signal) {
let signal_type = if macd_val > signal { "Bullish" } else { "Bearish" };
println!("{}: MACD={:.3}, Signal={:.3} ({})",
point.date, macd_val, signal, signal_type);
}
}Sourcepub async fn get_stochastic(
&self,
symbol: &str,
k_period: u32,
d_period: u32,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<StochasticData>>
pub async fn get_stochastic( &self, symbol: &str, k_period: u32, d_period: u32, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<StochasticData>>
Get Stochastic Oscillator
Sourcepub async fn get_bollinger_bands(
&self,
symbol: &str,
period: u32,
std_dev: f64,
from: Option<&str>,
to: Option<&str>,
) -> Result<Vec<BollingerBandsData>>
pub async fn get_bollinger_bands( &self, symbol: &str, period: u32, std_dev: f64, from: Option<&str>, to: Option<&str>, ) -> Result<Vec<BollingerBandsData>>
Get Bollinger Bands
Returns upper band, middle band (SMA), and lower band for volatility analysis.
§Example
let client = FmpClient::new()?;
let bb = client.technical_indicators().get_bollinger_bands("AAPL", 20, 2.0, None, None).await?;
for point in bb.iter().take(5) {
if let (Some(upper), Some(middle), Some(lower)) =
(point.upper_band, point.middle_band, point.lower_band) {
println!("{}: Upper={:.2}, Middle={:.2}, Lower={:.2}",
point.date, upper, middle, lower);
}
}