algo-trading

Installation
SKILL.md

algo-trading

Purpose

This skill automates algorithmic trading by integrating quantitative models with financial APIs to execute buy/sell orders based on predefined strategies. It processes market data, runs backtests, and handles live trading to minimize human intervention in financial markets.

When to Use

Use this skill for high-frequency trading, portfolio optimization, or strategy backtesting in volatile markets. Apply it when you need to automate trades based on indicators like moving averages or RSI, especially for stocks, forex, or crypto, to reduce emotional decisions and improve efficiency.

Key Capabilities

  • Fetch real-time or historical data from APIs like Alpha Vantage or Yahoo Finance using endpoints such as /query?function=TIME_SERIES_DAILY.
  • Implement strategies like moving average crossover or mean reversion with built-in functions, e.g., strategy.run('MA_Crossover', params).
  • Backtest models on historical data with metrics like Sharpe ratio, using commands like backtest --data CSV_FILE --strategy STRATEGY_NAME.
  • Execute trades via broker APIs, supporting integration with Alpaca (e.g., POST /v2/orders) or Robinhood, with risk controls like stop-loss.
  • Handle data analysis with libraries like NumPy for calculations, e.g., computing RSI in 2 lines: rsi = talib.RSI(close, timeperiod=14); signals = np.where(rsi > 70, 'sell', 'buy').

Usage Patterns

To use this skill, first set environment variables for authentication, e.g., export ALPHA_VANTAGE_API_KEY=$SERVICE_API_KEY. Initialize the skill in your code with import openclaw; oc = openclaw.Skill('algo-trading'). For CLI, run openclaw algo-trading init --config config.json to load a strategy file. In scripts, call strategies like oc.execute_strategy('MA_Crossover', symbols=['AAPL'], timeframe='1d'). Always wrap calls in try-except blocks for error resilience. For live trading, enable with a flag: oc.run_live('--broker alpaca --key $ALPACA_KEY').

Related skills
Installs
93
GitHub Stars
5
First Seen
Mar 5, 2026