alpaca-sdk 0.1.0

Unofficial Rust SDK for the Alpaca trading, market data, and broker APIs
Documentation
//! Enums shared by more than one API surface.
//!
//! They live here so a module can use one without depending on the feature that
//! would otherwise own it: `data` needs `ContractType` and must build with
//! `trading` off. Each is re-exported from the surface it belongs to, so the
//! public path is the one a caller would guess.
//!
//! `PaginationType` is deliberately absent: its three modes are expressed here as
//! a `Stream` plus `try_collect`, so an enum selecting between them would have
//! nothing to select.

use crate::types::wire::wire_enum;

wire_enum! {
    /// Sort direction for endpoints that accept one.
    pub enum Sort {
        /// Oldest first.
        Asc => "asc",
        /// Newest first.
        Desc => "desc",
    }
}

wire_enum! {
    /// Currencies supported for local currency trading.
    ///
    /// See <https://docs.alpaca.markets/us/docs/local-currency-trading-lct>.
    pub enum SupportedCurrencies {
        /// United States dollar.
        Usd => "USD",
        /// Pound sterling.
        Gbp => "GBP",
        /// Swiss franc.
        Chf => "CHF",
        /// Euro.
        Eur => "EUR",
        /// Canadian dollar.
        Cad => "CAD",
        /// Japanese yen.
        Jpy => "JPY",
        /// Turkish lira.
        Try => "TRY",
        /// Australian dollar.
        Aud => "AUD",
        /// Czech koruna.
        Czk => "CZK",
        /// Swedish krona.
        Sek => "SEK",
        /// Danish krone.
        Dkk => "DKK",
        /// Singapore dollar.
        Sgd => "SGD",
        /// Hong Kong dollar.
        Hkd => "HKD",
        /// Hungarian forint.
        Huf => "HUF",
        /// New Zealand dollar.
        Nzd => "NZD",
        /// Norwegian krone.
        Nok => "NOK",
        /// Polish złoty.
        Pln => "PLN",
    }
}

wire_enum! {
    /// Whether an options contract is a call or a put.
    pub enum ContractType {
        /// The right to buy the underlying.
        Call => "call",
        /// The right to sell the underlying.
        Put => "put",
    }
}