/tradecraft:freqtrade-botfrom tradecraft
Provides Freqtrade setup, strategy development, backtesting, hyperopt parameter optimization, and FreqAI ML trading for crypto bots on Binance, Kraken, Bybit, OKX, Gate.io.
Ships in tradecraft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mahmoud20138/tradecraft --plugin tradecraftUSE FOR:
Free open-source Python crypto trading bot with full backtesting and ML optimization.
| Type | Exchanges |
|---|---|
| Spot | Binance · Kraken · Gate.io · OKX · Bybit · Kucoin · Bitvavo |
| Futures | Binance · Bitget · Gate.io · OKX · Bybit |
# Docker (recommended)
docker compose up -d
# pip install
pip install freqtrade
freqtrade install-ui # optional WebUI
# From source
git clone https://github.com/freqtrade/freqtrade
cd freqtrade
./setup.sh -i
# Create new strategy template
freqtrade new-strategy --strategy MyStrategy
# Run backtesting
freqtrade backtesting --strategy MyStrategy --timerange 20240101-20241231
# Hyperopt (ML parameter search)
freqtrade hyperopt --strategy MyStrategy --hyperopt-loss SharpeHyperOptLoss --epochs 500
# Paper trading (dry run)
freqtrade trade --strategy MyStrategy --dry-run
# Live trading
freqtrade trade --strategy MyStrategy
# Plot strategy signals
freqtrade plot-dataframe --strategy MyStrategy
from freqtrade.strategy import IStrategy, DecimalParameter, IntParameter
import pandas as pd
from pandas import DataFrame
import talib.abstract as ta
class MyStrategy(IStrategy):
# Required settings
minimal_roi = {"0": 0.10, "30": 0.05, "60": 0.01}
stoploss = -0.05
timeframe = "1h"
# Hyperopt parameters (searchable)
rsi_period = IntParameter(10, 30, default=14, space="buy")
rsi_buy = IntParameter(20, 40, default=30, space="buy")
rsi_sell = IntParameter(60, 80, default=70, space="sell")
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=self.rsi_period.value)
dataframe["macd"], dataframe["macdsignal"], _ = ta.MACD(dataframe)
dataframe["ema20"] = ta.EMA(dataframe, timeperiod=20)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(dataframe["rsi"] < self.rsi_buy.value) &
(dataframe["close"] > dataframe["ema20"]),
"enter_long"
] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
dataframe["rsi"] > self.rsi_sell.value,
"exit_long"
] = 1
return dataframe
# Optimize entry/exit parameters
freqtrade hyperopt \
--strategy MyStrategy \
--hyperopt-loss SharpeHyperOptLoss \
--spaces buy sell \
--epochs 300
# Loss functions available:
# SharpeHyperOptLoss → maximize Sharpe ratio
# SortinoHyperOptLoss → maximize Sortino ratio
# CalmarHyperOptLoss → maximize Calmar ratio
# MaxDrawDownHyperOptLoss → minimize drawdown
# config.json — enable FreqAI
{
"freqai": {
"enabled": true,
"purge_old_models": 2,
"train_period_days": 30,
"backtest_period_days": 7,
"feature_parameters": {
"include_timeframes": ["5m", "15m", "1h"],
"include_corr_pairlist": ["BTC/USDT", "ETH/USDT"],
"label_period_candles": 24,
"include_shifted_candles": 2
},
"identifier": "my_model",
"model_training_parameters": {
"n_estimators": 200,
"learning_rate": 0.05
}
}
}
# In strategy: use FreqAI predictions
class FreqAIStrategy(IStrategy):
def populate_indicators(self, df, metadata):
df = self.freqai.start(df, metadata, self) # runs ML model
return df
def populate_entry_trend(self, df, metadata):
df.loc[df["&-s_close"] > 0.02, "enter_long"] = 1 # predict +2% close
return df
# Key metrics in backtesting output:
# Total profit % · Win rate · Avg profit per trade
# Max drawdown · Sharpe ratio · Sortino ratio
# Calmar ratio · Profit factor · Avg duration
freqtrade backtesting --strategy MyStrategy \
--timerange 20240101-20241231 \
--export trades \
--export-filename results.json
/start → start trading
/stop → stop trading
/status → show open trades
/profit → show P&L summary
/balance → show portfolio
/performance → strategy performance
/forceenter BTC/USDT → force buy
/forceexit 1 → force close trade #1
name: pysystemtrade description: > pysystemtrade - Rob Carvers open-source futures trading system implementing Systematic Trading book framework. Backtesting + live trading via Interactive Brokers (IB insync). Production system traded 20h/day by the author. Risk management, position sizing, futures data management, Python 3. USE FOR:
Rob Carvers open-source implementation of the Systematic Trading framework.
git clone https://github.com/pst-group/pysystemtrade cd pysystemtrade pip install -r requirements.txt python setup.py install
Instrument selection - futures with sufficient liquidity and diversification Rule signals - trend-following, carry, mean-reversion signals Forecast scaling - normalize signals to +/-20 range Forecast combination - blend multiple signals with weights Position sizing - use volatility targeting (% annual risk per instrument) Portfolio construction - diversification multiplier across instruments
target_vol = 0.25 # 25% annual portfolio volatility instrument_vol = price * daily_vol * sqrt(256) # annualized notional_exposure = (capital * target_vol) / instrument_vol contracts = notional_exposure / point_value
import pysystemtrade as pst from sysquant.estimators.ewm import ewmac
raw_signal = ewmac(price, Lfast=16, Lslow=64) scaled_forecast = raw_signal.clip(-20, 20) * forecast_scalar
forecasts = { ewmac_2_8: weight_0.15, ewmac_4_16: weight_0.15, ewmac_8_32: weight_0.15, ewmac_16_64: weight_0.30, ewmac_32_128: weight_0.25 } combined_forecast = sum(f * w for f, w in forecasts.items())
from sysbrokers.IB.ib_connection import ibConnection from sysbrokers.IB.ib_futures_contracts_data import ibFuturesContractData
connection = ibConnection()
name: finrl-trading description: > FinRL-Trading v2.0 - modular quant trading platform with ML strategies, professional backtesting, live trading via Alpaca. Strategies: Equal Weight, Market Cap Weighted, Random Forest stock selection, Sector Neutral ML. Data: Yahoo Finance, FMP, WRDS. Python 3.11+. USE FOR:
Modular quant trading platform by AI4Finance Foundation.
Equal Weight - buy all S&P500 stocks equally weighted Market Cap Weighted - weight by market capitalization Random Forest ML - ML-based stock selection (scikit-learn) Sector Neutral ML - ML selection with sector exposure control Deep RL (roadmap) - PPO/DQN agents (planned)
git clone https://github.com/AI4Finance-Foundation/FinRL-Trading pip install -r requirements.txt cp .env.example .env
jupyter notebook examples/FinRL_Full_Workflow.ipynb
Yahoo Finance - free default (yfinance) Financial Modeling Prep (FMP) - paid, higher quality WRDS - academic dataset (requires credentials)
import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import TimeSeriesSplit
features = [return_1m, return_3m, return_6m, volume_ratio, pe_ratio, pb_ratio]
model = RandomForestClassifier(n_estimators=200, random_state=42) tscv = TimeSeriesSplit(n_splits=5)
for train_idx, val_idx in tscv.split(X): model.fit(X[train_idx], y[train_idx])
scores = model.predict_proba(X_current)[:, 1] top_50 = pd.Series(scores, index=tickers).nlargest(50).index
import alpaca_trade_api as tradeapi
api = tradeapi.REST(ALPACA_KEY, ALPACA_SECRET, base_url="https://paper-api.alpaca.markets")
for ticker, weight in portfolio.items(): equity = float(api.get_account().equity) target_value = equity * weight current_price = api.get_last_trade(ticker).price qty = int(target_value / current_price) api.submit_order(symbol=ticker, qty=qty, side="buy", type="market", time_in_force="day")
Three production-quality strategies using IEX Cloud API:
Allocate equal capital to all 500 S&P 500 components.
import numpy as np import pandas as pd import requests import xlsxwriter import math
stocks = pd.read_csv("sp_500_stocks.csv")
IEX_CLOUD_API_TOKEN = "YOUR_TOKEN" def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i+n]
symbol_groups = list(chunks(stocks["Ticker"], 100)) for group in symbol_groups: batch_url = f"https://sandbox.iexapis.com/stable/stock/market/batch/?types=quote&symbols={','.join(group)}&token={IEX_CLOUD_API_TOKEN}" data = requests.get(batch_url).json()
portfolio_size = 10_000_000 # 0M position_size = portfolio_size / len(stocks) num_shares = math.floor(position_size / price)
Select top 50 momentum stocks from S&P 500.
Metrics used: 1-month return (25% weight) 3-month return (25% weight) 6-month return (25% weight) 12-month return (25% weight)
hqm_columns = [ "One-Year Price Return", "Six-Month Price Return", "Three-Month Price Return", "One-Month Price Return" ]
for row in hqm_dataframe.index: momentum_percentiles = [] for time_period in hqm_columns: hqm_dataframe.loc[row, f"{time_period} Percentile"] = stats.percentileofscore( hqm_dataframe[time_period], hqm_dataframe.loc[row, time_period] ) / 100
hqm_dataframe.loc[row, "HQM Score"] = mean(momentum_percentiles)
hqm_dataframe.sort_values("HQM Score", ascending=False, inplace=True) hqm_dataframe = hqm_dataframe[:50]
Select top 50 value stocks using composite value score (RV Score).
Metrics used (each 20% weight): Price-to-Earnings (P/E) ratio Price-to-Book (P/B) ratio Price-to-Sales (P/S) ratio Enterprise Value / EBITDA Enterprise Value / Gross Profit
rv_columns = ["Price-to-Earnings Ratio", "Price-to-Book Ratio", "Price-to-Sales Ratio", "EV/EBITDA", "EV/GP"]
for row in rv_dataframe.index: value_percentiles = [] for metric in rv_columns: rv_dataframe.loc[row, f"{metric} Percentile"] = stats.percentileofscore( rv_dataframe[metric], rv_dataframe.loc[row, metric] ) / 100 value_percentiles.append(rv_dataframe.loc[row, f"{metric} Percentile"]) rv_dataframe.loc[row, "RV Score"] = mean(value_percentiles)
rv_dataframe.sort_values("RV Score", ascending=False, inplace=True) rv_dataframe = rv_dataframe[:50]
requests - API calls to IEX Cloud pandas - data manipulation numpy - math operations scipy.stats.percentileofscore - percentile ranking xlsxwriter - export results to Excel with formatting math.floor - position sizing calculations
| Bot | Language | Key Feature |
|---|---|---|
| Freqtrade | Python | Backtesting + hyperopt + FreqAI (in skills) |
| Hummingbot | Python | CEX + DEX market making, 50+ exchanges |
| Superalgos | Node.js | Visual designer + data mining (in skills) |
| OpenTrader | Python | Self-hosted, 100+ exchanges via CCXT |
| Jesse | Python | Crypto strategy framework with backtesting |
| Gekko | Node.js | Simple rule-based bot (legacy) |
| Catalyst | Python | Zipline fork for crypto |
| Krypto-trading-bot | TypeScript | Multi-exchange auto-trader |
| Library | Language | Indicators |
|---|---|---|
| pandas-ta | Python | 120+ indicators + utility functions |
| ta-lib | C/Python | 150+ functions (industry standard) |
| technicalindicators | JavaScript | 50+ indicators + candlestick patterns |
| finta | Python | 80+ technical indicators |
| ta | Python | Wrapper around pandas-ta |
| Tool | Description |
|---|---|
| CCXT | 120+ exchanges, Python/JS/PHP |
| python-binance | Binance API wrapper |
| CoinGecko API | Free historical + current prices |
| CryptoCompare | OHLCV, news, social data |
| Alpaca | US equities + crypto, paper trading |
| Tool | Description |
|---|---|
| TradingView Lightweight Charts | Customizable JS price charts |
| TradingVue.js | Vue.js trading chart component |
| mplfinance | Python candlestick charts |
| plotly | Interactive charts |
169 skills in this plugin
/agent-developmentThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins./agentic-storageAgentic storage architecture — persistent memory for AI agents using MCP, immutable versioning, sandboxing, and intent validation. Covers the stateless problem in LLM agents, RAG limitations (read-only), MCP protocol (JSON-RPC, resources, tools), storage safety layers, and agent file system design. Source: IBM Technology (Martin Keen), March 2026. Use this skill for "agentic storage", "agent memory", "persistent agent state", "MCP storage", "agent file system", "agent hard drive", "stateless agent problem", "agent work product", "immutable versioning", "agent sandboxing", "intent validation", "agent safety layers", "agent context window limits", "storage for AI agents", "agent persistence", "autonomous agent storage", "agent audit trail". Works with mcp-integration, trading-brain, agents, trade-psychology-coach.
/ai-agent-builderExpert guide for building AI-powered coding agents that produce professional-quality output. Trigger whenever the user asks to build an AI agent, coding assistant, automation pipeline, tool-using LLM system, or says "agent", "agentic", "tool use", "function calling", "LLM pipeline", "AI workflow", "coding bot", or "autonomous AI". Covers agent architecture, tool design, skill loading, prompt engineering, context management, evaluation loops, and multi-step orchestration using the Claude API or any LLM API./ai-signal-aggregatorML-powered signal aggregation across ALL strategy skills — combines signals from every strategy using weighted voting, random forest meta-learner, and confidence calibration. THE MASTER SIGNAL COMBINER. Use for "combine all signals", "aggregate strategies", "meta strategy", "AI signal", "ensemble signal", "which signal to follow", "best signal now", "combine everything", "master signal", "AI recommendation", or any request to synthesize signals from multiple skills. This is the intelligence layer ABOVE trading-brain.
/ai-trading-crewAI Trading Crew — 50-agent AutoGen system for US stock analysis. 8 specialized teams (Technical, Fundamental, Macro, Sentiment, Quant, Risk, Execution, Strategy) reporting to a Head Coach supervisor. Risk team has veto power. Devil's Advocate agent f/alternative-data-integratorAlternative data sources for trading signals — Google Trends, web traffic, search volume, shipping/supply chain data, satellite imagery proxies, and economic nowcasting. Use this skill whenever the user asks about "alternative data", "Google Trends trading", "search trends", "web traffic signals", "nowcasting", "satellite data trading", "shipping index", "Baltic Dry", "unusual data sources", "non-traditional indicators", "big data trading signals", or any request to incorporate non-standard data into trading decisions. Works with trading-data-science for feature engineering and trading-brain for signal integration.
Other plugins' skills for the same job