
Trading Strategies
Implement prediction-market trading strategies with a shared BaseStrategy interface, signals, position sizing, and hooks for backtesting.
Overview
trading-strategies is an agent skill most often used in Build (also Validate prototype, Operate iterate) that provides a BaseStrategy framework for prediction-market signals, sizing, and backtesting.
Install
npx skills add https://github.com/agentmc15/polymarket-trader --skill trading-strategiesWhat is this skill?
- BaseStrategy abstract class with analyze(), calculate_position_size(), and signal history
- Typed Signal and MarketState dataclasses (prices, volume, orderbook, recent trades)
- SignalType enum and confidence-scored signals for buy/sell/hold decisions
- Framework for creating new strategies, signals, and backtesting logic
- Async analyze(market) contract for live prediction-market feeds
Adoption & trust: 1.1k installs on skills.sh; 24 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want automated prediction-market trades but lack a reusable strategy interface for analysis, signals, and position sizing.
Who is it for?
Builders coding Polymarket or similar prediction-market bots who want abstract strategy classes and shared signal metadata.
Skip if: Casual bettors seeking trade picks without coding, or teams needing regulated brokerage compliance workflows out of the box.
When should I use this skill?
Use when creating new strategies, implementing signals, or building backtesting logic for prediction markets.
What do I get? / Deliverables
You implement concrete strategies atop BaseStrategy with typed signals and market state, ready to connect to backtests and live execution pipelines.
- BaseStrategy subclasses
- Signal generation pipeline
- Backtesting harness hooks
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Strategy code and signal logic are built as backend trading infrastructure before ship-time validation and operate-time monitoring. The skill centers on Python strategy classes, MarketState analysis, and position sizing—backend implementation for automated traders.
Where it fits
Spike a mean-reversion or orderbook strategy class against historical MarketState fixtures before committing capital.
Implement async analyze() and calculate_position_size() for a new signal pipeline tied to Polymarket token IDs.
Adjust sizing and confidence thresholds in BaseStrategy subclasses after reviewing signals_history from production runs.
How it compares
A code framework skill for strategy classes—not a PRD planner or a no-code trading signal feed.
Common Questions / FAQ
Who is trading-strategies for?
Solo developers building agent-assisted prediction-market trading systems who need structured Python strategy and signal abstractions.
When should I use trading-strategies?
Use in build/backend when implementing new strategies or backtests; in validate/prototype when spike-testing signal logic; in operate/iterate when extending position rules after live metrics.
Is trading-strategies safe to install?
Review the Security Audits panel on this page; trading skills may encourage network and secrets access—never deploy live capital without your own risk controls and code review.
SKILL.md
READMESKILL.md - Trading Strategies
# Trading Strategy Development Skill ## Strategy Base Class ```python from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Optional from datetime import datetime from enum import Enum class SignalType(Enum): BUY = "buy" SELL = "sell" HOLD = "hold" @dataclass class Signal: type: SignalType token_id: str price: float size: float confidence: float # 0-1 timestamp: datetime metadata: dict = None @dataclass class MarketState: token_id: str yes_price: float no_price: float volume_24h: float open_interest: float orderbook: dict recent_trades: list timestamp: datetime class BaseStrategy(ABC): """Base class for all trading strategies.""" def __init__(self, config: dict): self.config = config self.positions = {} self.signals_history = [] @abstractmethod async def analyze(self, market: MarketState) -> Optional[Signal]: """Analyze market and generate signal.""" pass @abstractmethod def calculate_position_size( self, signal: Signal, portfolio_value: float ) -> float: """Calculate appropriate position size.""" pass def should_execute(self, signal: Signal) -> bool: """Determine if signal should be executed.""" return signal.confidence >= self.config.get("min_confidence", 0.6) ``` ## Strategy Types ### 1. Arbitrage Strategy ```python class ArbitrageStrategy(BaseStrategy): """Detect and exploit pricing inefficiencies.""" async def find_opportunities( self, markets: list[MarketState] ) -> list[Signal]: opportunities = [] # Check YES + NO > 1 (overpriced) for market in markets: total = market.yes_price + market.no_price if total > 1.02: # 2% threshold opportunities.append( self._create_arb_signal(market, "overpriced", total) ) # Check related markets opportunities.extend( await self._find_related_arbs(markets) ) return opportunities async def analyze(self, market: MarketState) -> Optional[Signal]: total = market.yes_price + market.no_price # Overpriced market (YES + NO > 1) if total > 1.0 + self.config.get("arb_threshold", 0.02): profit_pct = (total - 1.0) * 100 return Signal( type=SignalType.SELL, token_id=market.token_id, price=total, size=self.config.get("default_size", 100), confidence=min(profit_pct / 10, 1.0), timestamp=datetime.utcnow(), metadata={"arb_type": "overpriced", "profit_pct": profit_pct} ) return None ``` ### 2. Copy Trading Strategy ```python class CopyTradingStrategy(BaseStrategy): """Mirror trades of successful traders.""" def __init__(self, config: dict): super().__init__(config) self.tracked_traders = config.get("tracked_traders", []) self.trade_delay = config.get("delay_seconds", 30) self.size_multiplier = config.get("size_multiplier", 0.5) async def process_trader_activity( self, trader_address: str, trade: dict ) -> Optional[Signal]: """Generate signal based on tracked trader activity.""" if trader_address not in self.tracked_traders: return None trader_score = await self._get_trader_score(trader_address) return Signal( type=SignalType.BUY if trade["side"] == "BUY" else SignalType