schwab-developer 0.1.0

A library for Charles Schwab API.
Documentation
use serde::Serialize;

#[derive(Debug, Default, Serialize)]
pub struct QuotesParam {
    /**
     * Comma separated list of symbol(s) to look up a quote
     * 
     * Example : MRAD,EATOF,EBIZ,AAPL,BAC,AAAHX,AAAIX,$DJI,$SPX,MVEN,SOBS,TOITF,CNSWF,AMZN 230317C01360000,DJX 231215C00290000,/ESH23,./ADUF23C0.55,AUD/CAD
     */
    pub symbols: String,
    /**
     * Request for subset of data by passing coma separated list of root nodes, 
     * possible root nodes are quote, fundamental, extended, reference, regular.
     * Default value : all
     */
    pub fields: Option<String>,
    /**
     * Include indicative symbol quotes for all ETF symbols in request. 
     * If ETF symbol ABC is in request and indicative=true API will return quotes for ABC and its corresponding indicative quote for $ABC.IV
     */
    pub indicative: Option<bool>,
}

#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OptionChainParam {
    pub symbol: String,
    /**
     * Contract Type
     * Available values : CALL, PUT, ALL
     */
    pub contract_type: Option<String>,
    /**
     * The Number of strikes to return above or below the at-the-money price
     */
    pub strike_count: Option<i32>,
    /**
     * Underlying quotes to be included
     */
    pub include_underlying_quote: Option<bool>,
    /**
     * OptionChain strategy. Default is SINGLE. ANALYTICAL allows the use of volatility, underlyingPrice, interestRate, and daysToExpiration params to calculate theoretical values.
     * Available values : SINGLE, ANALYTICAL, COVERED, VERTICAL, CALENDAR, STRANGLE, STRADDLE, BUTTERFLY, CONDOR, DIAGONAL, COLLAR, ROLL
     */
    pub strategy: Option<String>,
    /**
     * Strike interval for spread strategy chains (see strategy param)
     */
    pub interval: Option<f64>,
    /**
     * Strike Price
     */
    pub strike: Option<f64>,
    /**
     * Range(ITM/NTM/OTM etc.)
     */
    pub range: Option<String>,
    /**
     * From date(pattern: yyyy-MM-dd)
     */
    pub from_date: Option<String>,
    /**
     * To date (pattern: yyyy-MM-dd)
     */
    pub to_date: Option<String>,
    /**
     * Volatility to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param)
     */
    pub volatility: Option<f64>,
    /**
     * Underlying price to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param)
     */
    pub underlying_price: Option<f64>,
    /**
     * Interest rate to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param)
     */
    pub interest_rate: Option<f64>,
    /**
     * Days to expiration to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param)
     */
    pub days_to_expiration: Option<i32>,
    /**
     * Expiration month
     * Available values : JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC, ALL
     */
    pub exp_month: Option<String>,
    /**
     * Option Type
     */
    pub option_type: Option<String>,
    /**
     * Applicable only if its retail token, entitlement of client PP-PayingPro, NP-NonPro and PN-NonPayingPro
     * Available values : PN, NP, PP
     */
    pub entitlement: Option<String> 
}

#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PriceHistoryParam {
    pub symbol: String,
    /**
     * The chart period being requested.
     * 
     * Available values : day, month, year, ytd
     */
    pub period_type: Option<String>,
    /**
     * The number of chart period types.
     * 
     * day - valid values are 1, 2, 3, 4, 5, 10. default period is 10.
     * month - valid values are 1, 2, 3, 6. default period is 1.
     * year - valid values are 1, 2, 3, 5, 10, 15, 20. default period is 1.
     * ytd - valid values are 1. default period is 1.
     */
    pub period: Option<i32>,
    /**
     * The time frequencyType
     * 
     * day - valid value is minute. defaulted to minute.
     * month - valid values are daily, weekly. defaulted to weekly.
     * year - valid values are daily, weekly, monthly. defaulted to monthly.
     * ytd - valid values are daily, weekly. defaulted to weekly.
     */
    pub frequency_type: Option<String>,
    /**
     * The time frequency duration
     * 
     * minute - valid values are 1, 5, 10, 15, 30. default value is 1
     * daily - valid value is 1
     * weekly - valid value is 1
     * monthly - valid value is 1
     */
    pub frequency: Option<i32>,
    /**
     * The start date, Time in milliseconds since the UNIX epoch eg 1451624400000
     * If not specified startDate will be (endDate - period) excluding weekends and holidays.
     */
    pub start_date: Option<i64>,
    /**
     * The end date, Time in milliseconds since the UNIX epoch eg 1451624400000
     * If not specified, the endDate will default to the market close of previous business day.
     */
    pub end_date: Option<i64>,
    /**
     * Need extended hours data
     */
    pub need_extended_hours_data: Option<bool>,
    /**
     * Need previous close price/date
     */
    pub need_previous_close: Option<bool>,
}

#[derive(Debug, Default, Serialize)]
pub struct MoversParam {
    #[serde(skip_serializing)]
    pub symbol_id: String,
    /**
     * Sort by a particular attribute
     * 
     * Available values : VOLUME, TRADES, PERCENT_CHANGE_UP, PERCENT_CHANGE_DOWN
     */
    pub sort: Option<String>,
    /**
     * To return movers with the specified directions of up or down
     * 
     * Available values : 0, 1, 5, 10, 30, 60
     * Default value : 0
     */
    pub frequency: Option<i32>
}

#[derive(Debug, Serialize)]
pub struct InstrumentsParam {
    /**
     * symbol of a security
     */
    pub symbol: String,
    /**
     * search by
     * 
     * Available values : symbol-search, symbol-regex, desc-search, desc-regex, search, fundamental
     */
    pub projection: String,
}