schwab_cli/options/
schema.rs1use serde_json::{json, Value};
2
3use crate::options::types::StrategyKind;
4use crate::order_schema::{order_examples, order_schema_meta};
5
6pub fn options_schema() -> Value {
7 json!({
8 "meta": order_schema_meta(),
9 "strategies": {
10 "vertical": {
11 "description": "Two-leg vertical spread (put/call, credit/debit)",
12 "params": {
13 "underlying": "string",
14 "expiry": "YYYY-MM-DD",
15 "type": "put_credit | put_debit | call_credit | call_debit",
16 "short_strike": "number",
17 "long_strike": "number",
18 "contracts": "number",
19 "limit_credit": "number (credit spreads)",
20 "limit_debit": "number (debit spreads)"
21 },
22 "example": {
23 "underlying": "SPY",
24 "expiry": "2026-07-18",
25 "type": "put_credit",
26 "short_strike": 540,
27 "long_strike": 535,
28 "contracts": 2,
29 "limit_credit": 0.85
30 }
31 },
32 "iron_condor": {
33 "description": "Four-leg iron condor (defined risk)",
34 "params": {
35 "underlying": "string",
36 "expiry": "YYYY-MM-DD",
37 "put_short": "number",
38 "put_long": "number",
39 "call_short": "number",
40 "call_long": "number",
41 "contracts": "number",
42 "limit_credit": "number"
43 },
44 "example": {
45 "underlying": "SPY",
46 "expiry": "2026-08-15",
47 "put_short": 520,
48 "put_long": 515,
49 "call_short": 560,
50 "call_long": 565,
51 "contracts": 1,
52 "limit_credit": 1.20
53 }
54 }
55 },
56 "symbology": order_examples().get("optionSymbology").cloned().unwrap_or(json!(null)),
57 "workflow": [
58 "schwab options chain --symbol SPY --json",
59 "schwab options validate --strategy vertical --params '<json>' --json",
60 "schwab options preview --account-number <hash> --strategy vertical --params '<json>' --json",
61 "schwab options open --account-number <hash> --strategy vertical --params '<json>' --trust --yes --json"
62 ],
63 "allowed_strategies_v1": [
64 StrategyKind::Vertical.as_str(),
65 StrategyKind::IronCondor.as_str()
66 ]
67 })
68}