All skills
marketcalls avatar

/vectorbt-expert

@3a8c2a3

VectorBT backtesting expert. Use when user asks to backtest strategies, create entry/exit signals, analyze portfolio performance, optimize parameters, fetch historical data, use VectorBT/vectorbt, compare strategies, position sizing, equity curves, drawdown charts, or trade analysis. Also triggers for openalgo.ta helpers (exrem, crossover, crossunder, flip, donchian, supertrend).

Use this Skill: https://skilld.dev/gh/marketcalls/vectorbt-backtesting-skills/vectorbt-expert

This session only. Nothing lands on disk.

ruleslong-short-trading.md

≈502 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Long + Short Backtesting

Simultaneous Long and Short

Use short_entries and short_exits for simultaneous long/short:

pf_both = vbt.Portfolio.from_signals(
    close,
    entries=entries_long,
    exits=exits_long,
    short_entries=entries_short,
    short_exits=exits_short,
    init_cash=30_00_000,
    size=20_00_000,
    size_type="value",
    fees=0.0003,
    min_size=lot_size,
    size_granularity=lot_size,
    freq="1h",
)
# Note: direction="both" is ignored when short_entries/short_exits are provided

Compare Long-Only vs Short-Only vs Both

common_kwargs = dict(
    init_cash=1_000_000,
    size=500_000,
    size_type="value",
    fees=0.00022,
    freq="5min",
)

EMPTY = pd.Series(False, index=close.index)

pf_long = vbt.Portfolio.from_signals(close, entries=LE, exits=LX,
                                      direction="longonly", **common_kwargs)
pf_short = vbt.Portfolio.from_signals(close, short_entries=SE, short_exits=SX,
                                       direction="shortonly", **common_kwargs)
pf_both = vbt.Portfolio.from_signals(close, entries=LE, exits=LX,
                                      short_entries=SE, short_exits=SX, **common_kwargs)

# Side-by-side comparison
stats = pd.concat([
    pf_long.stats().to_frame("Long Only"),
    pf_short.stats().to_frame("Short Only"),
    pf_both.stats().to_frame("Both"),
], axis=1)
print(stats)

Best Practices

  • Test long-only first before adding short side
  • Short strategies need separate signal logic (not just inverted long signals)
  • For Indian equities, shorting is only available intraday (MIS/CO product types)
  • Futures/options can be shorted for positional trades
  • When comparing, always use common_kwargs to ensure identical conditions

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides comprehensive instructions and production-ready templates for financial strategy backtesting using the VectorBT library. It emphasizes security best practices such as environment-variable-based secret management, read-only database connections, and robustness testing. The analysis found no evidence of malicious patterns, data exfiltration, or obfuscation.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    19/33 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 3a8c2a3. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago
user-invocable
false

README badge

README badge for marketcalls/vectorbt-backtesting-skills/vectorbt-expert