use clap::Subcommand;
use crate::cli::args::TechnicalSmaArgs;
use crate::cli::dispatch::run_technical_sma;
use crate::cli::help;
use crate::cli::output::CommandPayload;
use crate::client::FmpClient;
use crate::endpoint;
use crate::error::Result;
#[derive(Debug, Subcommand)]
pub(crate) enum Cmd {
#[command(about = help::TECHNICAL_SMA_ABOUT, long_about = help::TECHNICAL_SMA_LONG)]
Sma(TechnicalSmaArgs),
}
pub(crate) async fn dispatch(client: &FmpClient, cmd: &Cmd) -> Result<CommandPayload> {
match cmd {
Cmd::Sma(args) => {
run_technical_sma(
client,
endpoint::TECHNICAL_SMA,
&args.symbol,
args.period_length,
&args.timeframe,
)
.await
}
}
}