<< All versions
Skill v1.0.1
currentAutomated scan96/100alsk1992/cloddsbot/trading-system
2 files
──Details
PublishedSeptember 9, 2026 at 01:10 AM
Content Hashsha256:22fc1f41d904a814...
Git SHA715fd4a6c06b
Bump Typepatch
──Files
Files (1 file, 6.4 KB)
SKILL.md6.4 KBactive
SKILL.md · 292 lines · 6.4 KB
version: "1.0.1" name: trading-system description: "Unified trading system with auto-logging, bots, and performance analytics" emoji: "🤖" gates: envs: anyOf:
- POLY_API_KEY
- KALSHI_API_KEY
Trading System - Complete API Reference
Unified trading system with auto-logging to SQLite, bot management, and performance analytics.
Chat Commands
Portfolio
/trading portfolio # View all positions/trading portfolio poly # Positions on Polymarket/trading portfolio --value # Include current values
Performance
/trading stats # Overall statistics/trading stats --period 30d # Last 30 days/trading daily-pnl # Daily P&L breakdown/trading weekly-pnl # Weekly P&L/trading monthly-pnl # Monthly P&L
Trade History
/trading history # Recent trades/trading history --limit 50 # Last 50 trades/trading history --platform poly # Polymarket only/trading export # Export to CSV/trading export --format json # Export as JSON
Bot Management
/bot list # List all bots/bot register <name> <strategy> # Register new bot/bot start <name> # Start bot/bot stop <name> # Stop bot/bot status <name> # Bot status/bot delete <name> # Delete bot
Bot Strategies
/bot strategies # List available strategies/bot create mean-reversion --config {...} # Create with config/bot create momentum --lookback 14 # Momentum strategy/bot create arbitrage --min-spread 1 # Arbitrage strategy
TypeScript API Reference
Create Trading System
typescript
import { createTradingSystem } from 'clodds/trading';const trading = createTradingSystem({// Execution serviceexecution: executionService,// Auto-loggingautoLog: true,logPath: './trades.db',// Bot configurationbots: {enabled: true,maxConcurrent: 5,},});
Portfolio
typescript
// Get portfolioconst portfolio = await trading.getPortfolio();console.log(`Total value: $${portfolio.totalValue.toLocaleString()}`);console.log(`Unrealized P&L: $${portfolio.unrealizedPnl.toLocaleString()}`);for (const position of portfolio.positions) {console.log(`[${position.platform}] ${position.market}`);console.log(` Side: ${position.side}`);console.log(` Size: ${position.size}`);console.log(` Avg price: ${position.avgPrice}`);console.log(` Current: ${position.currentPrice}`);console.log(` P&L: $${position.unrealizedPnl.toFixed(2)}`);}
Statistics
typescript
// Get trading statisticsconst stats = await trading.getStats({ period: '30d' });console.log(`Total trades: ${stats.totalTrades}`);console.log(`Win rate: ${(stats.winRate * 100).toFixed(1)}%`);console.log(`Profit factor: ${stats.profitFactor.toFixed(2)}`);console.log(`Total P&L: $${stats.totalPnl.toLocaleString()}`);console.log(`Avg trade: $${stats.avgTrade.toFixed(2)}`);console.log(`Largest win: $${stats.largestWin.toFixed(2)}`);console.log(`Largest loss: $${stats.largestLoss.toFixed(2)}`);console.log(`Sharpe ratio: ${stats.sharpeRatio.toFixed(2)}`);console.log(`Max drawdown: ${(stats.maxDrawdown * 100).toFixed(1)}%`);
Daily P&L
typescript
// Get daily P&Lconst dailyPnl = await trading.getDailyPnL({ days: 30 });for (const day of dailyPnl) {const sign = day.pnl >= 0 ? '+' : '';console.log(`${day.date}: ${sign}$${day.pnl.toFixed(2)} (${day.trades} trades)`);}
Export Trades
typescript
// Export to CSVawait trading.exportTrades({format: 'csv',path: './trades.csv',from: '2024-01-01',to: '2024-12-31',});// Export to JSONconst trades = await trading.exportTrades({format: 'json',from: '2024-01-01',});
Bot Management
typescript
// List botsconst bots = trading.bots.list();// Register a botawait trading.bots.register({name: 'my-arb-bot',strategy: 'arbitrage',config: {minSpread: 1,maxPositionSize: 500,platforms: ['polymarket', 'kalshi'],},});// Start botawait trading.bots.start('my-arb-bot');// Get statusconst status = trading.bots.getStatus('my-arb-bot');console.log(`Running: ${status.isRunning}`);console.log(`Trades today: ${status.tradesToday}`);console.log(`P&L today: $${status.pnlToday}`);// Stop botawait trading.bots.stop('my-arb-bot');// Delete botawait trading.bots.delete('my-arb-bot');
Built-in Strategies
typescript
// Mean Reversionawait trading.bots.register({name: 'mean-rev',strategy: 'mean-reversion',config: {lookbackPeriod: 20,deviationThreshold: 2,positionSize: 100,},});// Momentumawait trading.bots.register({name: 'momentum',strategy: 'momentum',config: {lookbackPeriod: 14,entryThreshold: 0.6,exitThreshold: 0.4,positionSize: 100,},});// Arbitrageawait trading.bots.register({name: 'arb',strategy: 'arbitrage',config: {minSpread: 1,minLiquidity: 500,maxPositionSize: 1000,},});
Custom Strategy
typescript
// Register custom strategytrading.bots.registerStrategy('my-strategy', {init: async (ctx) => {// Initialize state},evaluate: async (ctx) => {// Return signalsreturn [{platform: 'polymarket',marketId: 'market-123',action: 'buy',side: 'YES',size: 100,reason: 'Signal triggered',},];},onTrade: (trade) => {console.log(`Trade executed: ${trade.orderId}`);},cleanup: async () => {// Cleanup},});
Auto-Logging
All trades are automatically logged to SQLite:
sql
-- trades tableSELECT * FROM tradesWHERE platform = 'polymarket'ORDER BY timestamp DESCLIMIT 10;-- Get win rateSELECTCOUNT(CASE WHEN pnl > 0 THEN 1 END) * 100.0 / COUNT(*) as win_rateFROM trades;
Best Practices
- Start with paper trading - Use dry-run mode first
- Set position limits - Prevent overexposure
- Monitor bots regularly - Don't set and forget
- Review performance weekly - Adjust strategies
- Export data regularly - Backup your trade history