/tradecraft:tensortrade-rlfrom tradecraft
Builds and trains reinforcement learning trading agents using TensorTrade's modular TradingEnv with Observer, ActionScheme, RewardScheme, Portfolio, and Exchange components. Integrates Ray RLlib for distributed training.
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.
USE FOR:
Open-source Python RL trading framework. Builds composable TradingEnv environments
to train and evaluate RL agents against market data.
Research finding: PPO on BTC/USD achieves directional prediction at zero commission, but trading frequency → commissions exceed profits in live conditions.
┌─────────────── TradingEnv ────────────────────┐
│ │
│ Observer → feature engineering │
│ ↓ │
│ Agent → RL policy (PPO/DQN/etc.) │
│ ↓ │
│ ActionScheme → BUY / SELL / HOLD orders │
│ ↓ │
│ Exchange → simulated execution + fees │
│ ↓ │
│ Portfolio → wallet + position tracking │
│ ↓ │
│ RewardScheme → position-based returns │
└───────────────────────────────────────────────┘
python3.12 -m venv tensortrade-env
source tensortrade-env/bin/activate
pip install -e .
pip install -r examples/requirements.txt
import tensortrade.env.default as default
from tensortrade.feed.core import Stream, DataFeed
from tensortrade.oms.exchanges import Exchange
from tensortrade.oms.services.execution.simulated import execute_order
from tensortrade.oms.wallets import Wallet, Portfolio
# Define exchange and portfolio
coinbase = Exchange("coinbase", service=execute_order)(
Stream.source(price_data, dtype="float").rename("USD-BTC")
)
portfolio = Portfolio(USD, [Wallet(coinbase, 10000 * USD), Wallet(coinbase, 0 * BTC)])
# Build environment
env = default.create(
portfolio=portfolio,
action_scheme="managed-risk", # BUY/SELL/HOLD with risk sizing
reward_scheme="risk-adjusted", # Sharpe-ratio based reward
feed=DataFeed([price_stream, volume_stream, rsi_stream]),
window_size=20,
)
from ray import tune
from ray.rllib.algorithms.ppo import PPOConfig
config = (
PPOConfig()
.environment(env_class, env_config={"window_size": 20})
.training(lr=1e-4, gamma=0.99, train_batch_size=4000)
.rollouts(num_rollout_workers=4)
)
tune.run("PPO", config=config.to_dict(), stop={"episodes_total": 500})
# examples/training/train_optuna.py
# Searches: lr, gamma, clip_param, window_size, reward_scheme
| Scheme | Description |
|---|---|
simple | BUY / SELL / HOLD discrete actions |
managed-risk | Position sizing + stop-loss built-in |
bsh | Binary: BUY or SELL only |
| Scheme | Description |
|---|---|
simple | Raw P&L per step |
risk-adjusted | Sharpe ratio-based |
position-based | Return based on current position |
| Finding | Detail |
|---|---|
| Directional accuracy | PPO learns BTC direction at 0 commission |
| Commission sensitivity | Even small fees (0.1%) significantly hurt returns |
| Training regime | Needs 200+ episodes to converge on noisy data |
| Overfitting risk | Walk-forward validation critical |
# Simple training run
python examples/training/train_simple.py
# Distributed training (Ray)
python examples/training/train_ray.py
# Hyperparameter search
python examples/training/train_optuna.py
# Use pre-tuned config
python examples/training/train_best.py
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
reinforcement-learning, algorithmic-trading, trading-env, rllib, ppo, dqn
npx claudepluginhub mahmoud20138/tradecraft --plugin tradecraft169 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.
Other plugins' skills for the same job