greed 0.5.2

A rust tool to automate trades 📈
Documentation
use clap::Args;
use greed::config::platform::PlatformType;
use greed::platform::args::PlatformArgs;

#[derive(Args, Debug)]
pub struct StatusArgs {
    /// Indicates if we should use a simulated financial platform instead of a live account.
    #[arg(short = 's', long)]
    pub is_simulated: bool,
    #[arg(short = 'p', long, default_value = "alpaca")]
    pub platform_type: PlatformType,
    /// Show full status including open positions and orders
    #[arg(short = 'f', long)]
    pub full: bool,
}

impl From<&StatusArgs> for PlatformArgs {
    fn from(value: &StatusArgs) -> Self {
        PlatformArgs {
            is_simulated: value.is_simulated,
        }
    }
}

#[cfg(test)]
mod test {
    use crate::cli::status::StatusArgs;
    use greed::platform::args::PlatformArgs;

    #[test]
    fn from() {
        let status_args = StatusArgs {
            is_simulated: true,
            platform_type: Default::default(),
            full: false,
        };
        let platform_args: PlatformArgs = PlatformArgs::from(&status_args);
        let expected = PlatformArgs { is_simulated: true };
        assert_eq!(platform_args, expected)
    }
}