quantwise 1.2.0 → 1.2.2

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.
Files changed (362) hide show
  1. package/.claude/skills/README.md +80 -0
  2. package/.claude/skills/backtest-expert/SKILL.md +206 -0
  3. package/.claude/skills/backtest-expert/references/failed_tests.md +236 -0
  4. package/.claude/skills/backtest-expert/references/methodology.md +227 -0
  5. package/.claude/skills/breadth-chart-analyst/SKILL.md +583 -0
  6. package/.claude/skills/breadth-chart-analyst/assets/SP500_Breadth_Index_200MA_8MA.jpeg +0 -0
  7. package/.claude/skills/breadth-chart-analyst/assets/US_Stock_Market_Uptrend_Ratio.jpeg +0 -0
  8. package/.claude/skills/breadth-chart-analyst/assets/breadth_analysis_template.md +558 -0
  9. package/.claude/skills/breadth-chart-analyst/references/breadth_chart_methodology.md +590 -0
  10. package/.claude/skills/canslim-screener/SKILL.md +599 -0
  11. package/.claude/skills/canslim-screener/references/canslim_methodology.md +606 -0
  12. package/.claude/skills/canslim-screener/references/fmp_api_endpoints.md +707 -0
  13. package/.claude/skills/canslim-screener/references/interpretation_guide.md +516 -0
  14. package/.claude/skills/canslim-screener/references/scoring_system.md +597 -0
  15. package/.claude/skills/canslim-screener/scripts/calculators/earnings_calculator.py +343 -0
  16. package/.claude/skills/canslim-screener/scripts/calculators/growth_calculator.py +334 -0
  17. package/.claude/skills/canslim-screener/scripts/calculators/institutional_calculator.py +347 -0
  18. package/.claude/skills/canslim-screener/scripts/calculators/leadership_calculator.py +380 -0
  19. package/.claude/skills/canslim-screener/scripts/calculators/market_calculator.py +244 -0
  20. package/.claude/skills/canslim-screener/scripts/calculators/new_highs_calculator.py +194 -0
  21. package/.claude/skills/canslim-screener/scripts/calculators/supply_demand_calculator.py +221 -0
  22. package/.claude/skills/canslim-screener/scripts/finviz_stock_client.py +227 -0
  23. package/.claude/skills/canslim-screener/scripts/fmp_client.py +393 -0
  24. package/.claude/skills/canslim-screener/scripts/report_generator.py +405 -0
  25. package/.claude/skills/canslim-screener/scripts/scorer.py +625 -0
  26. package/.claude/skills/canslim-screener/scripts/screen_canslim.py +361 -0
  27. package/.claude/skills/canslim-screener/scripts/test_institutional_endpoint.py +109 -0
  28. package/.claude/skills/chart/SKILL.md +20 -0
  29. package/.claude/skills/dividend-growth-pullback-screener/SKILL.md +322 -0
  30. package/.claude/skills/dividend-growth-pullback-screener/references/dividend_growth_compounding.md +400 -0
  31. package/.claude/skills/dividend-growth-pullback-screener/references/fmp_api_guide.md +642 -0
  32. package/.claude/skills/dividend-growth-pullback-screener/references/rsi_oversold_strategy.md +333 -0
  33. package/.claude/skills/dividend-growth-pullback-screener/scripts/screen_dividend_growth_rsi.py +1155 -0
  34. package/.claude/skills/earnings-calendar/SKILL.md +721 -0
  35. package/.claude/skills/earnings-calendar/assets/earnings_report_template.md +102 -0
  36. package/.claude/skills/earnings-calendar/references/fmp_api_guide.md +590 -0
  37. package/.claude/skills/earnings-calendar/scripts/fetch_earnings_fmp.py +443 -0
  38. package/.claude/skills/earnings-calendar/scripts/generate_report.py +366 -0
  39. package/.claude/skills/economic-calendar-fetcher/SKILL.md +365 -0
  40. package/.claude/skills/economic-calendar-fetcher/references/fmp_api_documentation.md +345 -0
  41. package/.claude/skills/economic-calendar-fetcher/scripts/get_economic_calendar.py +267 -0
  42. package/.claude/skills/ftd-detector/SKILL.md +147 -0
  43. package/.claude/skills/ftd-detector/references/ftd_methodology.md +188 -0
  44. package/.claude/skills/ftd-detector/references/post_ftd_guide.md +185 -0
  45. package/.claude/skills/ftd-detector/scripts/fmp_client.py +158 -0
  46. package/.claude/skills/ftd-detector/scripts/ftd_detector.py +280 -0
  47. package/.claude/skills/ftd-detector/scripts/post_ftd_monitor.py +404 -0
  48. package/.claude/skills/ftd-detector/scripts/rally_tracker.py +508 -0
  49. package/.claude/skills/ftd-detector/scripts/report_generator.py +341 -0
  50. package/.claude/skills/ftd-detector/scripts/tests/conftest.py +9 -0
  51. package/.claude/skills/ftd-detector/scripts/tests/helpers.py +107 -0
  52. package/.claude/skills/ftd-detector/scripts/tests/test_post_ftd_monitor.py +311 -0
  53. package/.claude/skills/ftd-detector/scripts/tests/test_rally_tracker.py +302 -0
  54. package/.claude/skills/institutional-flow-tracker/README.md +362 -0
  55. package/.claude/skills/institutional-flow-tracker/SKILL.md +357 -0
  56. package/.claude/skills/institutional-flow-tracker/references/13f_filings_guide.md +383 -0
  57. package/.claude/skills/institutional-flow-tracker/references/institutional_investor_types.md +580 -0
  58. package/.claude/skills/institutional-flow-tracker/references/interpretation_framework.md +573 -0
  59. package/.claude/skills/institutional-flow-tracker/scripts/analyze_single_stock.py +457 -0
  60. package/.claude/skills/institutional-flow-tracker/scripts/track_institution_portfolio.py +108 -0
  61. package/.claude/skills/institutional-flow-tracker/scripts/track_institutional_flow.py +450 -0
  62. package/.claude/skills/macro-regime-detector/SKILL.md +86 -0
  63. package/.claude/skills/macro-regime-detector/references/historical_regimes.md +124 -0
  64. package/.claude/skills/macro-regime-detector/references/indicator_interpretation_guide.md +144 -0
  65. package/.claude/skills/macro-regime-detector/references/regime_detection_methodology.md +138 -0
  66. package/.claude/skills/macro-regime-detector/scripts/calculators/__init__.py +1 -0
  67. package/.claude/skills/macro-regime-detector/scripts/calculators/concentration_calculator.py +165 -0
  68. package/.claude/skills/macro-regime-detector/scripts/calculators/credit_conditions_calculator.py +124 -0
  69. package/.claude/skills/macro-regime-detector/scripts/calculators/equity_bond_calculator.py +198 -0
  70. package/.claude/skills/macro-regime-detector/scripts/calculators/sector_rotation_calculator.py +123 -0
  71. package/.claude/skills/macro-regime-detector/scripts/calculators/size_factor_calculator.py +131 -0
  72. package/.claude/skills/macro-regime-detector/scripts/calculators/utils.py +347 -0
  73. package/.claude/skills/macro-regime-detector/scripts/calculators/yield_curve_calculator.py +279 -0
  74. package/.claude/skills/macro-regime-detector/scripts/fmp_client.py +134 -0
  75. package/.claude/skills/macro-regime-detector/scripts/macro_regime_detector.py +278 -0
  76. package/.claude/skills/macro-regime-detector/scripts/report_generator.py +327 -0
  77. package/.claude/skills/macro-regime-detector/scripts/scorer.py +574 -0
  78. package/.claude/skills/macro-regime-detector/scripts/tests/conftest.py +9 -0
  79. package/.claude/skills/macro-regime-detector/scripts/tests/test_concentration.py +78 -0
  80. package/.claude/skills/macro-regime-detector/scripts/tests/test_credit_conditions.py +59 -0
  81. package/.claude/skills/macro-regime-detector/scripts/tests/test_equity_bond.py +74 -0
  82. package/.claude/skills/macro-regime-detector/scripts/tests/test_helpers.py +90 -0
  83. package/.claude/skills/macro-regime-detector/scripts/tests/test_scorer.py +439 -0
  84. package/.claude/skills/macro-regime-detector/scripts/tests/test_sector_rotation.py +78 -0
  85. package/.claude/skills/macro-regime-detector/scripts/tests/test_size_factor.py +59 -0
  86. package/.claude/skills/macro-regime-detector/scripts/tests/test_utils.py +126 -0
  87. package/.claude/skills/macro-regime-detector/scripts/tests/test_yield_curve.py +64 -0
  88. package/.claude/skills/market-breadth-analyzer/SKILL.md +121 -0
  89. package/.claude/skills/market-breadth-analyzer/references/breadth_analysis_methodology.md +168 -0
  90. package/.claude/skills/market-breadth-analyzer/scripts/calculators/__init__.py +1 -0
  91. package/.claude/skills/market-breadth-analyzer/scripts/calculators/bearish_signal_calculator.py +150 -0
  92. package/.claude/skills/market-breadth-analyzer/scripts/calculators/cycle_calculator.py +168 -0
  93. package/.claude/skills/market-breadth-analyzer/scripts/calculators/divergence_calculator.py +119 -0
  94. package/.claude/skills/market-breadth-analyzer/scripts/calculators/historical_context_calculator.py +120 -0
  95. package/.claude/skills/market-breadth-analyzer/scripts/calculators/ma_crossover_calculator.py +115 -0
  96. package/.claude/skills/market-breadth-analyzer/scripts/calculators/trend_level_calculator.py +103 -0
  97. package/.claude/skills/market-breadth-analyzer/scripts/csv_client.py +225 -0
  98. package/.claude/skills/market-breadth-analyzer/scripts/market_breadth_analyzer.py +307 -0
  99. package/.claude/skills/market-breadth-analyzer/scripts/report_generator.py +330 -0
  100. package/.claude/skills/market-breadth-analyzer/scripts/scorer.py +271 -0
  101. package/.claude/skills/market-environment-analysis/SKILL.md +139 -0
  102. package/.claude/skills/market-environment-analysis/references/analysis_patterns.md +124 -0
  103. package/.claude/skills/market-environment-analysis/references/indicators.md +99 -0
  104. package/.claude/skills/market-environment-analysis/scripts/market_utils.py +127 -0
  105. package/.claude/skills/market-news-analyst/SKILL.md +714 -0
  106. package/.claude/skills/market-news-analyst/references/corporate_news_impact.md +446 -0
  107. package/.claude/skills/market-news-analyst/references/geopolitical_commodity_correlations.md +499 -0
  108. package/.claude/skills/market-news-analyst/references/market_event_patterns.md +393 -0
  109. package/.claude/skills/market-news-analyst/references/trusted_news_sources.md +510 -0
  110. package/.claude/skills/market-top-detector/SKILL.md +159 -0
  111. package/.claude/skills/market-top-detector/references/distribution_day_guide.md +100 -0
  112. package/.claude/skills/market-top-detector/references/historical_tops.md +142 -0
  113. package/.claude/skills/market-top-detector/references/market_top_methodology.md +167 -0
  114. package/.claude/skills/market-top-detector/scripts/calculators/__init__.py +17 -0
  115. package/.claude/skills/market-top-detector/scripts/calculators/breadth_calculator.py +116 -0
  116. package/.claude/skills/market-top-detector/scripts/calculators/defensive_rotation_calculator.py +127 -0
  117. package/.claude/skills/market-top-detector/scripts/calculators/distribution_day_calculator.py +161 -0
  118. package/.claude/skills/market-top-detector/scripts/calculators/index_technical_calculator.py +254 -0
  119. package/.claude/skills/market-top-detector/scripts/calculators/leading_stock_calculator.py +198 -0
  120. package/.claude/skills/market-top-detector/scripts/calculators/sentiment_calculator.py +213 -0
  121. package/.claude/skills/market-top-detector/scripts/fmp_client.py +158 -0
  122. package/.claude/skills/market-top-detector/scripts/market_top_detector.py +349 -0
  123. package/.claude/skills/market-top-detector/scripts/report_generator.py +314 -0
  124. package/.claude/skills/market-top-detector/scripts/scorer.py +473 -0
  125. package/.claude/skills/market-top-detector/scripts/tests/conftest.py +9 -0
  126. package/.claude/skills/market-top-detector/scripts/tests/helpers.py +49 -0
  127. package/.claude/skills/market-top-detector/scripts/tests/test_breadth.py +62 -0
  128. package/.claude/skills/market-top-detector/scripts/tests/test_defensive_rotation.py +56 -0
  129. package/.claude/skills/market-top-detector/scripts/tests/test_distribution_day.py +92 -0
  130. package/.claude/skills/market-top-detector/scripts/tests/test_index_technical.py +73 -0
  131. package/.claude/skills/market-top-detector/scripts/tests/test_leading_stock.py +57 -0
  132. package/.claude/skills/market-top-detector/scripts/tests/test_scorer.py +180 -0
  133. package/.claude/skills/market-top-detector/scripts/tests/test_sentiment.py +64 -0
  134. package/.claude/skills/options-strategy-advisor/README.md +469 -0
  135. package/.claude/skills/options-strategy-advisor/SKILL.md +959 -0
  136. package/.claude/skills/options-strategy-advisor/scripts/black_scholes.py +495 -0
  137. package/.claude/skills/pair-trade-screener/README.md +389 -0
  138. package/.claude/skills/pair-trade-screener/SKILL.md +622 -0
  139. package/.claude/skills/pair-trade-screener/references/cointegration_guide.md +745 -0
  140. package/.claude/skills/pair-trade-screener/references/methodology.md +853 -0
  141. package/.claude/skills/pair-trade-screener/scripts/analyze_spread.py +394 -0
  142. package/.claude/skills/pair-trade-screener/scripts/find_pairs.py +535 -0
  143. package/.claude/skills/portfolio-manager/README.md +394 -0
  144. package/.claude/skills/portfolio-manager/SKILL.md +750 -0
  145. package/.claude/skills/portfolio-manager/references/alpaca-mcp-setup.md +367 -0
  146. package/.claude/skills/portfolio-manager/references/asset-allocation.md +502 -0
  147. package/.claude/skills/portfolio-manager/references/diversification-principles.md +553 -0
  148. package/.claude/skills/portfolio-manager/references/portfolio-risk-metrics.md +603 -0
  149. package/.claude/skills/portfolio-manager/references/position-evaluation.md +477 -0
  150. package/.claude/skills/portfolio-manager/references/rebalancing-strategies.md +715 -0
  151. package/.claude/skills/portfolio-manager/references/risk-profile-questionnaire.md +608 -0
  152. package/.claude/skills/portfolio-manager/references/target-allocations.md +558 -0
  153. package/.claude/skills/portfolio-manager/scripts/test_alpaca_connection.py +286 -0
  154. package/.claude/skills/scenario-analyzer/SKILL.md +317 -0
  155. package/.claude/skills/scenario-analyzer/references/headline_event_patterns.md +264 -0
  156. package/.claude/skills/scenario-analyzer/references/scenario_playbooks.md +320 -0
  157. package/.claude/skills/scenario-analyzer/references/sector_sensitivity_matrix.md +217 -0
  158. package/.claude/skills/sector-analyst/SKILL.md +206 -0
  159. package/.claude/skills/sector-analyst/assets/industory_performance_1.jpeg +0 -0
  160. package/.claude/skills/sector-analyst/assets/industory_performance_2.jpeg +0 -0
  161. package/.claude/skills/sector-analyst/assets/sector_performance.jpeg +0 -0
  162. package/.claude/skills/sector-analyst/references/sector_rotation.md +170 -0
  163. package/.claude/skills/stanley-druckenmiller-investment/SKILL.md +84 -0
  164. package/.claude/skills/stanley-druckenmiller-investment/references/case-studies.md +148 -0
  165. package/.claude/skills/stanley-druckenmiller-investment/references/investment-philosophy.md +80 -0
  166. package/.claude/skills/stanley-druckenmiller-investment/references/market-analysis-guide.md +146 -0
  167. package/.claude/skills/stock/NOTION_SETUP.md +33 -0
  168. package/.claude/skills/stock/SKILL.md +38 -0
  169. package/.claude/skills/technical-analyst/SKILL.md +238 -0
  170. package/.claude/skills/technical-analyst/assets/analysis_template.md +183 -0
  171. package/.claude/skills/technical-analyst/references/technical_analysis_framework.md +282 -0
  172. package/.claude/skills/theme-detector/SKILL.md +320 -0
  173. package/.claude/skills/theme-detector/assets/report_template.md +155 -0
  174. package/.claude/skills/theme-detector/references/cross_sector_themes.md +252 -0
  175. package/.claude/skills/theme-detector/references/finviz_industry_codes.md +403 -0
  176. package/.claude/skills/theme-detector/references/thematic_etf_catalog.md +333 -0
  177. package/.claude/skills/theme-detector/references/theme_detection_methodology.md +430 -0
  178. package/.claude/skills/theme-detector/scripts/calculators/__init__.py +1 -0
  179. package/.claude/skills/theme-detector/scripts/calculators/heat_calculator.py +123 -0
  180. package/.claude/skills/theme-detector/scripts/calculators/industry_ranker.py +98 -0
  181. package/.claude/skills/theme-detector/scripts/calculators/lifecycle_calculator.py +172 -0
  182. package/.claude/skills/theme-detector/scripts/calculators/theme_classifier.py +195 -0
  183. package/.claude/skills/theme-detector/scripts/calculators/theme_discoverer.py +280 -0
  184. package/.claude/skills/theme-detector/scripts/config_loader.py +142 -0
  185. package/.claude/skills/theme-detector/scripts/default_theme_config.py +254 -0
  186. package/.claude/skills/theme-detector/scripts/etf_scanner.py +609 -0
  187. package/.claude/skills/theme-detector/scripts/finviz_performance_client.py +131 -0
  188. package/.claude/skills/theme-detector/scripts/report_generator.py +490 -0
  189. package/.claude/skills/theme-detector/scripts/representative_stock_selector.py +673 -0
  190. package/.claude/skills/theme-detector/scripts/scorer.py +87 -0
  191. package/.claude/skills/theme-detector/scripts/tests/README.md +21 -0
  192. package/.claude/skills/theme-detector/scripts/tests/conftest.py +9 -0
  193. package/.claude/skills/theme-detector/scripts/tests/test_config_loader.py +239 -0
  194. package/.claude/skills/theme-detector/scripts/tests/test_etf_scanner.py +810 -0
  195. package/.claude/skills/theme-detector/scripts/tests/test_heat_calculator.py +245 -0
  196. package/.claude/skills/theme-detector/scripts/tests/test_industry_ranker.py +256 -0
  197. package/.claude/skills/theme-detector/scripts/tests/test_lifecycle_calculator.py +301 -0
  198. package/.claude/skills/theme-detector/scripts/tests/test_report_generator.py +624 -0
  199. package/.claude/skills/theme-detector/scripts/tests/test_representative_stock_selector.py +898 -0
  200. package/.claude/skills/theme-detector/scripts/tests/test_scorer.py +185 -0
  201. package/.claude/skills/theme-detector/scripts/tests/test_theme_classifier.py +534 -0
  202. package/.claude/skills/theme-detector/scripts/tests/test_theme_detector_e2e.py +467 -0
  203. package/.claude/skills/theme-detector/scripts/tests/test_theme_discoverer.py +458 -0
  204. package/.claude/skills/theme-detector/scripts/tests/test_uptrend_client.py +76 -0
  205. package/.claude/skills/theme-detector/scripts/theme_detector.py +815 -0
  206. package/.claude/skills/theme-detector/scripts/themes.yaml +168 -0
  207. package/.claude/skills/theme-detector/scripts/uptrend_client.py +241 -0
  208. package/.claude/skills/uptrend-analyzer/SKILL.md +108 -0
  209. package/.claude/skills/uptrend-analyzer/references/uptrend_methodology.md +215 -0
  210. package/.claude/skills/uptrend-analyzer/scripts/calculators/__init__.py +1 -0
  211. package/.claude/skills/uptrend-analyzer/scripts/calculators/historical_context_calculator.py +122 -0
  212. package/.claude/skills/uptrend-analyzer/scripts/calculators/market_breadth_calculator.py +145 -0
  213. package/.claude/skills/uptrend-analyzer/scripts/calculators/momentum_calculator.py +183 -0
  214. package/.claude/skills/uptrend-analyzer/scripts/calculators/sector_participation_calculator.py +204 -0
  215. package/.claude/skills/uptrend-analyzer/scripts/calculators/sector_rotation_calculator.py +218 -0
  216. package/.claude/skills/uptrend-analyzer/scripts/data_fetcher.py +236 -0
  217. package/.claude/skills/uptrend-analyzer/scripts/report_generator.py +329 -0
  218. package/.claude/skills/uptrend-analyzer/scripts/scorer.py +276 -0
  219. package/.claude/skills/uptrend-analyzer/scripts/uptrend_analyzer.py +219 -0
  220. package/.claude/skills/us-market-bubble-detector/CHANGELOG.md +118 -0
  221. package/.claude/skills/us-market-bubble-detector/SKILL.md +545 -0
  222. package/.claude/skills/us-market-bubble-detector/references/bubble_framework.md +335 -0
  223. package/.claude/skills/us-market-bubble-detector/references/historical_cases.md +327 -0
  224. package/.claude/skills/us-market-bubble-detector/references/implementation_guide.md +473 -0
  225. package/.claude/skills/us-market-bubble-detector/references/quick_reference.md +354 -0
  226. package/.claude/skills/us-market-bubble-detector/references/quick_reference_en.md +342 -0
  227. package/.claude/skills/us-market-bubble-detector/scripts/bubble_scorer.py +309 -0
  228. package/.claude/skills/us-stock-analysis/SKILL.md +294 -0
  229. package/.claude/skills/us-stock-analysis/references/financial-metrics.md +172 -0
  230. package/.claude/skills/us-stock-analysis/references/fundamental-analysis.md +129 -0
  231. package/.claude/skills/us-stock-analysis/references/report-template.md +207 -0
  232. package/.claude/skills/us-stock-analysis/references/technical-analysis.md +93 -0
  233. package/.claude/skills/value-dividend-screener/SKILL.md +562 -0
  234. package/.claude/skills/value-dividend-screener/references/fmp_api_guide.md +348 -0
  235. package/.claude/skills/value-dividend-screener/references/screening_methodology.md +315 -0
  236. package/.claude/skills/value-dividend-screener/scripts/screen_dividend_stocks.py +1138 -0
  237. package/.claude/skills/vcp-screener/SKILL.md +79 -0
  238. package/.claude/skills/vcp-screener/references/fmp_api_endpoints.md +45 -0
  239. package/.claude/skills/vcp-screener/references/scoring_system.md +154 -0
  240. package/.claude/skills/vcp-screener/references/vcp_methodology.md +124 -0
  241. package/.claude/skills/vcp-screener/scripts/calculators/__init__.py +1 -0
  242. package/.claude/skills/vcp-screener/scripts/calculators/pivot_proximity_calculator.py +139 -0
  243. package/.claude/skills/vcp-screener/scripts/calculators/relative_strength_calculator.py +161 -0
  244. package/.claude/skills/vcp-screener/scripts/calculators/trend_template_calculator.py +228 -0
  245. package/.claude/skills/vcp-screener/scripts/calculators/vcp_pattern_calculator.py +322 -0
  246. package/.claude/skills/vcp-screener/scripts/calculators/volume_pattern_calculator.py +121 -0
  247. package/.claude/skills/vcp-screener/scripts/fmp_client.py +162 -0
  248. package/.claude/skills/vcp-screener/scripts/report_generator.py +317 -0
  249. package/.claude/skills/vcp-screener/scripts/scorer.py +155 -0
  250. package/.claude/skills/vcp-screener/scripts/screen_vcp.py +536 -0
  251. package/.claude/skills/vcp-screener/scripts/tests/__init__.py +0 -0
  252. package/.claude/skills/vcp-screener/scripts/tests/conftest.py +9 -0
  253. package/.claude/skills/vcp-screener/scripts/tests/test_vcp_screener.py +834 -0
  254. package/.claude/skills/weekly-trade-strategy/.claude/agents/druckenmiller-strategy-planner.md +300 -0
  255. package/.claude/skills/weekly-trade-strategy/.claude/agents/market-news-analyzer.md +239 -0
  256. package/.claude/skills/weekly-trade-strategy/.claude/agents/technical-market-analyst.md +187 -0
  257. package/.claude/skills/weekly-trade-strategy/.claude/agents/us-market-analyst.md +218 -0
  258. package/.claude/skills/weekly-trade-strategy/.claude/agents/weekly-trade-blog-writer.md +318 -0
  259. package/.claude/skills/weekly-trade-strategy/.claude/skills/breadth-chart-analyst/SKILL.md +662 -0
  260. package/.claude/skills/weekly-trade-strategy/.claude/skills/breadth-chart-analyst/assets/SP500_Breadth_Index_200MA_8MA.jpeg +0 -0
  261. package/.claude/skills/weekly-trade-strategy/.claude/skills/breadth-chart-analyst/assets/US_Stock_Market_Uptrend_Ratio.jpeg +0 -0
  262. package/.claude/skills/weekly-trade-strategy/.claude/skills/breadth-chart-analyst/assets/breadth_analysis_template.md +558 -0
  263. package/.claude/skills/weekly-trade-strategy/.claude/skills/breadth-chart-analyst/references/breadth_chart_methodology.md +590 -0
  264. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/SKILL.md +721 -0
  265. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/assets/earnings_report_template.md +102 -0
  266. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/earnings_calendar_2025-11-02.md +447 -0
  267. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/references/fmp_api_guide.md +590 -0
  268. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/scripts/fetch_earnings_fmp.py +443 -0
  269. package/.claude/skills/weekly-trade-strategy/.claude/skills/earnings-calendar/scripts/generate_report.py +366 -0
  270. package/.claude/skills/weekly-trade-strategy/.claude/skills/economic-calendar-fetcher/SKILL.md +365 -0
  271. package/.claude/skills/weekly-trade-strategy/.claude/skills/economic-calendar-fetcher/references/fmp_api_documentation.md +345 -0
  272. package/.claude/skills/weekly-trade-strategy/.claude/skills/economic-calendar-fetcher/scripts/get_economic_calendar.py +267 -0
  273. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-environment-analysis/SKILL.md +139 -0
  274. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-environment-analysis/references/analysis_patterns.md +124 -0
  275. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-environment-analysis/references/indicators.md +99 -0
  276. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-environment-analysis/scripts/market_utils.py +127 -0
  277. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-news-analyst/SKILL.md +714 -0
  278. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-news-analyst/references/corporate_news_impact.md +446 -0
  279. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-news-analyst/references/geopolitical_commodity_correlations.md +499 -0
  280. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-news-analyst/references/market_event_patterns.md +393 -0
  281. package/.claude/skills/weekly-trade-strategy/.claude/skills/market-news-analyst/references/trusted_news_sources.md +510 -0
  282. package/.claude/skills/weekly-trade-strategy/.claude/skills/sector-analyst/SKILL.md +206 -0
  283. package/.claude/skills/weekly-trade-strategy/.claude/skills/sector-analyst/assets/industory_performance_1.jpeg +0 -0
  284. package/.claude/skills/weekly-trade-strategy/.claude/skills/sector-analyst/assets/industory_performance_2.jpeg +0 -0
  285. package/.claude/skills/weekly-trade-strategy/.claude/skills/sector-analyst/assets/sector_performance.jpeg +0 -0
  286. package/.claude/skills/weekly-trade-strategy/.claude/skills/sector-analyst/references/sector_rotation.md +170 -0
  287. package/.claude/skills/weekly-trade-strategy/.claude/skills/stanley-druckenmiller-investment/SKILL.md +84 -0
  288. package/.claude/skills/weekly-trade-strategy/.claude/skills/stanley-druckenmiller-investment/references/case-studies.md +148 -0
  289. package/.claude/skills/weekly-trade-strategy/.claude/skills/stanley-druckenmiller-investment/references/investment-philosophy.md +80 -0
  290. package/.claude/skills/weekly-trade-strategy/.claude/skills/stanley-druckenmiller-investment/references/market-analysis-guide.md +146 -0
  291. package/.claude/skills/weekly-trade-strategy/.claude/skills/technical-analyst/SKILL.md +238 -0
  292. package/.claude/skills/weekly-trade-strategy/.claude/skills/technical-analyst/assets/analysis_template.md +183 -0
  293. package/.claude/skills/weekly-trade-strategy/.claude/skills/technical-analyst/references/technical_analysis_framework.md +282 -0
  294. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/CHANGELOG.md +118 -0
  295. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/SKILL.md +545 -0
  296. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/references/bubble_framework.md +335 -0
  297. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/references/historical_cases.md +327 -0
  298. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/references/implementation_guide.md +473 -0
  299. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/references/quick_reference.md +354 -0
  300. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/references/quick_reference_en.md +342 -0
  301. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-market-bubble-detector/scripts/bubble_scorer.py +309 -0
  302. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-stock-analysis/SKILL.md +294 -0
  303. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-stock-analysis/references/financial-metrics.md +172 -0
  304. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-stock-analysis/references/fundamental-analysis.md +129 -0
  305. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-stock-analysis/references/report-template.md +207 -0
  306. package/.claude/skills/weekly-trade-strategy/.claude/skills/us-stock-analysis/references/technical-analysis.md +93 -0
  307. package/.claude/skills/weekly-trade-strategy/CLAUDE.md +454 -0
  308. package/.claude/skills/weekly-trade-strategy/README.md +287 -0
  309. package/.claude/skills/weekly-trade-strategy/blogs/.gitkeep +0 -0
  310. package/.claude/skills/weekly-trade-strategy/charts/.gitkeep +0 -0
  311. package/.claude/skills/weekly-trade-strategy/earnings_data.json +10054 -0
  312. package/.claude/skills/weekly-trade-strategy/skills/breadth-chart-analyst/SKILL.md +662 -0
  313. package/.claude/skills/weekly-trade-strategy/skills/breadth-chart-analyst/assets/SP500_Breadth_Index_200MA_8MA.jpeg +0 -0
  314. package/.claude/skills/weekly-trade-strategy/skills/breadth-chart-analyst/assets/US_Stock_Market_Uptrend_Ratio.jpeg +0 -0
  315. package/.claude/skills/weekly-trade-strategy/skills/breadth-chart-analyst/assets/breadth_analysis_template.md +558 -0
  316. package/.claude/skills/weekly-trade-strategy/skills/breadth-chart-analyst/references/breadth_chart_methodology.md +590 -0
  317. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/SKILL.md +721 -0
  318. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/assets/earnings_report_template.md +102 -0
  319. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/earnings_calendar_2025-11-02.md +447 -0
  320. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/references/fmp_api_guide.md +590 -0
  321. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/scripts/fetch_earnings_fmp.py +443 -0
  322. package/.claude/skills/weekly-trade-strategy/skills/earnings-calendar/scripts/generate_report.py +366 -0
  323. package/.claude/skills/weekly-trade-strategy/skills/economic-calendar-fetcher/SKILL.md +365 -0
  324. package/.claude/skills/weekly-trade-strategy/skills/economic-calendar-fetcher/references/fmp_api_documentation.md +345 -0
  325. package/.claude/skills/weekly-trade-strategy/skills/economic-calendar-fetcher/scripts/get_economic_calendar.py +267 -0
  326. package/.claude/skills/weekly-trade-strategy/skills/market-environment-analysis/SKILL.md +139 -0
  327. package/.claude/skills/weekly-trade-strategy/skills/market-environment-analysis/references/analysis_patterns.md +124 -0
  328. package/.claude/skills/weekly-trade-strategy/skills/market-environment-analysis/references/indicators.md +99 -0
  329. package/.claude/skills/weekly-trade-strategy/skills/market-environment-analysis/scripts/market_utils.py +127 -0
  330. package/.claude/skills/weekly-trade-strategy/skills/market-news-analyst/SKILL.md +714 -0
  331. package/.claude/skills/weekly-trade-strategy/skills/market-news-analyst/references/corporate_news_impact.md +446 -0
  332. package/.claude/skills/weekly-trade-strategy/skills/market-news-analyst/references/geopolitical_commodity_correlations.md +499 -0
  333. package/.claude/skills/weekly-trade-strategy/skills/market-news-analyst/references/market_event_patterns.md +393 -0
  334. package/.claude/skills/weekly-trade-strategy/skills/market-news-analyst/references/trusted_news_sources.md +510 -0
  335. package/.claude/skills/weekly-trade-strategy/skills/sector-analyst/SKILL.md +206 -0
  336. package/.claude/skills/weekly-trade-strategy/skills/sector-analyst/assets/industory_performance_1.jpeg +0 -0
  337. package/.claude/skills/weekly-trade-strategy/skills/sector-analyst/assets/industory_performance_2.jpeg +0 -0
  338. package/.claude/skills/weekly-trade-strategy/skills/sector-analyst/assets/sector_performance.jpeg +0 -0
  339. package/.claude/skills/weekly-trade-strategy/skills/sector-analyst/references/sector_rotation.md +170 -0
  340. package/.claude/skills/weekly-trade-strategy/skills/stanley-druckenmiller-investment/SKILL.md +84 -0
  341. package/.claude/skills/weekly-trade-strategy/skills/stanley-druckenmiller-investment/references/case-studies.md +148 -0
  342. package/.claude/skills/weekly-trade-strategy/skills/stanley-druckenmiller-investment/references/investment-philosophy.md +80 -0
  343. package/.claude/skills/weekly-trade-strategy/skills/stanley-druckenmiller-investment/references/market-analysis-guide.md +146 -0
  344. package/.claude/skills/weekly-trade-strategy/skills/technical-analyst/SKILL.md +238 -0
  345. package/.claude/skills/weekly-trade-strategy/skills/technical-analyst/assets/analysis_template.md +183 -0
  346. package/.claude/skills/weekly-trade-strategy/skills/technical-analyst/references/technical_analysis_framework.md +282 -0
  347. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/CHANGELOG.md +118 -0
  348. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/SKILL.md +545 -0
  349. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/references/bubble_framework.md +335 -0
  350. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/references/historical_cases.md +327 -0
  351. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/references/implementation_guide.md +473 -0
  352. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/references/quick_reference.md +354 -0
  353. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/references/quick_reference_en.md +342 -0
  354. package/.claude/skills/weekly-trade-strategy/skills/us-market-bubble-detector/scripts/bubble_scorer.py +309 -0
  355. package/.claude/skills/weekly-trade-strategy/skills/us-stock-analysis/SKILL.md +294 -0
  356. package/.claude/skills/weekly-trade-strategy/skills/us-stock-analysis/references/financial-metrics.md +172 -0
  357. package/.claude/skills/weekly-trade-strategy/skills/us-stock-analysis/references/fundamental-analysis.md +129 -0
  358. package/.claude/skills/weekly-trade-strategy/skills/us-stock-analysis/references/report-template.md +207 -0
  359. package/.claude/skills/weekly-trade-strategy/skills/us-stock-analysis/references/technical-analysis.md +93 -0
  360. package/.mcp.json +3 -0
  361. package/cli.mjs +16 -16
  362. package/package.json +4 -2
@@ -0,0 +1,144 @@
1
+ # Indicator Interpretation Guide
2
+
3
+ Quick reference for interpreting each component's output values and signals.
4
+
5
+ ## Component 1: Market Concentration (RSP/SPY)
6
+
7
+ **What it measures**: Relative performance of equal-weight S&P 500 vs cap-weight S&P 500.
8
+
9
+ | RSP/SPY Trend | Interpretation | Regime Signal |
10
+ |---------------|---------------|---------------|
11
+ | Declining | Mega-caps outperforming, market narrowing | Concentration |
12
+ | Rising | Broader participation, equal-weight catching up | Broadening |
13
+ | Bottoming + turning | Potential regime shift from concentration to broadening | Transition |
14
+
15
+ **Key levels** (approximate, varies over time):
16
+ - 0.28-0.29: Extreme concentration (2024 lows)
17
+ - 0.30-0.32: Moderate concentration
18
+ - 0.33+: Broadening phase
19
+
20
+ **Crossover interpretation**:
21
+ - Golden cross (6M > 12M): Broadening gaining momentum
22
+ - Death cross (6M < 12M): Concentration deepening
23
+
24
+ ## Component 2: Yield Curve (10Y-2Y Spread)
25
+
26
+ **What it measures**: Shape of the Treasury yield curve, reflecting rate cycle position.
27
+
28
+ | Spread Level | Curve State | Typical Environment |
29
+ |-------------|-------------|-------------------|
30
+ | < -0.5% | Deeply inverted | Pre-recession, aggressive tightening |
31
+ | -0.5% to 0% | Inverted | Late-cycle, recession risk elevated |
32
+ | 0% to 0.5% | Flat/Normalizing | Transition period |
33
+ | 0.5% to 1.5% | Normal | Mid-cycle expansion |
34
+ | > 1.5% | Steep | Early recovery, accommodative policy |
35
+
36
+ **Direction signals**:
37
+ - Steepening: Either rates normalizing (bull steepener) or long end rising (bear steepener)
38
+ - Flattening: Late-cycle tightening or flight to long bonds
39
+
40
+ **Fallback (SHY/TLT proxy)**: When Treasury API is unavailable, SHY/TLT ratio provides a rough proxy. Rising SHY/TLT ≈ flattening curve. Less precise than actual spread data.
41
+
42
+ ## Component 3: Credit Conditions (HYG/LQD)
43
+
44
+ **What it measures**: Risk appetite in credit markets — willingness to hold junk bonds vs investment grade.
45
+
46
+ | HYG/LQD Trend | Interpretation | Regime Signal |
47
+ |---------------|---------------|---------------|
48
+ | Rising | Credit risk appetite expanding | Risk-on, easing |
49
+ | Falling | Flight to quality | Risk-off, tightening |
50
+ | Stable | Established credit regime | No transition |
51
+
52
+ **Why it matters**: Credit markets often lead equity markets. HYG/LQD deterioration preceded the 2020 crash by ~2 weeks and the 2008 crisis by ~3 months.
53
+
54
+ **Warning levels**:
55
+ - Sharp drop (ROC < -3% over 3 months): Potential credit event
56
+ - Persistent decline with negative ROC: Late-cycle deterioration
57
+ - Stable with positive ROC: Supportive environment for risk assets
58
+
59
+ ## Component 4: Size Factor (IWM/SPY)
60
+
61
+ **What it measures**: Relative performance of small-caps (Russell 2000) vs large-caps (S&P 500).
62
+
63
+ | IWM/SPY Trend | Interpretation | Regime Signal |
64
+ |---------------|---------------|---------------|
65
+ | Rising | Small-caps outperforming — economic optimism | Broadening |
66
+ | Falling | Large-cap preference — defensive/quality bias | Concentration |
67
+ | Diverging from RSP/SPY | Inconsistent signal — check credit conditions | Uncertain |
68
+
69
+ **Cycle position**:
70
+ - Small-cap outperformance often starts 3-6 months before economic recovery becomes consensus
71
+ - Small-cap underperformance accelerates in late-cycle as credit conditions tighten
72
+ - IWM/SPY and RSP/SPY usually move together; divergence warrants investigation
73
+
74
+ ## Component 5: Equity-Bond Relationship (SPY/TLT + Correlation)
75
+
76
+ **What it measures**: Two aspects of the stock-bond relationship.
77
+
78
+ ### SPY/TLT Ratio
79
+
80
+ | SPY/TLT Trend | Interpretation |
81
+ |---------------|---------------|
82
+ | Rising | Equities outperforming bonds (risk-on) |
83
+ | Falling | Bonds outperforming equities (risk-off) |
84
+
85
+ ### Stock-Bond Correlation (6-month rolling)
86
+
87
+ | Correlation | Regime | Implication |
88
+ |-------------|--------|-------------|
89
+ | < -0.3 | Negative (normal) | Bonds effectively hedge equity risk |
90
+ | -0.3 to 0 | Mildly negative | Hedging works but weakened |
91
+ | 0 to 0.3 | Near zero | Transitional — hedging unreliable |
92
+ | > 0.3 | Positive (inflationary) | Both move together — diversification fails |
93
+
94
+ **Critical signal**: Correlation sign change (negative → positive or vice versa) is one of the most important regime signals. Positive correlation typically occurs during:
95
+ - Inflation shocks (2022)
96
+ - Stagflation concerns
97
+ - Central bank credibility crises
98
+
99
+ **Correlation bonus scoring**: When 6M and 12M correlation have opposite signs, an additional 20 points are added to the component score, reflecting the significance of this regime shift.
100
+
101
+ ## Component 6: Sector Rotation (XLY/XLP)
102
+
103
+ **What it measures**: Consumer sentiment through discretionary vs staples spending preference.
104
+
105
+ | XLY/XLP Trend | Interpretation | Regime Signal |
106
+ |---------------|---------------|---------------|
107
+ | Rising | Consumer confidence, risk appetite | Risk-on, broadening |
108
+ | Falling | Defensive positioning, consumer caution | Risk-off, contraction |
109
+ | Stable | Established consumer sentiment | No transition |
110
+
111
+ **Why Consumer Discretionary vs Staples**:
112
+ - Most direct consumer-facing comparison
113
+ - Staples demand is relatively inelastic; discretionary is highly cyclical
114
+ - XLY includes Amazon, Tesla — captures both consumer and growth sentiment
115
+ - XLP is pure defensive (Procter & Gamble, Coca-Cola, Costco)
116
+
117
+ ## Cross-Component Analysis
118
+
119
+ ### Confirmation Patterns
120
+
121
+ **Strong Broadening Confirmation** (4+ components aligned):
122
+ - RSP/SPY ↑ + IWM/SPY ↑ + HYG/LQD stable/↑ + XLY/XLP ↑
123
+
124
+ **Strong Contraction Confirmation**:
125
+ - HYG/LQD ↓ + XLY/XLP ↓ + SPY/TLT ↓ + Yield curve steepening
126
+
127
+ **Inflationary Confirmation**:
128
+ - Stock-bond correlation positive + SPY/TLT ↓ + Yield curve behavior unusual
129
+
130
+ ### Divergence Signals
131
+
132
+ - **RSP/SPY ↑ but HYG/LQD ↓**: Broadening without credit support — fragile
133
+ - **IWM/SPY ↑ but XLY/XLP ↓**: Small-cap rally without consumer backing — suspicious
134
+ - **Yield curve steepening but HYG/LQD ↓**: Rate cuts due to crisis, not growth
135
+
136
+ ## Score Interpretation Quick Reference
137
+
138
+ | Composite Score | Zone | Action |
139
+ |----------------|------|--------|
140
+ | 0-20 | Stable | Maintain current positioning |
141
+ | 21-40 | Early Signal | Increase monitoring frequency |
142
+ | 41-60 | Transition Zone | Begin planning adjustments |
143
+ | 61-80 | Active Transition | Execute repositioning |
144
+ | 81-100 | Confirmed | Complete repositioning |
@@ -0,0 +1,138 @@
1
+ # Regime Detection Methodology
2
+
3
+ ## Overview
4
+
5
+ The Macro Regime Detector uses a 3-layer signal detection approach applied to 6 cross-asset ratios, analyzed at monthly frequency with 6-month and 12-month Simple Moving Averages.
6
+
7
+ ## Data Pipeline
8
+
9
+ ```
10
+ Daily OHLCV (600 days, ~2.4 years)
11
+ → Monthly Downsampling (last business day per month, ~24 points)
12
+ → Ratio Calculation (e.g., RSP close / SPY close)
13
+ → Moving Average Computation (6M SMA, 12M SMA)
14
+ → Signal Detection (3 layers)
15
+ → Component Scoring (0-100 per component)
16
+ → Weighted Composite (6 components)
17
+ → Regime Classification (decision tree)
18
+ → Transition Probability Assessment
19
+ ```
20
+
21
+ ## Monthly Downsampling
22
+
23
+ Daily data is downsampled to monthly frequency by selecting the most recent trading day in each calendar month. This filters out daily noise and focuses on structural trends.
24
+
25
+ Why monthly: Regime transitions are structural (1-2 year) phenomena. Daily or weekly data introduces noise without adding signal for this time horizon.
26
+
27
+ ## 3-Layer Signal Detection
28
+
29
+ ### Layer 1: MA Crossover (0-40 points)
30
+
31
+ The primary signal is the relationship between the 6-month and 12-month SMA of each ratio.
32
+
33
+ - **Golden Cross**: 6M SMA crosses above 12M SMA (recent = 40pts, older = 20pts)
34
+ - **Death Cross**: 6M SMA crosses below 12M SMA (recent = 40pts, older = 20pts)
35
+ - **Converging**: SMAs within 1% gap, no crossover yet (0-25pts based on proximity)
36
+ - **None**: SMAs well separated, established trend (0pts)
37
+
38
+ Recency matters: A crossover 1-2 months ago is much more actionable than one 6+ months ago.
39
+
40
+ ### Layer 2: Momentum Shift (0-30 points)
41
+
42
+ Compares 3-month Rate of Change (ROC) against 12-month ROC to detect early reversals.
43
+
44
+ - **Reversal Signal**: 12M ROC negative but 3M ROC positive (or vice versa). This means the long-term trend is one direction but short-term momentum has reversed — an early warning of transition.
45
+ - **Acceleration**: Strong 3M ROC in the same direction as 12M ROC confirms an existing move.
46
+
47
+ Scoring scales linearly with the magnitude of the short-term ROC (capped at 5%).
48
+
49
+ ### Layer 3: Cross-Confirmation (0-30 points)
50
+
51
+ Checks alignment of multiple signals for confirmation:
52
+
53
+ 1. Crossover is present (+10)
54
+ 2. Short-term ROC confirms the crossover direction (+10)
55
+ 3. SMA gap is widening (momentum building) (+10)
56
+
57
+ When all three align, the transition signal is strong (80-100 range).
58
+
59
+ ## Component Scoring Scale
60
+
61
+ Each component produces a score from 0 to 100, representing **transition signal strength** (not "good" or "bad"):
62
+
63
+ | Range | Interpretation |
64
+ |-------|---------------|
65
+ | 0-20 | Stable regime, no transition signal |
66
+ | 20-40 | Minor fluctuation, possibly noise |
67
+ | 40-60 | Transition zone — MAs converging, potential crossover in 3-6 months |
68
+ | 60-80 | Clear transition signal — recent crossover or sharp momentum reversal |
69
+ | 80-100 | Strong confirmed transition — crossover + momentum + acceleration aligned |
70
+
71
+ ## Composite Score
72
+
73
+ The 6 component scores are combined using fixed weights:
74
+
75
+ | Component | Weight | Rationale |
76
+ |-----------|--------|-----------|
77
+ | Market Concentration (RSP/SPY) | 25% | Primary indicator of market structure |
78
+ | Yield Curve (10Y-2Y) | 20% | Most reliable macro cycle indicator |
79
+ | Credit Conditions (HYG/LQD) | 15% | Leading indicator of financial stress |
80
+ | Size Factor (IWM/SPY) | 15% | Economic sentiment barometer |
81
+ | Equity-Bond (SPY/TLT) | 15% | Cross-asset risk regime |
82
+ | Sector Rotation (XLY/XLP) | 10% | Consumer sentiment proxy |
83
+
84
+ ## Regime Classification
85
+
86
+ A decision-tree approach scores each of 5 possible regimes based on component directions:
87
+
88
+ ### Scoring Rules
89
+
90
+ **Concentration** (+2 each):
91
+ - RSP/SPY direction = "concentrating"
92
+ - IWM/SPY direction = "large_cap_leading"
93
+ - Credit direction = stable/easing (+1)
94
+
95
+ **Broadening** (+2 each):
96
+ - RSP/SPY direction = "broadening"
97
+ - IWM/SPY direction = "small_cap_leading"
98
+ - Credit direction = stable/easing (+1)
99
+ - XLY/XLP direction = risk_on (+1)
100
+
101
+ **Contraction** (+2 each):
102
+ - Credit direction = "tightening"
103
+ - XLY/XLP direction = "risk_off"
104
+ - SPY/TLT direction = "risk_off" (+1)
105
+
106
+ **Inflationary** (+3):
107
+ - Stock-bond correlation = "positive"
108
+ - SPY/TLT direction = "risk_off" (+1)
109
+
110
+ **Transitional**: Assigned when 3+ components are signaling (score >= 40) but no regime scores >= 3.
111
+
112
+ ### Confidence Levels
113
+
114
+ - **High**: Best regime score >= 4
115
+ - **Moderate**: Best regime score >= 3
116
+ - **Low**: Best regime score >= 2
117
+ - **Very Low**: Best regime score < 2
118
+
119
+ ## Transition Probability
120
+
121
+ Combines signaling count and average component scores:
122
+
123
+ | Signaling Count | Avg Score | Probability |
124
+ |----------------|-----------|-------------|
125
+ | 4+ | >= 50 | High (70-90%) |
126
+ | 3+ | >= 40 | Moderate (40-60%) |
127
+ | 2+ | >= 30 | Low (20-40%) |
128
+ | < 2 | < 30 | Minimal (<20%) |
129
+
130
+ ## Limitations
131
+
132
+ 1. **Lagging by design**: Monthly frequency means signals appear weeks to months after daily-frequency indicators. This is intentional — the goal is structural confirmation, not early detection.
133
+
134
+ 2. **False positives**: Converging MAs can generate transition signals that reverse before completing. Always check cross-component confirmation.
135
+
136
+ 3. **Regime overlap**: Real markets often exhibit characteristics of multiple regimes simultaneously. The "Transitional" classification explicitly acknowledges this.
137
+
138
+ 4. **Historical bias**: Regime classification rules are derived from post-2000 market patterns. Novel regimes may not fit existing categories.
@@ -0,0 +1 @@
1
+ """Macro Regime Detector - Calculator modules"""
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Component 1: Market Concentration (Weight: 25%)
4
+
5
+ Analyzes RSP/SPY ratio to detect mega-cap concentration vs market broadening.
6
+
7
+ RSP (equal-weight S&P 500) / SPY (cap-weight S&P 500):
8
+ - Declining ratio = increasing concentration in mega-caps
9
+ - Rising ratio = market broadening, more stocks participating
10
+
11
+ Scoring (0-100 = Transition Signal Strength):
12
+ 0-20: Stable regime, no transition signal
13
+ 20-40: Minor fluctuation, possibly noise
14
+ 40-60: Transition zone (MAs converging, crossover possible in 3-6 months)
15
+ 60-80: Clear transition signal (recent crossover or sharp momentum reversal)
16
+ 80-100: Strong confirmed transition (crossover + momentum + acceleration aligned)
17
+ """
18
+
19
+ from typing import Dict, List, Optional
20
+ from .utils import (
21
+ downsample_to_monthly,
22
+ calculate_ratio,
23
+ compute_sma,
24
+ detect_crossover,
25
+ compute_roc,
26
+ compute_percentile,
27
+ score_transition_signal,
28
+ STALE_CROSSOVER_MONTHS,
29
+ )
30
+
31
+
32
+ def calculate_concentration(rsp_history: List[Dict],
33
+ spy_history: List[Dict]) -> Dict:
34
+ """
35
+ Calculate market concentration transition signal from RSP/SPY ratio.
36
+
37
+ Args:
38
+ rsp_history: RSP daily OHLCV (most recent first)
39
+ spy_history: SPY daily OHLCV (most recent first)
40
+
41
+ Returns:
42
+ Dict with score (0-100), signal, ratio details, MA values, momentum
43
+ """
44
+ if not rsp_history or not spy_history:
45
+ return _insufficient_data("No RSP or SPY data available")
46
+
47
+ # Downsample to monthly
48
+ rsp_monthly = downsample_to_monthly(rsp_history)
49
+ spy_monthly = downsample_to_monthly(spy_history)
50
+
51
+ if len(rsp_monthly) < 12 or len(spy_monthly) < 12:
52
+ return _insufficient_data("Insufficient monthly data (need >= 12 months)")
53
+
54
+ # Calculate RSP/SPY ratio (monthly)
55
+ ratio_series = calculate_ratio(rsp_monthly, spy_monthly)
56
+ if len(ratio_series) < 12:
57
+ return _insufficient_data("Insufficient ratio data")
58
+
59
+ # Current ratio
60
+ current_ratio = ratio_series[0]["value"]
61
+ current_date = ratio_series[0]["date"]
62
+
63
+ # Compute 6M and 12M SMAs on ratio
64
+ ratio_values = [r["value"] for r in ratio_series]
65
+ sma_6m = compute_sma(ratio_values, 6)
66
+ sma_12m = compute_sma(ratio_values, 12)
67
+
68
+ # Crossover detection (6M vs 12M)
69
+ crossover = detect_crossover(ratio_values, short_period=6, long_period=12)
70
+
71
+ # Momentum: 3-month and 12-month ROC
72
+ roc_3m = compute_roc(ratio_values, 3)
73
+ roc_12m = compute_roc(ratio_values, 12)
74
+
75
+ # Percentile of current ratio within historical range
76
+ percentile = compute_percentile(ratio_values, current_ratio)
77
+
78
+ # Score the transition signal
79
+ score = score_transition_signal(
80
+ crossover=crossover,
81
+ roc_short=roc_3m,
82
+ roc_long=roc_12m,
83
+ sma_short=sma_6m,
84
+ sma_long=sma_12m,
85
+ )
86
+
87
+ # Determine signal description
88
+ signal = _describe_signal(score, crossover, roc_3m, roc_12m, current_ratio)
89
+
90
+ # Determine direction (concentration-specific: SMA fallback preserved)
91
+ bars_ago = crossover.get("bars_ago")
92
+ is_stale = bars_ago is not None and bars_ago >= STALE_CROSSOVER_MONTHS
93
+
94
+ if crossover["type"] == "golden_cross":
95
+ direction = "broadening"
96
+ elif crossover["type"] == "death_cross":
97
+ direction = "concentrating"
98
+ elif sma_6m is not None and sma_12m is not None:
99
+ direction = "broadening" if sma_6m > sma_12m else "concentrating"
100
+ else:
101
+ direction = "unknown"
102
+
103
+ # Stale crossover override: if momentum contradicts, flip direction
104
+ momentum_qualifier = "N/A"
105
+ if crossover["type"] in ("golden_cross", "death_cross"):
106
+ cross_dir = "broadening" if crossover["type"] == "golden_cross" else "concentrating"
107
+ mom_dir = ("broadening" if roc_3m is not None and roc_3m > 0
108
+ else "concentrating" if roc_3m is not None and roc_3m < 0
109
+ else None)
110
+ if is_stale and mom_dir and mom_dir != cross_dir:
111
+ direction = mom_dir
112
+ momentum_qualifier = "reversing"
113
+ elif mom_dir == cross_dir:
114
+ momentum_qualifier = "confirmed"
115
+ elif mom_dir and mom_dir != cross_dir:
116
+ momentum_qualifier = "fading"
117
+
118
+ return {
119
+ "score": score,
120
+ "signal": signal,
121
+ "data_available": True,
122
+ "direction": direction,
123
+ "momentum_qualifier": momentum_qualifier,
124
+ "current_ratio": round(current_ratio, 4),
125
+ "current_date": current_date,
126
+ "sma_6m": round(sma_6m, 4) if sma_6m is not None else None,
127
+ "sma_12m": round(sma_12m, 4) if sma_12m is not None else None,
128
+ "roc_3m": round(roc_3m, 2) if roc_3m is not None else None,
129
+ "roc_12m": round(roc_12m, 2) if roc_12m is not None else None,
130
+ "percentile": round(percentile, 1) if percentile is not None else None,
131
+ "crossover": crossover,
132
+ "monthly_points": len(ratio_series),
133
+ }
134
+
135
+
136
+ def _describe_signal(score: int, crossover: Dict, roc_3m: Optional[float],
137
+ roc_12m: Optional[float], ratio: float) -> str:
138
+ if score >= 80:
139
+ return f"STRONG TRANSITION: RSP/SPY {crossover['type'].replace('_', ' ')} confirmed with aligned momentum"
140
+ elif score >= 60:
141
+ return f"TRANSITION SIGNAL: RSP/SPY crossover or sharp momentum reversal detected"
142
+ elif score >= 40:
143
+ return f"TRANSITION ZONE: RSP/SPY MAs converging, potential crossover ahead"
144
+ elif score >= 20:
145
+ return f"MINOR SHIFT: RSP/SPY ratio showing slight change ({ratio:.4f})"
146
+ else:
147
+ return f"STABLE: RSP/SPY ratio in established trend ({ratio:.4f})"
148
+
149
+
150
+ def _insufficient_data(reason: str) -> Dict:
151
+ return {
152
+ "score": 0,
153
+ "signal": f"INSUFFICIENT DATA: {reason}",
154
+ "data_available": False,
155
+ "direction": "unknown",
156
+ "current_ratio": None,
157
+ "current_date": None,
158
+ "sma_6m": None,
159
+ "sma_12m": None,
160
+ "roc_3m": None,
161
+ "roc_12m": None,
162
+ "percentile": None,
163
+ "crossover": {"type": "none", "bars_ago": None},
164
+ "monthly_points": 0,
165
+ }
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Component 3: Credit Conditions (Weight: 15%)
4
+
5
+ Analyzes HYG/LQD ratio to detect credit cycle transitions.
6
+
7
+ HYG (high-yield corporate bonds) / LQD (investment-grade corporate bonds):
8
+ - Rising ratio = credit risk appetite expanding, risk-on
9
+ - Falling ratio = flight to quality, credit tightening, risk-off
10
+
11
+ Transition signals:
12
+ - HYG/LQD turning up from bottom = credit cycle easing
13
+ - HYG/LQD turning down from top = credit cycle tightening
14
+ """
15
+
16
+ from typing import Dict, List, Optional
17
+ from .utils import (
18
+ downsample_to_monthly,
19
+ calculate_ratio,
20
+ compute_sma,
21
+ detect_crossover,
22
+ compute_roc,
23
+ compute_percentile,
24
+ score_transition_signal,
25
+ determine_direction,
26
+ )
27
+
28
+
29
+ def calculate_credit_conditions(hyg_history: List[Dict],
30
+ lqd_history: List[Dict]) -> Dict:
31
+ """
32
+ Calculate credit conditions transition signal from HYG/LQD ratio.
33
+
34
+ Args:
35
+ hyg_history: HYG daily OHLCV (most recent first)
36
+ lqd_history: LQD daily OHLCV (most recent first)
37
+
38
+ Returns:
39
+ Dict with score (0-100), signal, ratio details
40
+ """
41
+ if not hyg_history or not lqd_history:
42
+ return _insufficient_data("No HYG or LQD data available")
43
+
44
+ hyg_monthly = downsample_to_monthly(hyg_history)
45
+ lqd_monthly = downsample_to_monthly(lqd_history)
46
+
47
+ if len(hyg_monthly) < 12 or len(lqd_monthly) < 12:
48
+ return _insufficient_data("Insufficient monthly data (need >= 12 months)")
49
+
50
+ ratio_series = calculate_ratio(hyg_monthly, lqd_monthly)
51
+ if len(ratio_series) < 12:
52
+ return _insufficient_data("Insufficient ratio data")
53
+
54
+ ratio_values = [r["value"] for r in ratio_series]
55
+ current_ratio = ratio_values[0]
56
+ current_date = ratio_series[0]["date"]
57
+
58
+ sma_6m = compute_sma(ratio_values, 6)
59
+ sma_12m = compute_sma(ratio_values, 12)
60
+ crossover = detect_crossover(ratio_values, short_period=6, long_period=12)
61
+ roc_3m = compute_roc(ratio_values, 3)
62
+ roc_12m = compute_roc(ratio_values, 12)
63
+ percentile = compute_percentile(ratio_values, current_ratio)
64
+
65
+ score = score_transition_signal(
66
+ crossover=crossover,
67
+ roc_short=roc_3m,
68
+ roc_long=roc_12m,
69
+ sma_short=sma_6m,
70
+ sma_long=sma_12m,
71
+ )
72
+
73
+ # Direction
74
+ direction, momentum_qualifier = determine_direction(
75
+ crossover, roc_3m,
76
+ positive_label="easing", negative_label="tightening",
77
+ neutral_label="stable",
78
+ )
79
+
80
+ signal = _describe_signal(score, direction, current_ratio)
81
+
82
+ return {
83
+ "score": score,
84
+ "signal": signal,
85
+ "data_available": True,
86
+ "direction": direction,
87
+ "momentum_qualifier": momentum_qualifier,
88
+ "current_ratio": round(current_ratio, 4),
89
+ "current_date": current_date,
90
+ "sma_6m": round(sma_6m, 4) if sma_6m is not None else None,
91
+ "sma_12m": round(sma_12m, 4) if sma_12m is not None else None,
92
+ "roc_3m": round(roc_3m, 2) if roc_3m is not None else None,
93
+ "roc_12m": round(roc_12m, 2) if roc_12m is not None else None,
94
+ "percentile": round(percentile, 1) if percentile is not None else None,
95
+ "crossover": crossover,
96
+ "monthly_points": len(ratio_series),
97
+ }
98
+
99
+
100
+ def _describe_signal(score: int, direction: str, ratio: float) -> str:
101
+ if score >= 60:
102
+ return f"TRANSITION: Credit conditions {direction} (HYG/LQD={ratio:.4f})"
103
+ elif score >= 40:
104
+ return f"SHIFTING: Credit conditions {direction} (HYG/LQD={ratio:.4f})"
105
+ else:
106
+ return f"STABLE: Credit conditions stable (HYG/LQD={ratio:.4f})"
107
+
108
+
109
+ def _insufficient_data(reason: str) -> Dict:
110
+ return {
111
+ "score": 0,
112
+ "signal": f"INSUFFICIENT DATA: {reason}",
113
+ "data_available": False,
114
+ "direction": "unknown",
115
+ "current_ratio": None,
116
+ "current_date": None,
117
+ "sma_6m": None,
118
+ "sma_12m": None,
119
+ "roc_3m": None,
120
+ "roc_12m": None,
121
+ "percentile": None,
122
+ "crossover": {"type": "none", "bars_ago": None},
123
+ "monthly_points": 0,
124
+ }