Skip to main content

futucli/cli/dispatch/
qot.rs

1use anyhow::Result;
2
3use super::super::commands::{
4    BrokerArgs, CapitalFlowArgs, CompanyExecutiveBackgroundArgs, CompanyExecutivesArgs,
5    CompanyOperationalEfficiencyArgs, CompanyProfileArgs, CorporateActionsBuybacksArgs,
6    CorporateActionsDividendsArgs, CorporateActionsStockSplitsArgs, DailyShortVolumeArgs,
7    DerivativeUnusualArgs, FinancialCalendarArgs, FinancialCalendarTargetArgs,
8    FinancialUnusualArgs, FinancialsEarningsPriceHistoryArgs, FinancialsEarningsPriceMoveArgs,
9    FinancialsRevenueBreakdownArgs, FinancialsStatementsArgs, IndicatorListArgs,
10    InsiderHolderListArgs, InsiderTradeListArgs, IpoCalendarArgs, KlineArgs,
11    OptionExerciseProbabilityArgs, OptionScreenArgs, OptionVolatilityArgs, OrderbookArgs,
12    PlateListArgs, PlateStocksArgs, ProtoJsonArgs, QuoteArgs, ReferenceArgs,
13    ResearchAnalystConsensusArgs, ResearchMorningstarReportArgs, ResearchRatingSummaryArgs, RtArgs,
14    ShareholdersHolderDetailArgs, ShareholdersHoldingChangesArgs, ShareholdersInstitutionalArgs,
15    ShareholdersOverviewArgs, ShortInterestArgs, SnapshotArgs, StaticArgs, StockScreenArgs,
16    SubArgs, TechnicalUnusualArgs, TickerArgs, TopTenBuySellBrokersArgs, ValuationDetailArgs,
17    ValuationPlateStockListArgs, WarrantScreenArgs,
18};
19use crate::cmd;
20use crate::output::OutputFormat;
21
22pub(super) async fn dispatch_quote(
23    gateway: &str,
24    output: OutputFormat,
25    args: QuoteArgs,
26) -> Result<()> {
27    cmd::quote::run(gateway, &args.symbols, output).await
28}
29
30pub(super) async fn dispatch_snapshot(
31    gateway: &str,
32    output: OutputFormat,
33    args: SnapshotArgs,
34) -> Result<()> {
35    cmd::snapshot::run(gateway, &args.symbols, output).await
36}
37
38pub(super) async fn dispatch_sub(gateway: &str, output: OutputFormat, args: SubArgs) -> Result<()> {
39    cmd::sub::run(
40        gateway,
41        &args.symbols,
42        &args.r#type,
43        args.extended_time,
44        args.session.as_deref(),
45        args.orderbook_detail,
46        output,
47    )
48    .await
49}
50
51pub(super) async fn dispatch_kline(
52    gateway: &str,
53    output: OutputFormat,
54    args: KlineArgs,
55) -> Result<()> {
56    // v1.4.83 §10: positional 或 --symbol/--code/--stock flag 二选一
57    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
58        anyhow::anyhow!(
59            "kline: 需要 positional <SYMBOL> 或 --symbol/--code/--stock \
60             (如 `futucli kline US.AAPL` 或 `futucli kline --code US.AAPL`)"
61        )
62    })?;
63    cmd::kline::run_with_format(
64        gateway,
65        &symbol,
66        &args.r#type,
67        args.count,
68        &args.rehab_type,
69        args.page_size,
70        args.next_req_key.as_deref(),
71        args.need_kl_fields_flag,
72        args.extended_time,
73        args.session.as_deref(),
74        args.begin.as_deref(),
75        args.end.as_deref(),
76        output,
77    )
78    .await
79}
80
81pub(super) async fn dispatch_orderbook(
82    gateway: &str,
83    output: OutputFormat,
84    args: OrderbookArgs,
85) -> Result<()> {
86    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
87        anyhow::anyhow!("orderbook: 需要 positional <SYMBOL> 或 --symbol/--code/--stock")
88    })?;
89    cmd::orderbook::run(gateway, &symbol, args.depth, args.odd_lot, output).await
90}
91
92pub(super) async fn dispatch_ticker(
93    gateway: &str,
94    output: OutputFormat,
95    args: TickerArgs,
96) -> Result<()> {
97    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
98        anyhow::anyhow!("ticker: 需要 positional <SYMBOL> 或 --symbol/--code/--stock")
99    })?;
100    cmd::ticker::run(gateway, &symbol, args.count, output).await
101}
102
103pub(super) async fn dispatch_rt(gateway: &str, output: OutputFormat, args: RtArgs) -> Result<()> {
104    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
105        anyhow::anyhow!("rt: 需要 positional <SYMBOL> 或 --symbol/--code/--stock")
106    })?;
107    cmd::rt::run(gateway, &symbol, output).await
108}
109
110pub(super) async fn dispatch_static(
111    gateway: &str,
112    output: OutputFormat,
113    args: StaticArgs,
114) -> Result<()> {
115    cmd::static_info::run(gateway, &args.symbols, output).await
116}
117
118pub(super) async fn dispatch_broker(
119    gateway: &str,
120    output: OutputFormat,
121    args: BrokerArgs,
122) -> Result<()> {
123    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
124        anyhow::anyhow!("broker: 需要 positional <SYMBOL> 或 --symbol/--code/--stock")
125    })?;
126    cmd::broker::run(gateway, &symbol, output).await
127}
128
129pub(super) async fn dispatch_plate_list(
130    gateway: &str,
131    output: OutputFormat,
132    args: PlateListArgs,
133) -> Result<()> {
134    cmd::plate::list(gateway, &args.market, &args.set, output).await
135}
136
137pub(super) async fn dispatch_plate_stocks(
138    gateway: &str,
139    output: OutputFormat,
140    args: PlateStocksArgs,
141) -> Result<()> {
142    let plate = args
143        .plate
144        .or(args.plate_arg)
145        .ok_or_else(|| anyhow::anyhow!("plate-stocks: 需要位置参数 <PLATE> 或 --plate"))?;
146    cmd::plate::stocks(gateway, &plate, output).await
147}
148
149pub(super) async fn dispatch_reference(
150    gateway: &str,
151    output: OutputFormat,
152    args: ReferenceArgs,
153) -> Result<()> {
154    let symbol = args.symbol_positional.or(args.symbol_arg).ok_or_else(|| {
155        anyhow::anyhow!("reference: 需要位置参数 <SYMBOL> 或 --symbol/--code/--stock")
156    })?;
157    cmd::analysis::run_reference(gateway, &symbol, &args.reference_type, output).await
158}
159
160pub(super) async fn dispatch_option_quote(
161    gateway: &str,
162    output: OutputFormat,
163    args: ProtoJsonArgs,
164) -> Result<()> {
165    cmd::proto_json::run_option_quote(gateway, &args.c2s_json, output).await
166}
167
168pub(super) async fn dispatch_option_strategy(
169    gateway: &str,
170    output: OutputFormat,
171    args: ProtoJsonArgs,
172) -> Result<()> {
173    cmd::proto_json::run_option_strategy(gateway, &args.c2s_json, output).await
174}
175
176pub(super) async fn dispatch_option_strategy_analysis(
177    gateway: &str,
178    output: OutputFormat,
179    args: ProtoJsonArgs,
180) -> Result<()> {
181    cmd::proto_json::run_option_strategy_analysis(gateway, &args.c2s_json, output).await
182}
183
184pub(super) async fn dispatch_option_strategy_spread(
185    gateway: &str,
186    output: OutputFormat,
187    args: ProtoJsonArgs,
188) -> Result<()> {
189    cmd::proto_json::run_option_strategy_spread(gateway, &args.c2s_json, output).await
190}
191
192macro_rules! qot_proto_json_dispatch {
193    ($fn_name:ident, $runner:ident) => {
194        pub(super) async fn $fn_name(
195            gateway: &str,
196            output: OutputFormat,
197            args: ProtoJsonArgs,
198        ) -> Result<()> {
199            cmd::proto_json::$runner(gateway, &args.c2s_json, output).await
200        }
201    };
202}
203
204qot_proto_json_dispatch!(dispatch_earnings_calendar, run_earnings_calendar);
205qot_proto_json_dispatch!(dispatch_macro_indicator_list, run_macro_indicator_list);
206qot_proto_json_dispatch!(
207    dispatch_security_trading_sessions,
208    run_security_trading_sessions
209);
210qot_proto_json_dispatch!(
211    dispatch_market_trading_sessions,
212    run_market_trading_sessions
213);
214qot_proto_json_dispatch!(dispatch_kline_pattern, run_kline_pattern);
215qot_proto_json_dispatch!(
216    dispatch_kline_pattern_statistics,
217    run_kline_pattern_statistics
218);
219qot_proto_json_dispatch!(dispatch_kline_pattern_stocks, run_kline_pattern_stocks);
220qot_proto_json_dispatch!(
221    dispatch_kline_pattern_performance,
222    run_kline_pattern_performance
223);
224qot_proto_json_dispatch!(dispatch_kline_pattern_catalog, run_kline_pattern_catalog);
225qot_proto_json_dispatch!(dispatch_hot_news, run_hot_news);
226qot_proto_json_dispatch!(dispatch_latest_news, run_latest_news);
227qot_proto_json_dispatch!(dispatch_watchlist_news, run_watchlist_news);
228qot_proto_json_dispatch!(dispatch_watchlist_announcement, run_watchlist_announcement);
229qot_proto_json_dispatch!(dispatch_watchlist_rating, run_watchlist_rating);
230qot_proto_json_dispatch!(dispatch_stock_news, run_stock_news);
231qot_proto_json_dispatch!(dispatch_etf_screen, run_etf_screen);
232qot_proto_json_dispatch!(dispatch_fund_screen, run_fund_screen);
233qot_proto_json_dispatch!(dispatch_future_screen, run_future_screen);
234qot_proto_json_dispatch!(dispatch_bond_screen, run_bond_screen);
235
236pub(super) async fn dispatch_indicator_list(
237    gateway: &str,
238    output: OutputFormat,
239    args: IndicatorListArgs,
240) -> Result<()> {
241    cmd::proto_json::run_indicator_list(gateway, &args.c2s_json, output).await
242}
243
244qot_proto_json_dispatch!(
245    dispatch_macro_indicator_history,
246    run_macro_indicator_history
247);
248qot_proto_json_dispatch!(dispatch_fed_watch_target_rate, run_fed_watch_target_rate);
249qot_proto_json_dispatch!(dispatch_fed_watch_dot_plot, run_fed_watch_dot_plot);
250qot_proto_json_dispatch!(dispatch_earnings_beat_rank, run_earnings_beat_rank);
251qot_proto_json_dispatch!(dispatch_dividend_rank, run_dividend_rank);
252qot_proto_json_dispatch!(dispatch_dividend_calendar, run_dividend_calendar);
253qot_proto_json_dispatch!(dispatch_economic_calendar, run_economic_calendar);
254qot_proto_json_dispatch!(dispatch_us_pre_market_rank, run_us_pre_market_rank);
255qot_proto_json_dispatch!(dispatch_us_after_hours_rank, run_us_after_hours_rank);
256qot_proto_json_dispatch!(dispatch_us_overnight_rank, run_us_overnight_rank);
257qot_proto_json_dispatch!(dispatch_top_movers_rank, run_top_movers_rank);
258qot_proto_json_dispatch!(dispatch_hot_list, run_hot_list);
259qot_proto_json_dispatch!(dispatch_short_selling_rank, run_short_selling_rank);
260qot_proto_json_dispatch!(dispatch_period_change_rank, run_period_change_rank);
261qot_proto_json_dispatch!(dispatch_high_dividend_soe_rank, run_high_dividend_soe_rank);
262qot_proto_json_dispatch!(dispatch_institution_list, run_institution_list);
263qot_proto_json_dispatch!(dispatch_institution_profile, run_institution_profile);
264qot_proto_json_dispatch!(
265    dispatch_institution_distribution,
266    run_institution_distribution
267);
268qot_proto_json_dispatch!(
269    dispatch_institution_holding_change,
270    run_institution_holding_change
271);
272qot_proto_json_dispatch!(
273    dispatch_institution_holding_list,
274    run_institution_holding_list
275);
276qot_proto_json_dispatch!(dispatch_ark_fund_holding, run_ark_fund_holding);
277qot_proto_json_dispatch!(dispatch_ark_stock_dynamic, run_ark_stock_dynamic);
278qot_proto_json_dispatch!(dispatch_ark_active_transaction, run_ark_active_transaction);
279qot_proto_json_dispatch!(dispatch_rating_change, run_rating_change);
280qot_proto_json_dispatch!(dispatch_search_quote, run_search_quote);
281qot_proto_json_dispatch!(dispatch_search_news, run_search_news);
282qot_proto_json_dispatch!(
283    dispatch_option_market_statistic,
284    run_option_market_statistic
285);
286qot_proto_json_dispatch!(
287    dispatch_option_underlying_his_statistic,
288    run_option_underlying_his_statistic
289);
290qot_proto_json_dispatch!(
291    dispatch_option_underlying_overview,
292    run_option_underlying_overview
293);
294qot_proto_json_dispatch!(
295    dispatch_option_underlying_his_volatility,
296    run_option_underlying_his_volatility
297);
298qot_proto_json_dispatch!(dispatch_option_underlying_rank, run_option_underlying_rank);
299qot_proto_json_dispatch!(dispatch_option_rank, run_option_rank);
300qot_proto_json_dispatch!(dispatch_option_event, run_option_event);
301qot_proto_json_dispatch!(dispatch_option_event_alert, run_option_event_alert);
302qot_proto_json_dispatch!(dispatch_set_option_event_alert, run_set_option_event_alert);
303qot_proto_json_dispatch!(
304    dispatch_option_zero_dte_screener,
305    run_option_zero_dte_screener
306);
307qot_proto_json_dispatch!(
308    dispatch_option_zero_dte_contract,
309    run_option_zero_dte_contract
310);
311qot_proto_json_dispatch!(
312    dispatch_option_earnings_screener,
313    run_option_earnings_screener
314);
315qot_proto_json_dispatch!(dispatch_option_seller_screener, run_option_seller_screener);
316qot_proto_json_dispatch!(dispatch_industrial_chain_list, run_industrial_chain_list);
317qot_proto_json_dispatch!(
318    dispatch_industrial_chain_detail,
319    run_industrial_chain_detail
320);
321qot_proto_json_dispatch!(
322    dispatch_industrial_chain_by_plate,
323    run_industrial_chain_by_plate
324);
325qot_proto_json_dispatch!(dispatch_industrial_plate_info, run_industrial_plate_info);
326qot_proto_json_dispatch!(dispatch_industrial_plate_stock, run_industrial_plate_stock);
327qot_proto_json_dispatch!(dispatch_heat_map_data, run_heat_map_data);
328qot_proto_json_dispatch!(dispatch_rise_fall_distribution, run_rise_fall_distribution);
329
330pub(super) async fn dispatch_capital_flow(
331    gateway: &str,
332    output: OutputFormat,
333    args: CapitalFlowArgs,
334) -> Result<()> {
335    cmd::analysis::run_capital_flow(
336        gateway,
337        &args.symbol,
338        args.period_type,
339        args.begin.as_deref(),
340        args.end.as_deref(),
341        output,
342    )
343    .await
344}
345
346pub(super) async fn dispatch_company_profile(
347    gateway: &str,
348    output: OutputFormat,
349    args: CompanyProfileArgs,
350) -> Result<()> {
351    cmd::analysis::run_company_profile(gateway, &args.symbol, output).await
352}
353
354pub(super) async fn dispatch_company_executives(
355    gateway: &str,
356    output: OutputFormat,
357    args: CompanyExecutivesArgs,
358) -> Result<()> {
359    cmd::analysis::run_company_executives(gateway, &args.symbol, output).await
360}
361
362pub(super) async fn dispatch_company_executive_background(
363    gateway: &str,
364    output: OutputFormat,
365    args: CompanyExecutiveBackgroundArgs,
366) -> Result<()> {
367    cmd::analysis::run_company_executive_background(
368        gateway,
369        &args.symbol,
370        &args.leader_name,
371        output,
372    )
373    .await
374}
375
376pub(super) async fn dispatch_company_operational_efficiency(
377    gateway: &str,
378    output: OutputFormat,
379    args: CompanyOperationalEfficiencyArgs,
380) -> Result<()> {
381    cmd::analysis::run_company_operational_efficiency(
382        gateway,
383        &args.symbol,
384        args.next_key.as_deref(),
385        args.num,
386        args.currency_code.as_deref(),
387        args.financial_type,
388        output,
389    )
390    .await
391}
392
393pub(super) async fn dispatch_financials_earnings_price_move(
394    gateway: &str,
395    output: OutputFormat,
396    args: FinancialsEarningsPriceMoveArgs,
397) -> Result<()> {
398    cmd::analysis::run_financials_earnings_price_move(
399        gateway,
400        &args.symbol,
401        args.period_count,
402        output,
403    )
404    .await
405}
406
407pub(super) async fn dispatch_financials_earnings_price_history(
408    gateway: &str,
409    output: OutputFormat,
410    args: FinancialsEarningsPriceHistoryArgs,
411) -> Result<()> {
412    cmd::analysis::run_financials_earnings_price_history(gateway, &args.symbol, output).await
413}
414
415pub(super) async fn dispatch_financial_calendar(
416    gateway: &str,
417    output: OutputFormat,
418    args: FinancialCalendarArgs,
419) -> Result<()> {
420    cmd::analysis::run_financial_calendar(
421        gateway,
422        cmd::analysis::FinancialCalendarCommand {
423            begin_date: &args.begin_date,
424            end_date: &args.end_date,
425            markets: &args.markets,
426            pub_types: &args.pub_types,
427            stock_types: &args.stock_types,
428            count: Some(args.count),
429            ranking_type: args.ranking_type,
430            estimate_types: &args.estimate_types,
431            custom_filters: &args.custom_filters,
432            watchlist_only: args.watchlist_only,
433            positions_only: args.positions_only,
434            watchlist_stock_ids: &args.watchlist_stock_ids,
435            holding_stock_ids: &args.holding_stock_ids,
436        },
437        output,
438    )
439    .await
440}
441
442pub(super) async fn dispatch_financial_calendar_target(
443    gateway: &str,
444    output: OutputFormat,
445    args: FinancialCalendarTargetArgs,
446) -> Result<()> {
447    cmd::analysis::run_financial_calendar_target(
448        gateway,
449        cmd::analysis::FinancialCalendarTargetCommand {
450            stock_ids: &args.stock_ids,
451            markets: &args.markets,
452            size: args.size,
453            start: args.start,
454        },
455        output,
456    )
457    .await
458}
459
460pub(super) async fn dispatch_ipo_calendar(
461    gateway: &str,
462    output: OutputFormat,
463    args: IpoCalendarArgs,
464) -> Result<()> {
465    cmd::analysis::run_ipo_calendar(
466        gateway,
467        &args.market,
468        &args.events,
469        args.begin_date.as_deref(),
470        args.end_date.as_deref(),
471        output,
472    )
473    .await
474}
475
476pub(super) async fn dispatch_financials_statements(
477    gateway: &str,
478    output: OutputFormat,
479    args: FinancialsStatementsArgs,
480) -> Result<()> {
481    cmd::analysis::run_financials_statements(
482        gateway,
483        &args.symbol,
484        args.statement_type,
485        args.financial_type,
486        args.currency_code.as_deref(),
487        args.next_key.as_deref(),
488        args.num,
489        output,
490    )
491    .await
492}
493
494pub(super) async fn dispatch_financials_revenue_breakdown(
495    gateway: &str,
496    output: OutputFormat,
497    args: FinancialsRevenueBreakdownArgs,
498) -> Result<()> {
499    cmd::analysis::run_financials_revenue_breakdown(
500        gateway,
501        &args.symbol,
502        args.date,
503        args.financial_type,
504        args.currency_code.as_deref(),
505        output,
506    )
507    .await
508}
509
510pub(super) async fn dispatch_research_analyst_consensus(
511    gateway: &str,
512    output: OutputFormat,
513    args: ResearchAnalystConsensusArgs,
514) -> Result<()> {
515    cmd::analysis::run_research_analyst_consensus(gateway, &args.symbol, output).await
516}
517
518pub(super) async fn dispatch_research_rating_summary(
519    gateway: &str,
520    output: OutputFormat,
521    args: ResearchRatingSummaryArgs,
522) -> Result<()> {
523    cmd::analysis::run_research_rating_summary(
524        gateway,
525        &args.symbol,
526        args.rating_dimension_type,
527        args.uid.as_deref(),
528        args.next_key.as_deref(),
529        args.num,
530        output,
531    )
532    .await
533}
534
535pub(super) async fn dispatch_research_morningstar_report(
536    gateway: &str,
537    output: OutputFormat,
538    args: ResearchMorningstarReportArgs,
539) -> Result<()> {
540    cmd::analysis::run_research_morningstar_report(gateway, &args.symbol, output).await
541}
542
543pub(super) async fn dispatch_valuation_detail(
544    gateway: &str,
545    output: OutputFormat,
546    args: ValuationDetailArgs,
547) -> Result<()> {
548    cmd::analysis::run_valuation_detail(
549        gateway,
550        &args.symbol,
551        args.valuation_type,
552        args.interval_type,
553        output,
554    )
555    .await
556}
557
558pub(super) async fn dispatch_valuation_plate_stock_list(
559    gateway: &str,
560    output: OutputFormat,
561    args: ValuationPlateStockListArgs,
562) -> Result<()> {
563    cmd::analysis::run_valuation_plate_stock_list(
564        gateway,
565        &args.symbol,
566        args.valuation_type,
567        args.next_key.as_deref(),
568        args.num,
569        args.sort_type,
570        args.sort_id,
571        args.filter_security.as_deref(),
572        output,
573    )
574    .await
575}
576
577pub(super) async fn dispatch_stock_screen(
578    gateway: &str,
579    output: OutputFormat,
580    args: StockScreenArgs,
581) -> Result<()> {
582    cmd::analysis::run_stock_screen(gateway, &args.c2s_json, output).await
583}
584
585pub(super) async fn dispatch_option_screen(
586    gateway: &str,
587    output: OutputFormat,
588    args: OptionScreenArgs,
589) -> Result<()> {
590    cmd::analysis::run_option_screen(gateway, &args.c2s_json, output).await
591}
592
593pub(super) async fn dispatch_warrant_screen(
594    gateway: &str,
595    output: OutputFormat,
596    args: WarrantScreenArgs,
597) -> Result<()> {
598    cmd::analysis::run_warrant_screen(gateway, &args.c2s_json, output).await
599}
600
601pub(super) async fn dispatch_technical_unusual(
602    gateway: &str,
603    output: OutputFormat,
604    args: TechnicalUnusualArgs,
605) -> Result<()> {
606    cmd::analysis::run_technical_unusual(
607        gateway,
608        &args.stock_symbol,
609        args.time_range,
610        args.indicator_filters,
611        args.language_id,
612        output,
613    )
614    .await
615}
616
617pub(super) async fn dispatch_financial_unusual(
618    gateway: &str,
619    output: OutputFormat,
620    args: FinancialUnusualArgs,
621) -> Result<()> {
622    cmd::analysis::run_financial_unusual(
623        gateway,
624        &args.stock_symbol,
625        args.time_range,
626        args.analysis_dimensions,
627        args.language_id,
628        output,
629    )
630    .await
631}
632
633pub(super) async fn dispatch_derivative_unusual(
634    gateway: &str,
635    output: OutputFormat,
636    args: DerivativeUnusualArgs,
637) -> Result<()> {
638    cmd::analysis::run_derivative_unusual(
639        gateway,
640        &args.stock_symbol,
641        args.time_range,
642        args.analysis_dimensions,
643        args.language_id,
644        output,
645    )
646    .await
647}
648
649pub(super) async fn dispatch_corporate_actions_buybacks(
650    gateway: &str,
651    output: OutputFormat,
652    args: CorporateActionsBuybacksArgs,
653) -> Result<()> {
654    cmd::analysis::run_corporate_actions_buybacks(
655        gateway,
656        &args.symbol,
657        args.next_key.as_deref(),
658        args.num,
659        output,
660    )
661    .await
662}
663
664pub(super) async fn dispatch_corporate_actions_dividends(
665    gateway: &str,
666    output: OutputFormat,
667    args: CorporateActionsDividendsArgs,
668) -> Result<()> {
669    cmd::analysis::run_corporate_actions_dividends(gateway, &args.symbol, output).await
670}
671
672pub(super) async fn dispatch_corporate_actions_stock_splits(
673    gateway: &str,
674    output: OutputFormat,
675    args: CorporateActionsStockSplitsArgs,
676) -> Result<()> {
677    cmd::analysis::run_corporate_actions_stock_splits(
678        gateway,
679        &args.symbol,
680        args.next_key.as_deref(),
681        args.num,
682        output,
683    )
684    .await
685}
686
687pub(super) async fn dispatch_daily_short_volume(
688    gateway: &str,
689    output: OutputFormat,
690    args: DailyShortVolumeArgs,
691) -> Result<()> {
692    cmd::analysis::run_daily_short_volume(
693        gateway,
694        &args.symbol,
695        args.next_key.as_deref(),
696        args.num,
697        output,
698    )
699    .await
700}
701
702pub(super) async fn dispatch_short_interest(
703    gateway: &str,
704    output: OutputFormat,
705    args: ShortInterestArgs,
706) -> Result<()> {
707    cmd::analysis::run_short_interest(
708        gateway,
709        &args.symbol,
710        args.next_key.as_deref(),
711        args.num,
712        output,
713    )
714    .await
715}
716
717pub(super) async fn dispatch_top_ten_buy_sell_brokers(
718    gateway: &str,
719    output: OutputFormat,
720    args: TopTenBuySellBrokersArgs,
721) -> Result<()> {
722    cmd::analysis::run_top_ten_buy_sell_brokers(gateway, &args.symbol, args.days_before, output)
723        .await
724}
725
726pub(super) async fn dispatch_shareholders_overview(
727    gateway: &str,
728    output: OutputFormat,
729    args: ShareholdersOverviewArgs,
730) -> Result<()> {
731    cmd::analysis::run_shareholders_overview(gateway, &args.symbol, args.period_id, output).await
732}
733
734pub(super) async fn dispatch_shareholders_holding_changes(
735    gateway: &str,
736    output: OutputFormat,
737    args: ShareholdersHoldingChangesArgs,
738) -> Result<()> {
739    cmd::analysis::run_shareholders_holding_changes(
740        cmd::analysis::ShareholdersHoldingChangesCommand {
741            gateway,
742            symbol: &args.symbol,
743            next_key: args.next_key,
744            num: args.num,
745            sort_type: args.sort_type,
746            sort_column: args.sort_column,
747            filter_type: args.filter_type,
748            format: output,
749        },
750    )
751    .await
752}
753
754pub(super) async fn dispatch_shareholders_holder_detail(
755    gateway: &str,
756    output: OutputFormat,
757    args: ShareholdersHolderDetailArgs,
758) -> Result<()> {
759    cmd::analysis::run_shareholders_holder_detail(cmd::analysis::ShareholdersHolderDetailCommand {
760        gateway,
761        symbol: &args.symbol,
762        request_type: args.request_type,
763        next_key: args.next_key,
764        num: args.num,
765        sort_column: args.sort_column,
766        sort_type: args.sort_type,
767        period_id: args.period_id,
768        holder_id: args.holder_id,
769        format: output,
770    })
771    .await
772}
773
774pub(super) async fn dispatch_shareholders_institutional(
775    gateway: &str,
776    output: OutputFormat,
777    args: ShareholdersInstitutionalArgs,
778) -> Result<()> {
779    cmd::analysis::run_shareholders_institutional(
780        gateway,
781        &args.symbol,
782        args.next_key,
783        args.num,
784        output,
785    )
786    .await
787}
788
789pub(super) async fn dispatch_insider_holder_list(
790    gateway: &str,
791    output: OutputFormat,
792    args: InsiderHolderListArgs,
793) -> Result<()> {
794    cmd::analysis::run_insider_holder_list(gateway, &args.symbol, args.next_key, args.num, output)
795        .await
796}
797
798pub(super) async fn dispatch_insider_trade_list(
799    gateway: &str,
800    output: OutputFormat,
801    args: InsiderTradeListArgs,
802) -> Result<()> {
803    cmd::analysis::run_insider_trade_list(
804        gateway,
805        &args.symbol,
806        args.holder_id,
807        args.next_key,
808        args.num,
809        output,
810    )
811    .await
812}
813
814pub(super) async fn dispatch_option_volatility(
815    gateway: &str,
816    output: OutputFormat,
817    args: OptionVolatilityArgs,
818) -> Result<()> {
819    cmd::analysis::run_option_volatility(
820        gateway,
821        &args.symbol,
822        args.query_time_period,
823        args.hv_time_period,
824        output,
825    )
826    .await
827}
828
829pub(super) async fn dispatch_option_exercise_probability(
830    gateway: &str,
831    output: OutputFormat,
832    args: OptionExerciseProbabilityArgs,
833) -> Result<()> {
834    cmd::analysis::run_option_exercise_probability(gateway, &args.symbol, output).await
835}