stock-analysis-plugin 0.2.4 → 0.2.6
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.
- package/README.md +105 -14
- package/package.json +1 -1
- package/pi/index.ts +290 -14
- package/schemas/report_schema.json +3 -3
- package/scripts/setup-python.mjs +6 -6
- package/skills/bull-trend/SKILL.md +34 -10
- package/skills/bull-trend/references/fat-tails.md +91 -0
- package/skills/bull-trend/scripts/tail_analysis.py +132 -0
- package/skills/event-driven/SKILL.md +8 -0
- package/skills/growth-quality/SKILL.md +8 -0
- package/skills/stock-analysis/SKILL.md +31 -3
- package/skills/stock-screener/SKILL.md +20 -0
- package/skills/strategy-backtest/SKILL.md +6 -0
- package/skills/wisburg-research/SKILL.md +2 -0
- package/templates/stock_analysis/brief.md.j2 +4 -1
- package/templates/stock_analysis/full.md.j2 +6 -3
- package/tools/_cache.py +61 -0
- package/tools/alert_rules.py +32 -4
- package/tools/backtest.py +22 -4
- package/tools/capabilities.py +12 -0
- package/tools/diagnostics.py +6 -0
- package/tools/gather.py +20 -10
- package/tools/lixinger.py +100 -0
- package/tools/market_regime.py +7 -3
- package/tools/market_review.py +7 -6
- package/tools/position_context.py +20 -2
- package/tools/report_renderer.py +2 -0
- package/tools/risk_screening.py +45 -17
- package/tools/screener.py +64 -4
- package/tools/sec_edgar.py +346 -0
- package/tools/sec_holders.py +263 -0
- package/tools/signal_tracker.py +142 -19
- package/tools/stock_data.py +321 -116
- package/tools/technical.py +16 -2
- package/tools/value_data.py +1527 -0
- package/tools/watchlist.py +24 -1
- package/tools/watchlist_context.py +7 -3
package/tools/technical.py
CHANGED
|
@@ -642,13 +642,25 @@ def analyze_multi(symbol: str, period: str, count: int, periods: list) -> dict:
|
|
|
642
642
|
|
|
643
643
|
|
|
644
644
|
def analyze(symbol: str, period: str = "daily", count: int = 120) -> dict:
|
|
645
|
-
|
|
645
|
+
return analyze_records(symbol, fetch_kline(symbol, period, count), period)
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
def analyze_records(symbol: str, records: list, period: str = "daily") -> dict:
|
|
646
649
|
if isinstance(records, dict) and "error" in records:
|
|
647
650
|
return records
|
|
648
|
-
if not records:
|
|
651
|
+
if not isinstance(records, list) or not records:
|
|
649
652
|
return {"error": "No kline data returned"}
|
|
653
|
+
if any(not isinstance(row, dict) for row in records):
|
|
654
|
+
return {"error": "Invalid kline rows"}
|
|
650
655
|
|
|
651
656
|
df = to_dataframe(records)
|
|
657
|
+
required = ["date", "close", "high", "low", "volume"]
|
|
658
|
+
if any(field not in df for field in required):
|
|
659
|
+
return {"error": "Missing kline fields"}
|
|
660
|
+
if df["date"].isna().any() or not np.isfinite(df[required[1:]]).all().all():
|
|
661
|
+
return {"error": "Invalid kline values"}
|
|
662
|
+
if (df[["close", "high", "low"]] <= 0).any().any() or (df["volume"] < 0).any():
|
|
663
|
+
return {"error": "Kline prices must be positive and volume nonnegative"}
|
|
652
664
|
if len(df) < 30:
|
|
653
665
|
return {"error": f"Insufficient data: {len(df)} rows (need at least 30)"}
|
|
654
666
|
|
|
@@ -731,6 +743,8 @@ def main():
|
|
|
731
743
|
else:
|
|
732
744
|
result = {"error": f"Unknown command: {args.command}"}
|
|
733
745
|
print(json.dumps(result, ensure_ascii=False, default=str))
|
|
746
|
+
if "error" in result:
|
|
747
|
+
sys.exit(1)
|
|
734
748
|
|
|
735
749
|
|
|
736
750
|
if __name__ == "__main__":
|