npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capital-trader

v1.0.20

Published

An automated trading bot for Capital.com with AI-powered strategy generation via Claude or ChatGPT.

Readme

Capital Trader CLI

An automated trading bot for Capital.com with AI-powered strategy generation via Claude or ChatGPT.

Features

  • Capital Live Trading — Connects to Capital.com via REST API and WebSocket for real-time order execution
  • AI Strategy Generation — Uses AI to generate, backtest, and optimize trading strategies from natural language
  • Backtesting Dashboard — Simulates strategies on historical data and opens HTML with performance metrics
  • Demo & Live Support — Switch between demo and live environments by editing configuration file
  • Extremely Flexible — Runs on any device including Raspberry Pi, VPS, or low-power servers

Requirements

Installation

Install CLI

npm i -g capital-trader

Configuration

Edit ~/.capital/config.json

{
  "username": "your-capital-username",
  "password": "your-capital-password",
  "apiKey": "your-capital-api-key",
  "anthropicKey": "sk-ant-...",
  "environment": "demo",
  "epic": "BTCUSD",
  "orderSize": "0.025",
  "timeframe": "MINUTE_15",
  "max": "1000",
  "tokens": "10000",
  "retries": "3"
}

| Key | Description | Example | |-----|-------------|---------| | username | Capital.com login email | [email protected] | | password | Capital.com password | | | apiKey | Capital.com API key | | | anthropicKey | Anthropic Claude API key | sk-ant-... | | environment | "demo" or "live" | "demo" | | epic | Market identifier | "BTCUSD", "EURUSD" | | orderSize | Position size per trade | "0.025" | | timeframe | Candle interval | "MINUTE_15", "MINUTE" | | max | Historical candles to fetch | "1000" | | tokens | Max AI tokens to use | "15000" | | retries | Max AI generation retries | "3" |

Usage

# Start bot
capital

# Show help
capital --help

# Show strategy
capital --code

# Test strategy
capital --test

# Get config path
capital --config

# Set config value
capital --set orderSize 0.005

# Reset strategy
capital --clear

AI Strategy Generation

Pass any natural language instruction to the CLI:

capital "create a good strategy based on macd and rsi"
capital "add custom take profit on price * 1.001"
capital "make the strategy more conservative"
capital "only open orders on red candles"

If the new strategy underperforms, it is automatically discarded.

Strategy is saved inside config.json file.

Project Structure

src/
├── cli.js              # Entry point and command router
├── bot.js              # Live trading loop
├── ai.js               # AI strategy generation and validation
├── cfg.js              # Display config path and values
├── test.js             # Backtesting and dashboard generation
├── strat.js            # Display raw code strategy
├── help.js             # Display help instructions
├── set.js              # Config setter
├── clear.js            # Strategy reset
└── utils/
    ├── capital.js      # Capital.com API client (REST + WebSocket)
    ├── strategy.js     # Strategy simulator and indicator calculations
    ├── generate.js     # Claude/OpenAI API calls
    ├── testing.js      # Backtesting engine
    └── constant.js     # Config loader and utilities

Disclaimer

This software is for educational purposes. Automated trading carries significant financial risk. Always test thoroughly on a demo account before using real funds. Past backtest performance does not guarantee future results.

 

⭐  If you find this useful!