Skip to content

reddygopalkrishna/trading-skills / skills/trading-market

trading-market

Verified

Classify the current market regime for any index, ETF or crypto benchmark - risk-on uptrend, selective uptrend, choppy, correction or risk-off - from trend (50/200-SMA), momentum, volatility percentile, drawdown and optional breadth across a watchlist, with a suggested exposure level. Use when the user asks "how is the market", "should I be buying now", "is it risk-on", wants market context before trading, or needs to scale position sizes to conditions.

FileKindSize
SKILL.mdskill md2.1 KB
assets/watchlists/crypto-majors.txtmarkdown112 B
assets/watchlists/global-index-etfs.txtmarkdown106 B
assets/watchlists/global-large-caps.txtmarkdown306 B
assets/watchlists/india-large-caps.txtmarkdown291 B
assets/watchlists/us-mega-caps.txtmarkdown173 B
assets/watchlists/world-indices.txtmarkdown104 B
scripts/_vendor/tradekit/__init__.pyscript516 B
scripts/_vendor/tradekit/alerts.pyscript7.5 KB
scripts/_vendor/tradekit/analysis.pyscript10.3 KB
scripts/_vendor/tradekit/backtest.pyscript17.8 KB
scripts/_vendor/tradekit/brokers/__init__.pyscript1022 B
scripts/_vendor/tradekit/brokers/_rest.pyscript2.7 KB
scripts/_vendor/tradekit/brokers/base.pyscript3.5 KB
scripts/_vendor/tradekit/brokers/dhan.pyscript6.8 KB
scripts/_vendor/tradekit/brokers/fyers.pyscript7.1 KB
scripts/_vendor/tradekit/brokers/groww.pyscript7.7 KB
scripts/_vendor/tradekit/brokers/kite.pyscript14.5 KB
scripts/_vendor/tradekit/brokers/paper.pyscript12.7 KB
scripts/_vendor/tradekit/brokers/upstox.pyscript7.8 KB
scripts/_vendor/tradekit/cli.pyscript2.4 KB
scripts/_vendor/tradekit/config.pyscript6.0 KB
scripts/_vendor/tradekit/data.pyscript18.5 KB
scripts/_vendor/tradekit/disclosures.pyscript17.4 KB
scripts/_vendor/tradekit/expr.pyscript19.0 KB
scripts/_vendor/tradekit/feeds.pyscript9.4 KB
scripts/_vendor/tradekit/frame.pyscript8.9 KB
scripts/_vendor/tradekit/fundamentals.pyscript6.1 KB
scripts/_vendor/tradekit/gate.pyscript8.1 KB
scripts/_vendor/tradekit/http.pyscript4.3 KB
scripts/_vendor/tradekit/indicators.pyscript13.1 KB
scripts/_vendor/tradekit/journal.pyscript11.1 KB
scripts/_vendor/tradekit/metrics.pyscript6.2 KB
scripts/_vendor/tradekit/montecarlo.pyscript7.8 KB
scripts/_vendor/tradekit/options.pyscript24.4 KB
scripts/_vendor/tradekit/patterns.pyscript12.9 KB
scripts/_vendor/tradekit/report.pyscript8.4 KB
scripts/_vendor/tradekit/risk.pyscript4.7 KB
scripts/_vendor/tradekit/sec.pyscript12.0 KB
scripts/_vendor/tradekit/session.pyscript9.4 KB
scripts/regime.pyscript3.2 KB

scripts/regime.py

View on GitHub
#!/usr/bin/env python3
"""Market regime: trend, volatility and breadth of an index -> regime label + suggested exposure.

Examples
  python3 scripts/regime.py                      # uses account.benchmark from config
  python3 scripts/regime.py --index ^GSPC --universe assets/watchlists/us-mega-caps.txt
  python3 scripts/regime.py --index BTC-USD --json
  python3 scripts/regime.py --index ^GSPC ^NDX ^FTSE ^N225     # compare several markets
"""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "_vendor"))

from tradekit import analysis, cli, config, data  # noqa: E402


def md(res):
    out = []
    for r in res["regimes"]:
        out.append(f"## {r['index']}: {r['regime'].upper()} - suggested exposure {r['suggested_exposure_pct']}%")
        out.append(f"As of {r['date']} | score {r['score']:+d} | {r['drawdown_from_52w_high_pct']:+.1f}% from 52w high | "
                   f"3m momentum {cli.num(r['momentum_3m_pct'])}% | 20d vol {cli.num(r['realized_vol_20d_pct'])}% "
                   f"(1y percentile {cli.num(r['vol_percentile_1y'], 0)})")
        if r.get("breadth"):
            b = r["breadth"]
            out.append(f"Breadth ({b['symbols']} symbols): {b['pct_above_sma50']}% above 50-SMA, "
                       f"{b['pct_above_sma200']}% above 200-SMA, {b['near_52w_highs']} near highs vs "
                       f"{b['near_52w_lows']} near lows")
        out.append("")
        out += [f"- {n}" for n in r["notes"]]
        out.append("")
    for k, v in res["errors"].items():
        out.append(f"- {k}: {v}")
    out.append("Exposure guide: 100% risk-on, 75% selective, 50% choppy, 25% correction, 0% risk-off. "
               "Lower exposure = fewer/smaller new positions and tighter stops, not necessarily selling everything.")
    return "\n".join(out)


def main():
    p = cli.parser(__doc__)
    p.add_argument("--index", nargs="*", help="index/ETF symbols (default: config account.benchmark)")
    p.add_argument("--universe", help="symbols for breadth (file or comma list)")
    p.add_argument("--csv", help="index bars from a CSV file")
    p.add_argument("--provider", choices=["yahoo", "csv", "kite"])
    p.add_argument("--json", action="store_true")
    a = p.parse_args()
    idx = a.index or ([config.load()["account"].get("benchmark")] if config.load()["account"].get("benchmark") else [])
    if not idx and not a.csv:
        cli.fail("no index: pass --index SYMBOL or set one with trading-setup (account.benchmark)")
    uni = None
    if a.universe:
        syms = data.load_universe(a.universe)
        uni, _ = data.get_many(syms, "1d", "2y", a.provider)
    regimes, errors = [], {}
    if a.csv:
        regimes.append(analysis.regime(data.load_bars(None, a.csv, min_bars=220), uni))
    for s in idx:
        try:
            regimes.append(analysis.regime(data.get_bars(s, "1d", "2y", provider=a.provider, min_bars=220), uni))
        except Exception as e:  # noqa: BLE001
            errors[s] = str(e)
    if not regimes:
        cli.fail("; ".join(f"{k}: {v}" for k, v in errors.items()) or "no data")
    cli.emit({"regimes": regimes, "errors": errors}, a.json, md)


if __name__ == "__main__":
    cli.run(main)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall