dsa-server 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dsa_server-0.1.0/LICENSE +21 -0
- dsa_server-0.1.0/PKG-INFO +243 -0
- dsa_server-0.1.0/README.md +201 -0
- dsa_server-0.1.0/pyproject.toml +81 -0
- dsa_server-0.1.0/setup.cfg +50 -0
- dsa_server-0.1.0/src/__init__.py +0 -0
- dsa_server-0.1.0/src/agent/__init__.py +53 -0
- dsa_server-0.1.0/src/agent/agents/__init__.py +23 -0
- dsa_server-0.1.0/src/agent/agents/base_agent.py +286 -0
- dsa_server-0.1.0/src/agent/agents/decision_agent.py +232 -0
- dsa_server-0.1.0/src/agent/agents/intel_agent.py +118 -0
- dsa_server-0.1.0/src/agent/agents/portfolio_agent.py +154 -0
- dsa_server-0.1.0/src/agent/agents/risk_agent.py +128 -0
- dsa_server-0.1.0/src/agent/agents/technical_agent.py +103 -0
- dsa_server-0.1.0/src/agent/chat_context.py +483 -0
- dsa_server-0.1.0/src/agent/conversation.py +113 -0
- dsa_server-0.1.0/src/agent/events.py +563 -0
- dsa_server-0.1.0/src/agent/executor.py +819 -0
- dsa_server-0.1.0/src/agent/factory.py +397 -0
- dsa_server-0.1.0/src/agent/llm_adapter.py +829 -0
- dsa_server-0.1.0/src/agent/memory.py +312 -0
- dsa_server-0.1.0/src/agent/orchestrator.py +1614 -0
- dsa_server-0.1.0/src/agent/protocols.py +236 -0
- dsa_server-0.1.0/src/agent/provider_trace.py +267 -0
- dsa_server-0.1.0/src/agent/research.py +483 -0
- dsa_server-0.1.0/src/agent/runner.py +839 -0
- dsa_server-0.1.0/src/agent/skills/__init__.py +62 -0
- dsa_server-0.1.0/src/agent/skills/aggregator.py +160 -0
- dsa_server-0.1.0/src/agent/skills/base.py +481 -0
- dsa_server-0.1.0/src/agent/skills/defaults.py +316 -0
- dsa_server-0.1.0/src/agent/skills/router.py +164 -0
- dsa_server-0.1.0/src/agent/skills/skill_agent.py +118 -0
- dsa_server-0.1.0/src/agent/stock_scope.py +244 -0
- dsa_server-0.1.0/src/agent/strategies/__init__.py +19 -0
- dsa_server-0.1.0/src/agent/strategies/aggregator.py +5 -0
- dsa_server-0.1.0/src/agent/strategies/router.py +5 -0
- dsa_server-0.1.0/src/agent/strategies/strategy_agent.py +5 -0
- dsa_server-0.1.0/src/agent/tools/__init__.py +11 -0
- dsa_server-0.1.0/src/agent/tools/analysis_tools.py +520 -0
- dsa_server-0.1.0/src/agent/tools/backtest_tools.py +245 -0
- dsa_server-0.1.0/src/agent/tools/data_tools.py +694 -0
- dsa_server-0.1.0/src/agent/tools/market_tools.py +108 -0
- dsa_server-0.1.0/src/agent/tools/pool_tools.py +202 -0
- dsa_server-0.1.0/src/agent/tools/registry.py +266 -0
- dsa_server-0.1.0/src/agent/tools/search_tools.py +211 -0
- dsa_server-0.1.0/src/analysis_context_pack_overview.py +302 -0
- dsa_server-0.1.0/src/analysis_context_pack_prompt.py +519 -0
- dsa_server-0.1.0/src/analyzer.py +3828 -0
- dsa_server-0.1.0/src/auth.py +500 -0
- dsa_server-0.1.0/src/config.py +2842 -0
- dsa_server-0.1.0/src/core/backtest_engine.py +683 -0
- dsa_server-0.1.0/src/core/config_manager.py +214 -0
- dsa_server-0.1.0/src/core/config_registry.py +4379 -0
- dsa_server-0.1.0/src/core/market_profile.py +76 -0
- dsa_server-0.1.0/src/core/market_review.py +466 -0
- dsa_server-0.1.0/src/core/market_review_lock.py +227 -0
- dsa_server-0.1.0/src/core/market_review_runtime.py +85 -0
- dsa_server-0.1.0/src/core/market_strategy.py +172 -0
- dsa_server-0.1.0/src/core/pipeline.py +2536 -0
- dsa_server-0.1.0/src/core/trading_calendar.py +556 -0
- dsa_server-0.1.0/src/data/__init__.py +8 -0
- dsa_server-0.1.0/src/data/stock_index_loader.py +238 -0
- dsa_server-0.1.0/src/data/stock_mapping.py +139 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/PKG-INFO +243 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/SOURCES.txt +291 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/dependency_links.txt +1 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/entry_points.txt +3 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/requires.txt +23 -0
- dsa_server-0.1.0/src/dsa_server.egg-info/top_level.txt +30 -0
- dsa_server-0.1.0/src/embedding_service.py +124 -0
- dsa_server-0.1.0/src/enums.py +50 -0
- dsa_server-0.1.0/src/feishu_doc.py +165 -0
- dsa_server-0.1.0/src/formatters.py +1077 -0
- dsa_server-0.1.0/src/llm/__init__.py +2 -0
- dsa_server-0.1.0/src/llm/errors.py +151 -0
- dsa_server-0.1.0/src/llm/generation_params.py +439 -0
- dsa_server-0.1.0/src/logging_config.py +197 -0
- dsa_server-0.1.0/src/market_analyzer.py +1487 -0
- dsa_server-0.1.0/src/market_context.py +124 -0
- dsa_server-0.1.0/src/market_phase_prompt.py +215 -0
- dsa_server-0.1.0/src/market_phase_summary.py +264 -0
- dsa_server-0.1.0/src/patches/__init__.py +0 -0
- dsa_server-0.1.0/src/patches/eastmoney_patch.py +182 -0
- dsa_server-0.1.0/src/phase_decision_guardrail.py +377 -0
- dsa_server-0.1.0/src/report_language.py +828 -0
- dsa_server-0.1.0/src/repositories/__init__.py +26 -0
- dsa_server-0.1.0/src/repositories/alert_repo.py +327 -0
- dsa_server-0.1.0/src/repositories/analysis_repo.py +130 -0
- dsa_server-0.1.0/src/repositories/backtest_repo.py +439 -0
- dsa_server-0.1.0/src/repositories/data_quality_repo.py +109 -0
- dsa_server-0.1.0/src/repositories/decision_signal_repo.py +322 -0
- dsa_server-0.1.0/src/repositories/portfolio_repo.py +1152 -0
- dsa_server-0.1.0/src/repositories/stock_metadata_repo.py +95 -0
- dsa_server-0.1.0/src/repositories/stock_pool_repo.py +234 -0
- dsa_server-0.1.0/src/repositories/stock_repo.py +161 -0
- dsa_server-0.1.0/src/scheduler.py +356 -0
- dsa_server-0.1.0/src/schemas/__init__.py +30 -0
- dsa_server-0.1.0/src/schemas/analysis_context_pack.py +128 -0
- dsa_server-0.1.0/src/schemas/decision_action.py +382 -0
- dsa_server-0.1.0/src/schemas/market_light.py +43 -0
- dsa_server-0.1.0/src/schemas/report_schema.py +175 -0
- dsa_server-0.1.0/src/search_service.py +3995 -0
- dsa_server-0.1.0/src/services/__init__.py +40 -0
- dsa_server-0.1.0/src/services/agent_model_service.py +138 -0
- dsa_server-0.1.0/src/services/alert_indicators.py +514 -0
- dsa_server-0.1.0/src/services/alert_service.py +1329 -0
- dsa_server-0.1.0/src/services/alert_worker.py +738 -0
- dsa_server-0.1.0/src/services/alphasift_service.py +1621 -0
- dsa_server-0.1.0/src/services/analysis_context_builder.py +783 -0
- dsa_server-0.1.0/src/services/analysis_service.py +248 -0
- dsa_server-0.1.0/src/services/analyzer_service.py +133 -0
- dsa_server-0.1.0/src/services/backtest_service.py +822 -0
- dsa_server-0.1.0/src/services/data_import_service.py +73 -0
- dsa_server-0.1.0/src/services/data_quality_service.py +81 -0
- dsa_server-0.1.0/src/services/decision_signal_service.py +547 -0
- dsa_server-0.1.0/src/services/history_comparison_service.py +96 -0
- dsa_server-0.1.0/src/services/history_loader.py +174 -0
- dsa_server-0.1.0/src/services/history_retention_service.py +319 -0
- dsa_server-0.1.0/src/services/history_service.py +1188 -0
- dsa_server-0.1.0/src/services/image_stock_extractor.py +340 -0
- dsa_server-0.1.0/src/services/import_parser.py +252 -0
- dsa_server-0.1.0/src/services/market_light_alerts.py +362 -0
- dsa_server-0.1.0/src/services/market_light_service.py +129 -0
- dsa_server-0.1.0/src/services/name_to_code_resolver.py +231 -0
- dsa_server-0.1.0/src/services/notification_diagnostics.py +8 -0
- dsa_server-0.1.0/src/services/portfolio_alerts.py +616 -0
- dsa_server-0.1.0/src/services/portfolio_import_service.py +448 -0
- dsa_server-0.1.0/src/services/portfolio_risk_service.py +441 -0
- dsa_server-0.1.0/src/services/portfolio_service.py +1610 -0
- dsa_server-0.1.0/src/services/report_renderer.py +211 -0
- dsa_server-0.1.0/src/services/run_diagnostics.py +973 -0
- dsa_server-0.1.0/src/services/run_flow.py +1263 -0
- dsa_server-0.1.0/src/services/social_sentiment_service.py +343 -0
- dsa_server-0.1.0/src/services/stock_code_utils.py +102 -0
- dsa_server-0.1.0/src/services/stock_index_remote_service.py +265 -0
- dsa_server-0.1.0/src/services/stock_metadata_service.py +91 -0
- dsa_server-0.1.0/src/services/stock_pool_service.py +104 -0
- dsa_server-0.1.0/src/services/stock_service.py +186 -0
- dsa_server-0.1.0/src/services/system_config_service.py +3950 -0
- dsa_server-0.1.0/src/services/task_queue.py +954 -0
- dsa_server-0.1.0/src/services/task_service.py +244 -0
- dsa_server-0.1.0/src/services/vector_search_service.py +427 -0
- dsa_server-0.1.0/src/stock_analyzer.py +848 -0
- dsa_server-0.1.0/src/storage.py +2977 -0
- dsa_server-0.1.0/src/utils/__init__.py +1 -0
- dsa_server-0.1.0/src/utils/analysis_metadata.py +10 -0
- dsa_server-0.1.0/src/utils/data_processing.py +259 -0
- dsa_server-0.1.0/src/utils/sanitize.py +232 -0
- dsa_server-0.1.0/tests/test_a_share_fetcher_code_conversion.py +124 -0
- dsa_server-0.1.0/tests/test_agent_chat_api.py +131 -0
- dsa_server-0.1.0/tests/test_agent_executor.py +1702 -0
- dsa_server-0.1.0/tests/test_agent_frozen_context.py +143 -0
- dsa_server-0.1.0/tests/test_agent_models_api.py +390 -0
- dsa_server-0.1.0/tests/test_agent_orchestrator_sniper_fallback.py +79 -0
- dsa_server-0.1.0/tests/test_agent_registry.py +916 -0
- dsa_server-0.1.0/tests/test_agent_sse_cleanup.py +92 -0
- dsa_server-0.1.0/tests/test_akshare_history_timeout.py +207 -0
- dsa_server-0.1.0/tests/test_akshare_realtime_logging.py +343 -0
- dsa_server-0.1.0/tests/test_alert_api.py +935 -0
- dsa_server-0.1.0/tests/test_alphasift_api.py +1584 -0
- dsa_server-0.1.0/tests/test_alphavantage_fetcher.py +222 -0
- dsa_server-0.1.0/tests/test_analysis_context_builder.py +557 -0
- dsa_server-0.1.0/tests/test_analysis_context_pack_overview.py +421 -0
- dsa_server-0.1.0/tests/test_analysis_context_pack_prompt.py +308 -0
- dsa_server-0.1.0/tests/test_analysis_context_pack_schema.py +336 -0
- dsa_server-0.1.0/tests/test_analysis_history.py +1704 -0
- dsa_server-0.1.0/tests/test_analysis_integration.py +160 -0
- dsa_server-0.1.0/tests/test_analysis_metadata.py +346 -0
- dsa_server-0.1.0/tests/test_analyzer_news_prompt.py +622 -0
- dsa_server-0.1.0/tests/test_anspire_search.py +633 -0
- dsa_server-0.1.0/tests/test_api_app_cors.py +59 -0
- dsa_server-0.1.0/tests/test_api_error_helpers.py +36 -0
- dsa_server-0.1.0/tests/test_api_health.py +96 -0
- dsa_server-0.1.0/tests/test_api_schema_pydantic.py +109 -0
- dsa_server-0.1.0/tests/test_auth.py +292 -0
- dsa_server-0.1.0/tests/test_auth_api.py +600 -0
- dsa_server-0.1.0/tests/test_auth_status_setup_state.py +138 -0
- dsa_server-0.1.0/tests/test_autocomplete_pr0.py +282 -0
- dsa_server-0.1.0/tests/test_backtest_engine.py +360 -0
- dsa_server-0.1.0/tests/test_backtest_service.py +896 -0
- dsa_server-0.1.0/tests/test_backtest_summary.py +53 -0
- dsa_server-0.1.0/tests/test_chat_context.py +506 -0
- dsa_server-0.1.0/tests/test_check_env_encoding.py +47 -0
- dsa_server-0.1.0/tests/test_chip_distribution_manager.py +69 -0
- dsa_server-0.1.0/tests/test_chip_structure_fallback.py +322 -0
- dsa_server-0.1.0/tests/test_config_env_compat.py +528 -0
- dsa_server-0.1.0/tests/test_config_manager.py +91 -0
- dsa_server-0.1.0/tests/test_conversation_manager.py +41 -0
- dsa_server-0.1.0/tests/test_cwe345_xff_bypass.py +95 -0
- dsa_server-0.1.0/tests/test_data_fetcher_prefetch_stock_names.py +311 -0
- dsa_server-0.1.0/tests/test_data_tools_daily_history_cache.py +230 -0
- dsa_server-0.1.0/tests/test_data_tools_get_capital_flow.py +100 -0
- dsa_server-0.1.0/tests/test_data_tools_get_stock_info.py +91 -0
- dsa_server-0.1.0/tests/test_data_tools_portfolio_snapshot.py +133 -0
- dsa_server-0.1.0/tests/test_decision_action.py +321 -0
- dsa_server-0.1.0/tests/test_decision_signal_api.py +1156 -0
- dsa_server-0.1.0/tests/test_decision_signal_contract_isolation.py +83 -0
- dsa_server-0.1.0/tests/test_decision_signal_repo.py +370 -0
- dsa_server-0.1.0/tests/test_decision_signal_service.py +477 -0
- dsa_server-0.1.0/tests/test_decision_stability.py +342 -0
- dsa_server-0.1.0/tests/test_efinance_main_indices.py +82 -0
- dsa_server-0.1.0/tests/test_etf_daily_routing.py +203 -0
- dsa_server-0.1.0/tests/test_fetch_tushare_stock_list.py +152 -0
- dsa_server-0.1.0/tests/test_fetcher_logging.py +153 -0
- dsa_server-0.1.0/tests/test_fetcher_source_optimization.py +261 -0
- dsa_server-0.1.0/tests/test_finnhub_fetcher.py +259 -0
- dsa_server-0.1.0/tests/test_formatters.py +445 -0
- dsa_server-0.1.0/tests/test_fundamental_adapter.py +175 -0
- dsa_server-0.1.0/tests/test_fundamental_context.py +614 -0
- dsa_server-0.1.0/tests/test_generate_index_from_csv.py +575 -0
- dsa_server-0.1.0/tests/test_get_latest_data.py +185 -0
- dsa_server-0.1.0/tests/test_history_loader.py +159 -0
- dsa_server-0.1.0/tests/test_history_news_fallback.py +77 -0
- dsa_server-0.1.0/tests/test_history_retention.py +32 -0
- dsa_server-0.1.0/tests/test_hk_realtime_routing.py +55 -0
- dsa_server-0.1.0/tests/test_hk_stock_name_fallback.py +164 -0
- dsa_server-0.1.0/tests/test_image_stock_extractor_litellm.py +336 -0
- dsa_server-0.1.0/tests/test_import_parser.py +206 -0
- dsa_server-0.1.0/tests/test_litellm_fallback_pricing.py +218 -0
- dsa_server-0.1.0/tests/test_llm_adapter_provider_trace.py +229 -0
- dsa_server-0.1.0/tests/test_llm_channel_config.py +768 -0
- dsa_server-0.1.0/tests/test_llm_param_recovery.py +202 -0
- dsa_server-0.1.0/tests/test_llm_usage.py +200 -0
- dsa_server-0.1.0/tests/test_logging_config.py +103 -0
- dsa_server-0.1.0/tests/test_longbridge_fetcher.py +692 -0
- dsa_server-0.1.0/tests/test_market_analyzer_generate_text.py +1513 -0
- dsa_server-0.1.0/tests/test_market_light_alerts.py +133 -0
- dsa_server-0.1.0/tests/test_market_light_service.py +210 -0
- dsa_server-0.1.0/tests/test_market_phase_prompt.py +129 -0
- dsa_server-0.1.0/tests/test_market_phase_summary.py +191 -0
- dsa_server-0.1.0/tests/test_market_review_lock.py +143 -0
- dsa_server-0.1.0/tests/test_market_strategy.py +97 -0
- dsa_server-0.1.0/tests/test_name_to_code_resolver.py +162 -0
- dsa_server-0.1.0/tests/test_news_intel.py +204 -0
- dsa_server-0.1.0/tests/test_news_strategy_config.py +23 -0
- dsa_server-0.1.0/tests/test_notification_report_fixtures.py +54 -0
- dsa_server-0.1.0/tests/test_packaging_build_scripts.py +49 -0
- dsa_server-0.1.0/tests/test_phase_decision_guardrail.py +325 -0
- dsa_server-0.1.0/tests/test_pipeline_augment_realtime.py +92 -0
- dsa_server-0.1.0/tests/test_pipeline_fetch_error.py +67 -0
- dsa_server-0.1.0/tests/test_pipeline_market_phase_context.py +724 -0
- dsa_server-0.1.0/tests/test_pipeline_realtime_indicators.py +427 -0
- dsa_server-0.1.0/tests/test_pipeline_related_boards.py +125 -0
- dsa_server-0.1.0/tests/test_portfolio_alerts.py +240 -0
- dsa_server-0.1.0/tests/test_portfolio_api.py +874 -0
- dsa_server-0.1.0/tests/test_portfolio_pr2.py +710 -0
- dsa_server-0.1.0/tests/test_portfolio_service.py +1174 -0
- dsa_server-0.1.0/tests/test_provider_trace.py +154 -0
- dsa_server-0.1.0/tests/test_realtime_quote_fallback_logging.py +252 -0
- dsa_server-0.1.0/tests/test_realtime_types.py +172 -0
- dsa_server-0.1.0/tests/test_refresh_stock_index.py +38 -0
- dsa_server-0.1.0/tests/test_report_integrity.py +508 -0
- dsa_server-0.1.0/tests/test_report_language.py +78 -0
- dsa_server-0.1.0/tests/test_report_schema.py +221 -0
- dsa_server-0.1.0/tests/test_run_diagnostics_p1.py +218 -0
- dsa_server-0.1.0/tests/test_run_diagnostics_p2.py +541 -0
- dsa_server-0.1.0/tests/test_run_flow.py +436 -0
- dsa_server-0.1.0/tests/test_scheduler_background.py +197 -0
- dsa_server-0.1.0/tests/test_search_news_freshness.py +1155 -0
- dsa_server-0.1.0/tests/test_search_performance.py +88 -0
- dsa_server-0.1.0/tests/test_search_searxng.py +446 -0
- dsa_server-0.1.0/tests/test_search_serpapi_provider.py +539 -0
- dsa_server-0.1.0/tests/test_search_service_concurrency.py +281 -0
- dsa_server-0.1.0/tests/test_search_tavily_provider.py +275 -0
- dsa_server-0.1.0/tests/test_search_tools_persistence.py +121 -0
- dsa_server-0.1.0/tests/test_social_sentiment_service.py +322 -0
- dsa_server-0.1.0/tests/test_static_assets_consistency.py +482 -0
- dsa_server-0.1.0/tests/test_stock_analyzer_bias.py +179 -0
- dsa_server-0.1.0/tests/test_stock_analyzer_rsi.py +65 -0
- dsa_server-0.1.0/tests/test_stock_code_bse.py +156 -0
- dsa_server-0.1.0/tests/test_stock_code_utils.py +184 -0
- dsa_server-0.1.0/tests/test_stock_index_loader.py +201 -0
- dsa_server-0.1.0/tests/test_stock_index_remote_service.py +225 -0
- dsa_server-0.1.0/tests/test_stock_pool.py +71 -0
- dsa_server-0.1.0/tests/test_stock_watchlist_api.py +66 -0
- dsa_server-0.1.0/tests/test_stooq_fallback.py +83 -0
- dsa_server-0.1.0/tests/test_storage.py +708 -0
- dsa_server-0.1.0/tests/test_task_queue_config_sync.py +114 -0
- dsa_server-0.1.0/tests/test_task_service.py +71 -0
- dsa_server-0.1.0/tests/test_threadless_test_client.py +89 -0
- dsa_server-0.1.0/tests/test_tickflow_fetcher.py +316 -0
- dsa_server-0.1.0/tests/test_tickflow_market_review_fallback.py +154 -0
- dsa_server-0.1.0/tests/test_trading_calendar.py +758 -0
- dsa_server-0.1.0/tests/test_tushare_fetcher_followups.py +191 -0
- dsa_server-0.1.0/tests/test_tushare_fetcher_get_stock_list.py +292 -0
- dsa_server-0.1.0/tests/test_tushare_fetcher_http_client.py +79 -0
- dsa_server-0.1.0/tests/test_us_index_mapping.py +211 -0
- dsa_server-0.1.0/tests/test_vector_search.py +134 -0
- dsa_server-0.1.0/tests/test_yfinance_fundamental_adapter.py +261 -0
- dsa_server-0.1.0/tests/test_yfinance_hk_indices.py +205 -0
- dsa_server-0.1.0/tests/test_yfinance_normalize.py +26 -0
- dsa_server-0.1.0/tests/test_yfinance_us_indices.py +197 -0
dsa_server-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZhuLinsen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dsa-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Stock Intelligent Analysis System — CLI + MCP Server + REST API
|
|
5
|
+
Author: kuaizhongqiang
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kuaizhongqiang/daily_stock_analysis
|
|
8
|
+
Project-URL: Repository, https://github.com/kuaizhongqiang/daily_stock_analysis
|
|
9
|
+
Keywords: stock,finance,analysis,dsa,trading
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: click>=8.0
|
|
21
|
+
Provides-Extra: mcp
|
|
22
|
+
Requires-Dist: mcp>=1.0.0; extra == "mcp"
|
|
23
|
+
Provides-Extra: full
|
|
24
|
+
Requires-Dist: akshare; extra == "full"
|
|
25
|
+
Requires-Dist: tushare; extra == "full"
|
|
26
|
+
Requires-Dist: baostock; extra == "full"
|
|
27
|
+
Requires-Dist: yfinance; extra == "full"
|
|
28
|
+
Requires-Dist: pytdx; extra == "full"
|
|
29
|
+
Requires-Dist: litellm; extra == "full"
|
|
30
|
+
Requires-Dist: fastapi; extra == "full"
|
|
31
|
+
Requires-Dist: uvicorn; extra == "full"
|
|
32
|
+
Requires-Dist: sqlalchemy; extra == "full"
|
|
33
|
+
Requires-Dist: pandas; extra == "full"
|
|
34
|
+
Requires-Dist: numpy; extra == "full"
|
|
35
|
+
Requires-Dist: requests; extra == "full"
|
|
36
|
+
Requires-Dist: beautifulsoup4; extra == "full"
|
|
37
|
+
Requires-Dist: lxml; extra == "full"
|
|
38
|
+
Requires-Dist: jieba; extra == "full"
|
|
39
|
+
Requires-Dist: sentencepiece; extra == "full"
|
|
40
|
+
Requires-Dist: openpyxl; extra == "full"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
<div align="center">
|
|
44
|
+
|
|
45
|
+
# 📈 股票智能分析系统
|
|
46
|
+
|
|
47
|
+
> **Fork 说明**:本项目基于 [ZhuLinsen/daily_stock_analysis](https://github.com/ZhuLinsen/daily_stock_analysis)(MIT License)修改而来。
|
|
48
|
+
> 原始项目是一个功能完备的 AI 股票分析平台,包含 Web UI、桌面端、多 Bot 渠道等。
|
|
49
|
+
> 本 Fork 的核心变更:
|
|
50
|
+
>
|
|
51
|
+
> - 🧹 **彻底剥离平台层** — 已移除 Web UI、桌面端、Bot 渠道、通知推送、定时任务(第一阶段)
|
|
52
|
+
> - 🤖 **AI Agent 驱动** — 由 AI Agent 通过 CLI / MCP / OpenClaw Skill 调用,无自主行为
|
|
53
|
+
> - 💻 **本地 LLM 优先** — 默认使用 LM Studio,无需云 API Key
|
|
54
|
+
> - 🔌 **保留核心分析引擎** — 多市场数据聚合、AI 决策分析、15+ 策略系统
|
|
55
|
+
> - 🏊 **股池 + 向量搜索 + 历史留存** — 轻量级股池管理、语义搜索、会话追踪(第二阶段)
|
|
56
|
+
|
|
57
|
+
[](https://opensource.org/licenses/MIT)
|
|
58
|
+
[](https://www.python.org/downloads/)
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🏗️ 架构总览
|
|
65
|
+
|
|
66
|
+
```mermaid
|
|
67
|
+
flowchart TB
|
|
68
|
+
subgraph 接入层["📡 接入层 (AI Agent 驱动)"]
|
|
69
|
+
CLI["dsa CLI<br/>(Python Click)"]
|
|
70
|
+
MCP["dsa MCP Server<br/>(Python)"]
|
|
71
|
+
Plugin["OpenClaw Plugin<br/>(TypeScript / npm)"]
|
|
72
|
+
API["REST API<br/>(FastAPI / port 8000)"]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
subgraph 引擎层["⚙️ 分析引擎"]
|
|
76
|
+
Pipeline["Pipeline 编排<br/>(src/core/pipeline.py)"]
|
|
77
|
+
Agent["Agent 系统<br/>(src/agent/)"]
|
|
78
|
+
Strategies["策略系统<br/>(15+ YAML 策略)"]
|
|
79
|
+
Technical["技术分析<br/>(K线/指标/资金流)"]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
subgraph 数据层["💾 数据层"]
|
|
83
|
+
DataProviders["多源数据抓取<br/>(AkShare/Tushare/YFinance...)"]
|
|
84
|
+
VectorDB["向量搜索<br/>(LM Studio 嵌入)"]
|
|
85
|
+
DB["SQLite 持久化<br/>(分析/股池/历史/信号)"]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
subgraph 外部系统["🔗 外部系统"]
|
|
89
|
+
LLM["本地/云端 LLM<br/>(LM Studio / OpenAI / ...)"]
|
|
90
|
+
News["新闻搜索<br/>(SerpAPI/Tavily/Brave)"]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
CLI -->|HTTP| API
|
|
94
|
+
MCP -->|HTTP| API
|
|
95
|
+
Plugin -->|HTTP| API
|
|
96
|
+
API --> Pipeline
|
|
97
|
+
Pipeline --> Agent
|
|
98
|
+
Pipeline --> Technical
|
|
99
|
+
Pipeline --> DataProviders
|
|
100
|
+
Agent --> Strategies
|
|
101
|
+
DataProviders --> DB
|
|
102
|
+
DataProviders --> News
|
|
103
|
+
Pipeline --> LLM
|
|
104
|
+
VectorDB --> LLM
|
|
105
|
+
|
|
106
|
+
style CLI fill:#4a9eff,color:#fff
|
|
107
|
+
style MCP fill:#4a9eff,color:#fff
|
|
108
|
+
style Plugin fill:#4a9eff,color:#fff
|
|
109
|
+
style API fill:#4a9eff,color:#fff
|
|
110
|
+
style Pipeline fill:#f9a825,color:#000
|
|
111
|
+
style Agent fill:#f9a825,color:#000
|
|
112
|
+
style Strategies fill:#f9a825,color:#000
|
|
113
|
+
style DataProviders fill:#66bb6a,color:#fff
|
|
114
|
+
style VectorDB fill:#66bb6a,color:#fff
|
|
115
|
+
style DB fill:#66bb6a,color:#fff
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 三款 npm 包
|
|
119
|
+
|
|
120
|
+
| 包名 | npm | 说明 |
|
|
121
|
+
|------|-----|------|
|
|
122
|
+
| `dsa-plugin` | [](https://www.npmjs.com/package/dsa-plugin) | OpenClaw 原生 Plugin,21 个工具 + 会话上下文 + 审批流 + 主动推送 |
|
|
123
|
+
| `dsa-mcp-server` | [](https://www.npmjs.com/package/dsa-mcp-server) | MCP 协议 Server,Claude/Cursor 可直接调用分析工具 |
|
|
124
|
+
| `dsa-api-client` | [](https://www.npmjs.com/package/dsa-api-client) | TypeScript REST API 客户端,零依赖 |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## ✨ 核心能力
|
|
129
|
+
|
|
130
|
+
| 能力 | 覆盖内容 |
|
|
131
|
+
|------|---------|
|
|
132
|
+
| AI 决策报告 | 核心结论、评分、趋势、买卖点位、风险警报、催化因素、操作检查清单 |
|
|
133
|
+
| 多市场数据聚合 | A股、港股、美股、ETF;行情、K 线、技术指标、资金流、筹码、新闻、公告和基本面 |
|
|
134
|
+
| 策略系统 | 均线金叉、缠论、波浪理论、多头趋势、热点题材、事件驱动、成长质量、预期重估等 15+ 策略 |
|
|
135
|
+
| Agent 问股 | 多轮追问,策略驱动的分析对话,支持自定义策略 YAML |
|
|
136
|
+
| 🏊 **股池管理** | 轻量级自选股分组,标签管理,CLI/API/MCP/Agent 四通道操作 |
|
|
137
|
+
| 🔍 **语义搜索** | 自然语言搜索历史分析/新闻/对话,LM Studio 向量化,无需额外模型 |
|
|
138
|
+
| 📜 **历史留存** | 分析会话追踪、全文搜索、JSON/CSV 导出、按策略自动清理 |
|
|
139
|
+
|
|
140
|
+
### 数据来源
|
|
141
|
+
|
|
142
|
+
| 类型 | 支持 |
|
|
143
|
+
|------|------|
|
|
144
|
+
| AI 模型 | OpenAI 兼容(DeepSeek、通义千问、Gemini、Claude 等)、Ollama 本地模型 |
|
|
145
|
+
| 行情数据 | AkShare、Tushare、Pytdx、Baostock、YFinance、LongBridge、TickFlow |
|
|
146
|
+
| 新闻搜索 | SerpAPI、Tavily、Brave、博查、SearXNG |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🚀 快速开始
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 克隆
|
|
154
|
+
git clone https://github.com/kuaizhongqiang/daily_stock_analysis.git && cd daily_stock_analysis
|
|
155
|
+
|
|
156
|
+
# 安装依赖
|
|
157
|
+
pip install -r requirements.txt
|
|
158
|
+
|
|
159
|
+
# 配置环境变量
|
|
160
|
+
cp .env.example .env && vim .env
|
|
161
|
+
|
|
162
|
+
# 运行分析(JSON 输出)
|
|
163
|
+
python main.py
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
常用命令:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python main.py --debug # 调试模式
|
|
170
|
+
python main.py --dry-run # 干跑
|
|
171
|
+
python main.py --stocks 600519,hk00700,AAPL # 指定股票
|
|
172
|
+
python main.py --market-review # 仅大盘复盘
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
CLI 工具(需 `pip install -e .`):
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# 股票分析
|
|
179
|
+
dsa analyze 600519 # 分析股票
|
|
180
|
+
dsa market # 大盘复盘
|
|
181
|
+
dsa resolve 茅台 # 股票名称解析
|
|
182
|
+
|
|
183
|
+
# 股池管理(第二期)
|
|
184
|
+
dsa pool create 我的自选 # 创建股池
|
|
185
|
+
dsa pool add 1 600519 --market cn # 添加股票
|
|
186
|
+
dsa pool stocks 1 # 查看池内股票
|
|
187
|
+
|
|
188
|
+
# 语义搜索(第二期)
|
|
189
|
+
dsa vector search "茅台近期走势" # 自然语言搜索
|
|
190
|
+
dsa vector status # 索引状态
|
|
191
|
+
|
|
192
|
+
# 历史管理(第二期)
|
|
193
|
+
dsa history search 茅台 # 全文搜索历史
|
|
194
|
+
dsa history export --format json # 导出历史
|
|
195
|
+
dsa history stats # 统计信息
|
|
196
|
+
|
|
197
|
+
# MCP Server
|
|
198
|
+
dsa mcp # 启动 MCP Server(11 个工具)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 🎯 OpenClaw Plugin(v0.1 新)
|
|
202
|
+
|
|
203
|
+
通过原生 TypeScript Plugin 深度集成 OpenClaw:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# 编译插件
|
|
207
|
+
cd extensions/dsa-plugin && pnpm install && pnpm build
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**21 个结构化工具** — 分析、行情、大盘、股池、搜索、历史、策略问股,全部参数 JSON Schema 校验,内置会话上下文追问、审批流(高危操作需确认)、主动推送(股价预警)。
|
|
211
|
+
|
|
212
|
+
详见 [DSA Plugin 文档](extensions/dsa-plugin/README.md) 和 [Plugin vs Skill 对比](docs/openclaw-skill-integration.md#plugin-模式)。
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## ⚙️ 配置说明
|
|
217
|
+
|
|
218
|
+
完整环境变量、模型渠道、数据源优先级、交易纪律等见 [完整配置指南](docs/full-guide.md)。
|
|
219
|
+
|
|
220
|
+
关键配置项:
|
|
221
|
+
|
|
222
|
+
| 环境变量 | 说明 |
|
|
223
|
+
|---------|------|
|
|
224
|
+
| `STOCK_LIST` | 自选股代码,如 `600519,hk00700,AAPL` |
|
|
225
|
+
| `LLM_LM_STUDIO_BASE_URL` | 本地 LM Studio 地址(默认 `http://localhost:1234/v1`) |
|
|
226
|
+
| `LITELLM_MODEL` | 本地模型名(默认 `openai/qwen/qwen3.5-9b`) |
|
|
227
|
+
| `SERPAPI_API_KEYS` | 新闻搜索 API |
|
|
228
|
+
| `TAVILY_API_KEYS` | 新闻搜索 API |
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 📄 License
|
|
233
|
+
|
|
234
|
+
[MIT License](LICENSE)
|
|
235
|
+
|
|
236
|
+
- Copyright © 2026 **ZhuLinsen**(原始作者)
|
|
237
|
+
- Copyright © 2026 **kuaizhongqiang**(Fork 修改)
|
|
238
|
+
|
|
239
|
+
原始版权声明和许可协议保持完整,详见 [LICENSE](LICENSE)。
|
|
240
|
+
|
|
241
|
+
## ⚠️ 免责声明
|
|
242
|
+
|
|
243
|
+
本项目仅供学习和研究使用,不构成任何投资建议。股市有风险,投资需谨慎。
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 📈 股票智能分析系统
|
|
4
|
+
|
|
5
|
+
> **Fork 说明**:本项目基于 [ZhuLinsen/daily_stock_analysis](https://github.com/ZhuLinsen/daily_stock_analysis)(MIT License)修改而来。
|
|
6
|
+
> 原始项目是一个功能完备的 AI 股票分析平台,包含 Web UI、桌面端、多 Bot 渠道等。
|
|
7
|
+
> 本 Fork 的核心变更:
|
|
8
|
+
>
|
|
9
|
+
> - 🧹 **彻底剥离平台层** — 已移除 Web UI、桌面端、Bot 渠道、通知推送、定时任务(第一阶段)
|
|
10
|
+
> - 🤖 **AI Agent 驱动** — 由 AI Agent 通过 CLI / MCP / OpenClaw Skill 调用,无自主行为
|
|
11
|
+
> - 💻 **本地 LLM 优先** — 默认使用 LM Studio,无需云 API Key
|
|
12
|
+
> - 🔌 **保留核心分析引擎** — 多市场数据聚合、AI 决策分析、15+ 策略系统
|
|
13
|
+
> - 🏊 **股池 + 向量搜索 + 历史留存** — 轻量级股池管理、语义搜索、会话追踪(第二阶段)
|
|
14
|
+
|
|
15
|
+
[](https://opensource.org/licenses/MIT)
|
|
16
|
+
[](https://www.python.org/downloads/)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🏗️ 架构总览
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TB
|
|
26
|
+
subgraph 接入层["📡 接入层 (AI Agent 驱动)"]
|
|
27
|
+
CLI["dsa CLI<br/>(Python Click)"]
|
|
28
|
+
MCP["dsa MCP Server<br/>(Python)"]
|
|
29
|
+
Plugin["OpenClaw Plugin<br/>(TypeScript / npm)"]
|
|
30
|
+
API["REST API<br/>(FastAPI / port 8000)"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subgraph 引擎层["⚙️ 分析引擎"]
|
|
34
|
+
Pipeline["Pipeline 编排<br/>(src/core/pipeline.py)"]
|
|
35
|
+
Agent["Agent 系统<br/>(src/agent/)"]
|
|
36
|
+
Strategies["策略系统<br/>(15+ YAML 策略)"]
|
|
37
|
+
Technical["技术分析<br/>(K线/指标/资金流)"]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
subgraph 数据层["💾 数据层"]
|
|
41
|
+
DataProviders["多源数据抓取<br/>(AkShare/Tushare/YFinance...)"]
|
|
42
|
+
VectorDB["向量搜索<br/>(LM Studio 嵌入)"]
|
|
43
|
+
DB["SQLite 持久化<br/>(分析/股池/历史/信号)"]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
subgraph 外部系统["🔗 外部系统"]
|
|
47
|
+
LLM["本地/云端 LLM<br/>(LM Studio / OpenAI / ...)"]
|
|
48
|
+
News["新闻搜索<br/>(SerpAPI/Tavily/Brave)"]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
CLI -->|HTTP| API
|
|
52
|
+
MCP -->|HTTP| API
|
|
53
|
+
Plugin -->|HTTP| API
|
|
54
|
+
API --> Pipeline
|
|
55
|
+
Pipeline --> Agent
|
|
56
|
+
Pipeline --> Technical
|
|
57
|
+
Pipeline --> DataProviders
|
|
58
|
+
Agent --> Strategies
|
|
59
|
+
DataProviders --> DB
|
|
60
|
+
DataProviders --> News
|
|
61
|
+
Pipeline --> LLM
|
|
62
|
+
VectorDB --> LLM
|
|
63
|
+
|
|
64
|
+
style CLI fill:#4a9eff,color:#fff
|
|
65
|
+
style MCP fill:#4a9eff,color:#fff
|
|
66
|
+
style Plugin fill:#4a9eff,color:#fff
|
|
67
|
+
style API fill:#4a9eff,color:#fff
|
|
68
|
+
style Pipeline fill:#f9a825,color:#000
|
|
69
|
+
style Agent fill:#f9a825,color:#000
|
|
70
|
+
style Strategies fill:#f9a825,color:#000
|
|
71
|
+
style DataProviders fill:#66bb6a,color:#fff
|
|
72
|
+
style VectorDB fill:#66bb6a,color:#fff
|
|
73
|
+
style DB fill:#66bb6a,color:#fff
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 三款 npm 包
|
|
77
|
+
|
|
78
|
+
| 包名 | npm | 说明 |
|
|
79
|
+
|------|-----|------|
|
|
80
|
+
| `dsa-plugin` | [](https://www.npmjs.com/package/dsa-plugin) | OpenClaw 原生 Plugin,21 个工具 + 会话上下文 + 审批流 + 主动推送 |
|
|
81
|
+
| `dsa-mcp-server` | [](https://www.npmjs.com/package/dsa-mcp-server) | MCP 协议 Server,Claude/Cursor 可直接调用分析工具 |
|
|
82
|
+
| `dsa-api-client` | [](https://www.npmjs.com/package/dsa-api-client) | TypeScript REST API 客户端,零依赖 |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## ✨ 核心能力
|
|
87
|
+
|
|
88
|
+
| 能力 | 覆盖内容 |
|
|
89
|
+
|------|---------|
|
|
90
|
+
| AI 决策报告 | 核心结论、评分、趋势、买卖点位、风险警报、催化因素、操作检查清单 |
|
|
91
|
+
| 多市场数据聚合 | A股、港股、美股、ETF;行情、K 线、技术指标、资金流、筹码、新闻、公告和基本面 |
|
|
92
|
+
| 策略系统 | 均线金叉、缠论、波浪理论、多头趋势、热点题材、事件驱动、成长质量、预期重估等 15+ 策略 |
|
|
93
|
+
| Agent 问股 | 多轮追问,策略驱动的分析对话,支持自定义策略 YAML |
|
|
94
|
+
| 🏊 **股池管理** | 轻量级自选股分组,标签管理,CLI/API/MCP/Agent 四通道操作 |
|
|
95
|
+
| 🔍 **语义搜索** | 自然语言搜索历史分析/新闻/对话,LM Studio 向量化,无需额外模型 |
|
|
96
|
+
| 📜 **历史留存** | 分析会话追踪、全文搜索、JSON/CSV 导出、按策略自动清理 |
|
|
97
|
+
|
|
98
|
+
### 数据来源
|
|
99
|
+
|
|
100
|
+
| 类型 | 支持 |
|
|
101
|
+
|------|------|
|
|
102
|
+
| AI 模型 | OpenAI 兼容(DeepSeek、通义千问、Gemini、Claude 等)、Ollama 本地模型 |
|
|
103
|
+
| 行情数据 | AkShare、Tushare、Pytdx、Baostock、YFinance、LongBridge、TickFlow |
|
|
104
|
+
| 新闻搜索 | SerpAPI、Tavily、Brave、博查、SearXNG |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 🚀 快速开始
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# 克隆
|
|
112
|
+
git clone https://github.com/kuaizhongqiang/daily_stock_analysis.git && cd daily_stock_analysis
|
|
113
|
+
|
|
114
|
+
# 安装依赖
|
|
115
|
+
pip install -r requirements.txt
|
|
116
|
+
|
|
117
|
+
# 配置环境变量
|
|
118
|
+
cp .env.example .env && vim .env
|
|
119
|
+
|
|
120
|
+
# 运行分析(JSON 输出)
|
|
121
|
+
python main.py
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
常用命令:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
python main.py --debug # 调试模式
|
|
128
|
+
python main.py --dry-run # 干跑
|
|
129
|
+
python main.py --stocks 600519,hk00700,AAPL # 指定股票
|
|
130
|
+
python main.py --market-review # 仅大盘复盘
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
CLI 工具(需 `pip install -e .`):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 股票分析
|
|
137
|
+
dsa analyze 600519 # 分析股票
|
|
138
|
+
dsa market # 大盘复盘
|
|
139
|
+
dsa resolve 茅台 # 股票名称解析
|
|
140
|
+
|
|
141
|
+
# 股池管理(第二期)
|
|
142
|
+
dsa pool create 我的自选 # 创建股池
|
|
143
|
+
dsa pool add 1 600519 --market cn # 添加股票
|
|
144
|
+
dsa pool stocks 1 # 查看池内股票
|
|
145
|
+
|
|
146
|
+
# 语义搜索(第二期)
|
|
147
|
+
dsa vector search "茅台近期走势" # 自然语言搜索
|
|
148
|
+
dsa vector status # 索引状态
|
|
149
|
+
|
|
150
|
+
# 历史管理(第二期)
|
|
151
|
+
dsa history search 茅台 # 全文搜索历史
|
|
152
|
+
dsa history export --format json # 导出历史
|
|
153
|
+
dsa history stats # 统计信息
|
|
154
|
+
|
|
155
|
+
# MCP Server
|
|
156
|
+
dsa mcp # 启动 MCP Server(11 个工具)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 🎯 OpenClaw Plugin(v0.1 新)
|
|
160
|
+
|
|
161
|
+
通过原生 TypeScript Plugin 深度集成 OpenClaw:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# 编译插件
|
|
165
|
+
cd extensions/dsa-plugin && pnpm install && pnpm build
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**21 个结构化工具** — 分析、行情、大盘、股池、搜索、历史、策略问股,全部参数 JSON Schema 校验,内置会话上下文追问、审批流(高危操作需确认)、主动推送(股价预警)。
|
|
169
|
+
|
|
170
|
+
详见 [DSA Plugin 文档](extensions/dsa-plugin/README.md) 和 [Plugin vs Skill 对比](docs/openclaw-skill-integration.md#plugin-模式)。
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## ⚙️ 配置说明
|
|
175
|
+
|
|
176
|
+
完整环境变量、模型渠道、数据源优先级、交易纪律等见 [完整配置指南](docs/full-guide.md)。
|
|
177
|
+
|
|
178
|
+
关键配置项:
|
|
179
|
+
|
|
180
|
+
| 环境变量 | 说明 |
|
|
181
|
+
|---------|------|
|
|
182
|
+
| `STOCK_LIST` | 自选股代码,如 `600519,hk00700,AAPL` |
|
|
183
|
+
| `LLM_LM_STUDIO_BASE_URL` | 本地 LM Studio 地址(默认 `http://localhost:1234/v1`) |
|
|
184
|
+
| `LITELLM_MODEL` | 本地模型名(默认 `openai/qwen/qwen3.5-9b`) |
|
|
185
|
+
| `SERPAPI_API_KEYS` | 新闻搜索 API |
|
|
186
|
+
| `TAVILY_API_KEYS` | 新闻搜索 API |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📄 License
|
|
191
|
+
|
|
192
|
+
[MIT License](LICENSE)
|
|
193
|
+
|
|
194
|
+
- Copyright © 2026 **ZhuLinsen**(原始作者)
|
|
195
|
+
- Copyright © 2026 **kuaizhongqiang**(Fork 修改)
|
|
196
|
+
|
|
197
|
+
原始版权声明和许可协议保持完整,详见 [LICENSE](LICENSE)。
|
|
198
|
+
|
|
199
|
+
## ⚠️ 免责声明
|
|
200
|
+
|
|
201
|
+
本项目仅供学习和研究使用,不构成任何投资建议。股市有风险,投资需谨慎。
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dsa-server"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Stock Intelligent Analysis System — CLI + MCP Server + REST API"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = {text = "MIT"}
|
|
8
|
+
keywords = ["stock", "finance", "analysis", "dsa", "trading"]
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "kuaizhongqiang"},
|
|
11
|
+
]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"click>=8.0",
|
|
23
|
+
]
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
mcp = ["mcp>=1.0.0"]
|
|
26
|
+
full = [
|
|
27
|
+
"akshare",
|
|
28
|
+
"tushare",
|
|
29
|
+
"baostock",
|
|
30
|
+
"yfinance",
|
|
31
|
+
"pytdx",
|
|
32
|
+
"litellm",
|
|
33
|
+
"fastapi",
|
|
34
|
+
"uvicorn",
|
|
35
|
+
"sqlalchemy",
|
|
36
|
+
"pandas",
|
|
37
|
+
"numpy",
|
|
38
|
+
"requests",
|
|
39
|
+
"beautifulsoup4",
|
|
40
|
+
"lxml",
|
|
41
|
+
"jieba",
|
|
42
|
+
"sentencepiece",
|
|
43
|
+
"openpyxl",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/kuaizhongqiang/daily_stock_analysis"
|
|
48
|
+
Repository = "https://github.com/kuaizhongqiang/daily_stock_analysis"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
dsa = "dsa.cli:main"
|
|
52
|
+
dsa-server = "server:main_cli"
|
|
53
|
+
|
|
54
|
+
[tool.black]
|
|
55
|
+
line-length = 120
|
|
56
|
+
target-version = ['py310', 'py311', 'py312']
|
|
57
|
+
include = '\.pyi?$'
|
|
58
|
+
exclude = '''
|
|
59
|
+
/(
|
|
60
|
+
\.git
|
|
61
|
+
| \.hg
|
|
62
|
+
| \.mypy_cache
|
|
63
|
+
| \.tox
|
|
64
|
+
| \.venv
|
|
65
|
+
| venv
|
|
66
|
+
| _build
|
|
67
|
+
| buck-out
|
|
68
|
+
| build
|
|
69
|
+
| dist
|
|
70
|
+
| __pycache__
|
|
71
|
+
)/
|
|
72
|
+
'''
|
|
73
|
+
|
|
74
|
+
[tool.isort]
|
|
75
|
+
profile = "black"
|
|
76
|
+
line_length = 120
|
|
77
|
+
skip = [".git", "__pycache__", ".env", "venv", ".venv"]
|
|
78
|
+
|
|
79
|
+
[tool.bandit]
|
|
80
|
+
exclude_dirs = ["tests", "test_*.py"]
|
|
81
|
+
skips = ["B101"] # assert 语句在测试中是允许的
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
max-line-length = 120
|
|
3
|
+
exclude =
|
|
4
|
+
.git,
|
|
5
|
+
__pycache__,
|
|
6
|
+
.env,
|
|
7
|
+
venv,
|
|
8
|
+
.venv,
|
|
9
|
+
.venv*,
|
|
10
|
+
build,
|
|
11
|
+
dist,
|
|
12
|
+
local,
|
|
13
|
+
node_modules,
|
|
14
|
+
*/node_modules/*,
|
|
15
|
+
*.egg-info
|
|
16
|
+
ignore = E501,W503,E203,E402
|
|
17
|
+
|
|
18
|
+
[tool:pytest]
|
|
19
|
+
testpaths = .
|
|
20
|
+
python_files = test_*.py
|
|
21
|
+
python_functions = test_*
|
|
22
|
+
addopts = -v --tb=short
|
|
23
|
+
norecursedirs =
|
|
24
|
+
.git
|
|
25
|
+
__pycache__
|
|
26
|
+
.env
|
|
27
|
+
venv
|
|
28
|
+
.venv
|
|
29
|
+
.venv*
|
|
30
|
+
build
|
|
31
|
+
dist
|
|
32
|
+
local
|
|
33
|
+
node_modules
|
|
34
|
+
*/node_modules/*
|
|
35
|
+
markers =
|
|
36
|
+
unit: fast offline unit tests
|
|
37
|
+
integration: service-level integration tests without external network dependency
|
|
38
|
+
network: tests requiring external network or third-party services
|
|
39
|
+
|
|
40
|
+
[isort]
|
|
41
|
+
profile = black
|
|
42
|
+
line_length = 120
|
|
43
|
+
skip = .git,__pycache__,.env,venv,.venv,local,node_modules
|
|
44
|
+
skip_glob = */node_modules/*
|
|
45
|
+
known_first_party = config,storage,analyzer,notification,scheduler,search_service,market_analyzer,stock_analyzer,data_provider
|
|
46
|
+
|
|
47
|
+
[egg_info]
|
|
48
|
+
tag_build =
|
|
49
|
+
tag_date = 0
|
|
50
|
+
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Agent module for stock analysis system.
|
|
4
|
+
|
|
5
|
+
Provides LLM-based agent with tool-calling capabilities,
|
|
6
|
+
pluggable trading strategies, and multi-turn conversation support.
|
|
7
|
+
|
|
8
|
+
Enabled via AGENT_MODE=true environment variable.
|
|
9
|
+
|
|
10
|
+
Use explicit imports to avoid pulling in heavy dependencies (e.g. json_repair)
|
|
11
|
+
when only lightweight sub-modules like tools.registry are needed::
|
|
12
|
+
|
|
13
|
+
from src.agent.executor import AgentExecutor, AgentResult
|
|
14
|
+
from src.agent.runner import run_agent_loop, RunLoopResult
|
|
15
|
+
from src.agent.protocols import AgentContext, AgentOpinion, StageResult, AgentRunStats
|
|
16
|
+
from src.agent.orchestrator import AgentOrchestrator
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def __getattr__(name):
|
|
21
|
+
"""Lazy import to avoid triggering json_repair etc. on package access."""
|
|
22
|
+
if name == "AgentExecutor":
|
|
23
|
+
from src.agent.executor import AgentExecutor
|
|
24
|
+
return AgentExecutor
|
|
25
|
+
if name == "AgentResult":
|
|
26
|
+
from src.agent.executor import AgentResult
|
|
27
|
+
return AgentResult
|
|
28
|
+
if name == "RunLoopResult":
|
|
29
|
+
from src.agent.runner import RunLoopResult
|
|
30
|
+
return RunLoopResult
|
|
31
|
+
if name in ("AgentContext", "AgentOpinion", "StageResult", "AgentRunStats"):
|
|
32
|
+
from src.agent import protocols
|
|
33
|
+
return getattr(protocols, name)
|
|
34
|
+
if name == "AgentOrchestrator":
|
|
35
|
+
from src.agent.orchestrator import AgentOrchestrator
|
|
36
|
+
return AgentOrchestrator
|
|
37
|
+
if name == "AgentMemory":
|
|
38
|
+
from src.agent.memory import AgentMemory
|
|
39
|
+
return AgentMemory
|
|
40
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"AgentExecutor",
|
|
45
|
+
"AgentResult",
|
|
46
|
+
"RunLoopResult",
|
|
47
|
+
"AgentContext",
|
|
48
|
+
"AgentOpinion",
|
|
49
|
+
"StageResult",
|
|
50
|
+
"AgentRunStats",
|
|
51
|
+
"AgentOrchestrator",
|
|
52
|
+
"AgentMemory",
|
|
53
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Specialised agents for the multi-agent pipeline.
|
|
4
|
+
|
|
5
|
+
Each agent class inherits from :class:`BaseAgent` and implements
|
|
6
|
+
a focused analysis scope (technical, intelligence, decision, risk).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from src.agent.agents.base_agent import BaseAgent
|
|
10
|
+
from src.agent.agents.technical_agent import TechnicalAgent
|
|
11
|
+
from src.agent.agents.intel_agent import IntelAgent
|
|
12
|
+
from src.agent.agents.decision_agent import DecisionAgent
|
|
13
|
+
from src.agent.agents.risk_agent import RiskAgent
|
|
14
|
+
from src.agent.agents.portfolio_agent import PortfolioAgent
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"BaseAgent",
|
|
18
|
+
"TechnicalAgent",
|
|
19
|
+
"IntelAgent",
|
|
20
|
+
"DecisionAgent",
|
|
21
|
+
"RiskAgent",
|
|
22
|
+
"PortfolioAgent",
|
|
23
|
+
]
|