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/config.py

View on GitHub
"""User configuration and paths.

Everything lives under TRADING_SKILLS_HOME (default ~/.trading-skills):
    config.json    risk limits, data provider, broker, account settings
    secrets.json   broker credentials (chmod 600) - env vars take precedence
    cache/         downloaded market data
    journal.db     SQLite trade journal
    paper/         paper broker state
    approvals/     pre-trade gate approvals consumed by trading-broker
    audit.log      JSONL log of every order action
    KILL_SWITCH    if this file exists, no order can be submitted
"""

from __future__ import annotations

import copy
import json
import os
import stat
from pathlib import Path
from typing import Any, Dict

DEFAULTS: Dict[str, Any] = {
    "version": 1,
    "account": {
        "equity": 100000.0,          # used when the broker cannot report equity
        "currency": "USD",
        "timezone": "UTC",
        "benchmark": None,           # e.g. "^GSPC", "SPY", "^NSEI", "BTC-USD"
    },
    "data": {
        "provider": "yahoo",         # yahoo | csv | kite
        "csv_dir": None,             # folder of SYMBOL.csv files for the csv provider
        "cache_ttl_minutes": 60,
        "sec_user_agent": None,      # "Your Name you@example.com" - SEC asks automated clients to identify themselves
    },
    "broker": {
        "name": "paper",             # paper | kite
        "live_trading_enabled": False,
        "default_product": None,     # broker-specific (kite: CNC | MIS | NRML)
        "default_exchange": None,    # broker-specific (kite: e.g. NSE)
        "default_order_type": "LIMIT",
    },
    "risk": {
        "risk_per_trade_pct": 1.0,
        "max_position_pct": 20.0,
        "max_open_risk_pct": 6.0,
        "max_open_positions": 8,
        "max_daily_loss_pct": 3.0,
        "max_drawdown_pct": 15.0,
        "min_reward_risk": 1.5,
        "max_consecutive_losses": 3,
        "approval_ttl_minutes": 30,
        "confirm_ttl_minutes": 10,
        "no_entries_last_minutes": 30,   # trading-entry: no new intraday entries this close to the close
    },
    "costs": {
        "commission_pct": 0.03,      # percent of notional per side
        "commission_fixed": 0.0,     # fixed per order
        "slippage_pct": 0.05,        # percent per fill
    },
}


def home() -> Path:
    env = os.environ.get("TRADING_SKILLS_HOME") or os.environ.get("TRADINGKIT_SKILLS_HOME")  # legacy name
    if env:
        p = Path(env).expanduser()
    else:
        p = Path.home() / ".trading-skills"
        legacy = Path.home() / ".tradingkit-skills"   # v0.1 folder: keep using it so no data is lost
        if not p.exists() and legacy.is_dir():
            p = legacy
    p.mkdir(parents=True, exist_ok=True)
    return p


def path(*parts: str) -> Path:
    p = home().joinpath(*parts)
    p.parent.mkdir(parents=True, exist_ok=True)
    return p


def _deep_merge(base: Dict[str, Any], override: Dict[str, Any]) -> Dict[str, Any]:
    out = copy.deepcopy(base)
    for k, v in (override or {}).items():
        if isinstance(v, dict) and isinstance(out.get(k), dict):
            out[k] = _deep_merge(out[k], v)
        else:
            out[k] = v
    return out


def load() -> Dict[str, Any]:
    f = home() / "config.json"
    user: Dict[str, Any] = {}
    if f.exists():
        try:
            user = json.loads(f.read_text())
        except json.JSONDecodeError as e:
            raise RuntimeError(f"{f} is not valid JSON: {e}") from e
    return _deep_merge(DEFAULTS, user)


def save(cfg: Dict[str, Any]) -> Path:
    f = home() / "config.json"
    f.write_text(json.dumps(cfg, indent=2, sort_keys=False) + "\n")
    return f


def exists() -> bool:
    return (home() / "config.json").exists()


def coerce(value: str) -> Any:
    """Turn a CLI string into bool/int/float/null/json when it looks like one."""
    low = value.strip().lower()
    if low in ("true", "yes", "on"):
        return True
    if low in ("false", "no", "off"):
        return False
    if low in ("null", "none", ""):
        return None
    try:
        if any(c in value for c in ".eE"):
            return float(value)
        return int(value)
    except ValueError:
        pass
    if value.strip().startswith(("{", "[")):
        try:
            return json.loads(value)
        except json.JSONDecodeError:
            pass
    return value


def set_key(cfg: Dict[str, Any], dotted: str, value: Any) -> Dict[str, Any]:
    keys = dotted.split(".")
    node = cfg
    for k in keys[:-1]:
        if k not in node or not isinstance(node[k], dict):
            node[k] = {}
        node = node[k]
    node[keys[-1]] = value
    return cfg


def get_key(cfg: Dict[str, Any], dotted: str, default: Any = None) -> Any:
    node: Any = cfg
    for k in dotted.split("."):
        if not isinstance(node, dict) or k not in node:
            return default
        node = node[k]
    return node


# ---------------------------------------------------------------- secrets

def load_secrets() -> Dict[str, Any]:
    f = home() / "secrets.json"
    if not f.exists():
        return {}
    try:
        return json.loads(f.read_text())
    except json.JSONDecodeError:
        return {}


def save_secrets(data: Dict[str, Any]) -> Path:
    f = home() / "secrets.json"
    f.write_text(json.dumps(data, indent=2) + "\n")
    try:
        os.chmod(f, stat.S_IRUSR | stat.S_IWUSR)
    except OSError:
        pass
    return f


def secret(name: str, env: str) -> Any:
    """Environment variable wins over secrets.json."""
    v = os.environ.get(env)
    if v:
        return v
    return load_secrets().get(name)


def mask(value: Any) -> str:
    if not value:
        return "(not set)"
    s = str(value)
    return s[:3] + "***" + s[-2:] if len(s) > 8 else "***"


# ---------------------------------------------------------------- kill switch

def kill_switch_on() -> bool:
    return (home() / "KILL_SWITCH").exists()


def set_kill_switch(on: bool, reason: str = "") -> None:
    f = home() / "KILL_SWITCH"
    if on:
        f.write_text(reason or "manual")
    elif f.exists():
        f.unlink()
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