Skip to content

reddygopalkrishna/trading-skills / skills/trading-entry

trading-entry

Verified

Entry timer for intraday setups in any market - watches bar by bar and says the moment a setup triggers, waiting (and how far), still forming, expired or market closed. Opening-range breakout (first 15 minutes by default) or a break of any level you give, long or short, on 1, 2, 5 or 15-minute bars, with an optional volume check and a no-entries-near-the-close cutoff. Reads each exchange's session from the data (NSE 09:15, NYSE 09:30, LSE 08:00...), replays past sessions for practice, and hands the trigger to trading-plan with stop ideas. Never places an order. Use when the user says "tell me when to get in", "watch RELIANCE", "has it broken out", "did it break the opening range", "time my entry", "ORB", "check my watchlist for breakouts", or after a scan finds a setup.

FileKindSize
SKILL.mdskill md3.9 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/entry.pyscript8.1 KB

scripts/_vendor/tradekit/fundamentals.py

View on GitHub
"""Quarterly results for any listed company, and what changed.

Sources
    yahoo  Yahoo Finance's fundamentals time series: free, no key, works for any market Yahoo
           covers (AAPL, RELIANCE.NS, SHEL.L, 7203.T ...). Usually the last 5 quarters.
    sec    SEC EDGAR XBRL facts (US companies only): the numbers the company filed, many years
           deep. Needs data.sec_user_agent (see tradekit.sec).
"""

from __future__ import annotations

import datetime as dt
import json
import time
import urllib.parse
from typing import Dict, List, Optional

from . import config, http

YAHOO_URL = "https://query2.finance.yahoo.com/ws/fundamentals-timeseries/v1/finance/timeseries/{sym}"
YAHOO_TYPES = {
    "quarterlyTotalRevenue": "revenue", "quarterlyGrossProfit": "gross_profit",
    "quarterlyOperatingIncome": "operating_income", "quarterlyNetIncome": "net_income",
    "quarterlyDilutedEPS": "eps",
}


def yahoo_url(symbol: str, years: int = 6) -> str:
    end = int(time.time()) + 86400
    start = end - years * 366 * 86400
    return YAHOO_URL.format(sym=urllib.parse.quote(symbol)) + "?" + urllib.parse.urlencode(
        {"type": ",".join(YAHOO_TYPES), "period1": start, "period2": end})


def parse_yahoo(payload: Dict) -> List[Dict]:
    rows: Dict[str, Dict] = {}
    for res in (payload.get("timeseries") or {}).get("result") or []:
        kind = ((res.get("meta") or {}).get("type") or [None])[0]
        field = YAHOO_TYPES.get(kind)
        if not field:
            continue
        for pt in res.get(kind) or []:
            if not pt or not pt.get("asOfDate"):
                continue
            val = (pt.get("reportedValue") or {}).get("raw")
            r = rows.setdefault(pt["asOfDate"], {"period_end": pt["asOfDate"], "derived": False,
                                                 "currency": pt.get("currencyCode")})
            r[field] = float(val) if val is not None else None
            if pt.get("currencyCode"):
                r["currency"] = pt["currencyCode"]
    out = []
    for end in sorted(rows):
        r = rows[end]
        for f in YAHOO_TYPES.values():
            r.setdefault(f, None)
        if r.get("revenue") is not None or r.get("net_income") is not None:
            out.append(r)
    return out


def yahoo_quarters(symbol: str, use_cache: bool = True) -> List[Dict]:
    f = config.path("cache", "fundamentals", "".join(c if c.isalnum() or c in "-_." else "_" for c in symbol) + ".json")
    if use_cache and f.exists() and (time.time() - f.stat().st_mtime) < 12 * 3600:
        try:
            return parse_yahoo(json.loads(f.read_text()))
        except json.JSONDecodeError:
            pass
    payload = http.get_json(yahoo_url(symbol))
    f.write_text(json.dumps(payload))
    return parse_yahoo(payload)


def _pct(a: Optional[float], b: Optional[float]) -> Optional[float]:
    if a is None or b is None or b == 0:
        return None
    return round((a / b - 1) * 100 * (1 if b > 0 else -1), 1)


def _margin(x: Optional[float], rev: Optional[float]) -> Optional[float]:
    if x is None or not rev:
        return None
    return round(x / rev * 100, 1)


def _same_quarter_last_year(rows: List[Dict], i: int) -> Optional[Dict]:
    end = dt.date.fromisoformat(rows[i]["period_end"])
    for r in rows[:i]:
        d = (end - dt.date.fromisoformat(r["period_end"])).days
        if 350 <= d <= 380:
            return r
    return None


def analyse(rows: List[Dict], symbol: str, source: str, name: Optional[str] = None) -> Dict:
    """Add margins, quarter-on-quarter and year-on-year changes, TTM and plain-words notes."""
    table = []
    for i, r in enumerate(rows):
        prev = rows[i - 1] if i else None
        ly = _same_quarter_last_year(rows, i)
        rev = r.get("revenue")
        table.append({
            **r,
            "gross_margin_pct": _margin(r.get("gross_profit"), rev),
            "operating_margin_pct": _margin(r.get("operating_income"), rev),
            "net_margin_pct": _margin(r.get("net_income"), rev),
            "revenue_qoq_pct": _pct(rev, prev.get("revenue")) if prev else None,
            "revenue_yoy_pct": _pct(rev, ly.get("revenue")) if ly else None,
            "net_income_yoy_pct": _pct(r.get("net_income"), ly.get("net_income")) if ly else None,
            "eps_yoy_pct": _pct(r.get("eps"), ly.get("eps")) if ly else None,
        })
    out: Dict = {"symbol": symbol, "name": name, "source": source, "quarters": table, "notes": []}
    if not table:
        out["notes"].append("no quarterly results found")
        return out
    last = table[-1]
    out["latest"] = last
    if len(table) >= 4:
        last4 = table[-4:]
        span = (dt.date.fromisoformat(last4[-1]["period_end"]) - dt.date.fromisoformat(last4[0]["period_end"])).days
        if 250 <= span <= 300:
            ttm = {}
            for f in ("revenue", "net_income", "eps"):
                vals = [q.get(f) for q in last4]
                ttm[f] = round(sum(vals), 4) if all(v is not None for v in vals) else None
            out["ttm"] = ttm
    notes = out["notes"]
    ni, oi = last.get("net_income"), last.get("operating_income")
    if ni is not None and oi is not None and oi > 0 and ni > oi:
        notes.append("net income is above operating income: gains outside the core business "
                     "(investments, tax items, one-offs) are inside it")
    if last.get("gross_profit") is None and last.get("revenue") is not None:
        notes.append("no gross margin reported (normal for banks, insurers and some service companies)")
    if any(q.get("derived") for q in table):
        notes.append("rows marked derived: a fourth quarter worked out as the full year minus three quarters; "
                     "derived EPS is approximate")
    if last.get("revenue_yoy_pct") is None:
        notes.append("no same quarter a year earlier in this data, so no year-on-year growth for the latest quarter")
    age = (dt.date.today() - dt.date.fromisoformat(last["period_end"])).days
    if age > 135:
        notes.append(f"latest quarter ended {age} days ago: a newer report may be out but not in this data yet; "
                     "check the company's filing or results page")
    return out
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