Moonpay Trading Automation logo

Moonpay Trading Automation

Organization
moonpay
moonpay-trading-automation

Set up automated trading strategies — DCA, limit orders, and stop losses — by composing mp CLI commands with OS scheduling (cron/launchd).

Overview

Publishermoonpay
Repositoryskills
Skill namemoonpay-trading-automation
Stars
112
Forks
30
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by moonpay on GitHub. Read the source before you install it.

Installation

Install the Moonpay Trading Automation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/moonpay/skills/tree/main/skills/moonpay-trading-automation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/moonpay/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/moonpay-trading-automation .claude/skills/moonpay-trading-automation
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Moonpay Trading Automation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Moonpay Trading Automation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Moonpay Trading Automation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Trading automation

Goal

Compose mp CLI commands with OS scheduling (cron/launchd) to run unattended trading strategies: dollar-cost averaging, limit orders, and stop losses. The agent generates shell scripts and schedules them — no new tools needed.

Prerequisites

  • Authenticated: mp user retrieve
  • Funded wallet: mp token balance list --wallet <name> --chain <chain>
  • mp binary on PATH: which mp (note the full path for scheduled scripts)
  • jq installed: which jq

Shell script pattern

Every strategy uses the same base pattern. Scripts live in ~/.config/moonpay/scripts/ and log to ~/.config/moonpay/logs/trading.log.

bash
#!/bin/bash
set -euo pipefail

MP="$(which mp)"  # absolute path for cron/launchd
LOG="$HOME/.config/moonpay/logs/trading.log"
mkdir -p "$(dirname "$LOG")"

log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG"; }

# --- Config (agent fills these in) ---
WALLET="main"
CHAIN="solana"
FROM_TOKEN="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"  # USDC
TO_TOKEN="So11111111111111111111111111111111111111111"         # SOL
AMOUNT=5

# --- Execute ---
log "SWAP: $AMOUNT $FROM_TOKEN -> $TO_TOKEN on $CHAIN"
RESULT=$("$MP" --json token swap \
  --wallet "$WALLET" --chain "$CHAIN" \
  --from-token "$FROM_TOKEN" --from-amount "$AMOUNT" \
  --to-token "$TO_TOKEN" 2>&1) || {
  log "FAILED: $RESULT"
  exit 1
}
log "OK: $RESULT"

Key points:

  • mp --json outputs single-line JSON, ideal for jq parsing
  • Use $(which mp) and store as MP — cron/launchd have minimal PATH
  • Wallet names only in scripts — mp handles keychain decryption at runtime
  • If the user gives token names/symbols, resolve to addresses first with mp token search

DCA (Dollar-Cost Averaging)

"Buy $5 of SOL every day at 9am"

Script: ~/.config/moonpay/scripts/dca-sol.sh

Use the base pattern above with the user's token, amount, wallet, and chain.

Schedule with cron (Linux)

bash
# Buy $5 of SOL daily at 9am UTC — moonpay:dca-sol
0 9 * * * ~/.config/moonpay/scripts/dca-sol.sh

Add with: (crontab -l 2>/dev/null; echo '0 9 * * * ~/.config/moonpay/scripts/dca-sol.sh # moonpay:dca-sol') | crontab -

Common intervals:

  • Every hour: 0 * * * *
  • Every 4 hours: 0 */4 * * *
  • Daily at 9am: 0 9 * * *
  • Weekly Monday 9am: 0 9 * * 1

Schedule with launchd (macOS)

Write a plist to ~/Library/LaunchAgents/com.moonpay.dca-sol.plist:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.moonpay.dca-sol</string>
  <key>ProgramArguments</key>
  <array>
    <string>/bin/bash</string>
    <string>/Users/USERNAME/.config/moonpay/scripts/dca-sol.sh</string>
  </array>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Hour</key>
    <integer>9</integer>
    <key>Minute</key>
    <integer>0</integer>
  </dict>
  <key>StandardErrorPath</key>
  <string>/Users/USERNAME/.config/moonpay/logs/dca-sol.err</string>
</dict>
</plist>

Load with: launchctl load ~/Library/LaunchAgents/com.moonpay.dca-sol.plist

Important: Tilde (~) does NOT expand in plist files. Always use the full path (e.g., /Users/USERNAME/...). Get it with echo $HOME.

Limit order

"Buy SOL when price drops below $80"

Script: ~/.config/moonpay/scripts/limit-buy-sol.sh

bash
#!/bin/bash
set -euo pipefail

MP="$(which mp)"
LOG="$HOME/.config/moonpay/logs/trading.log"
mkdir -p "$(dirname "$LOG")"
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG"; }

# --- Config ---
WALLET="main"
CHAIN="solana"
TOKEN="So11111111111111111111111111111111111111111"
BUY_WITH="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"  # USDC
BUY_AMOUNT=50
TARGET_PRICE=80
SCRIPT_NAME="limit-buy-sol"

# --- Check price ---
PRICE=$("$MP" --json token search --query "$TOKEN" --chain "$CHAIN" | jq -r '.items[0].marketData.price')

if [ -z "$PRICE" ] || [ "$PRICE" = "null" ]; then
  log "LIMIT $SCRIPT_NAME: price fetch failed, skipping"
  exit 0
fi

# --- Compare ---
if (( $(echo "$PRICE < $TARGET_PRICE" | bc -l) )); then
  log "LIMIT $SCRIPT_NAME: price $PRICE < $TARGET_PRICE — executing buy"
  RESULT=$("$MP" --json token swap \
    --wallet "$WALLET" --chain "$CHAIN" \
    --from-token "$BUY_WITH" --from-amount "$BUY_AMOUNT" \
    --to-token "$TOKEN" 2>&1) || {
    log "LIMIT $SCRIPT_NAME FAILED: $RESULT"
    exit 1
  }
  log "LIMIT $SCRIPT_NAME OK: bought at $PRICE — $RESULT"

  # Self-disable after fill
  if [[ "$OSTYPE" == "darwin"* ]]; then
    launchctl unload "$HOME/Library/LaunchAgents/com.moonpay.${SCRIPT_NAME}.plist" 2>/dev/null || true
  else
    crontab -l | grep -v "$SCRIPT_NAME" | crontab -
  fi
  log "LIMIT $SCRIPT_NAME: disabled after fill"
else
  log "LIMIT $SCRIPT_NAME: price $PRICE >= $TARGET_PRICE — waiting"
fi

Schedule every 5 minutes:

  • Cron: */5 * * * * ~/.config/moonpay/scripts/limit-buy-sol.sh # moonpay:limit-buy-sol
  • Launchd: use <key>StartInterval</key><integer>300</integer> instead of StartCalendarInterval

Stop loss

"Sell all my SOL if price drops below $70"

Same structure as limit order but sells instead of buys. For "sell all", query the balance first:

bash
# --- Config ---
SELL_TOKEN="So11111111111111111111111111111111111111111"   # SOL
TO_TOKEN="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" # USDC
TRIGGER_PRICE=70
SCRIPT_NAME="stop-loss-sol"

# --- Check price ---
PRICE=$("$MP" --json token search --query "$SELL_TOKEN" --chain "$CHAIN" | jq -r '.items[0].marketData.price')

if (( $(echo "$PRICE < $TRIGGER_PRICE" | bc -l) )); then
  # Get current balance to sell all
  BALANCE=$("$MP" --json token balance list --wallet "$WALLET" --chain "$CHAIN" \
    | jq -r --arg addr "$SELL_TOKEN" '.items[] | select(.address == $addr) | .balance.amount')

  if [ -n "$BALANCE" ] && (( $(echo "$BALANCE > 0" | bc -l) )); then
    log "STOP-LOSS $SCRIPT_NAME: price $PRICE < $TRIGGER_PRICE — selling $BALANCE"
    RESULT=$("$MP" --json token swap \
      --wallet "$WALLET" --chain "$CHAIN" \
      --from-token "$SELL_TOKEN" --from-amount "$BALANCE" \
      --to-token "$TO_TOKEN" 2>&1) || {
      log "STOP-LOSS $SCRIPT_NAME FAILED: $RESULT"
      exit 1
    }
    log "STOP-LOSS $SCRIPT_NAME OK: sold at $PRICE — $RESULT"
    # Self-disable (same pattern as limit order)
  fi
fi

Managing automations

List active automations

bash
# macOS
launchctl list | grep moonpay

# Linux
crontab -l | grep moonpay

Remove an automation

bash
# macOS
launchctl unload ~/Library/LaunchAgents/com.moonpay.dca-sol.plist
rm ~/Library/LaunchAgents/com.moonpay.dca-sol.plist

# Linux
crontab -l | grep -v "moonpay:dca-sol" | crontab -

View logs

bash
tail -50 ~/.config/moonpay/logs/trading.log

Pause / resume (macOS only)

bash
launchctl unload ~/Library/LaunchAgents/com.moonpay.dca-sol.plist   # pause
launchctl load ~/Library/LaunchAgents/com.moonpay.dca-sol.plist     # resume

Platform detection

Detect the OS and use the appropriate scheduler:

bash
if [[ "$OSTYPE" == "darwin"* ]]; then
  # macOS: use launchd (fires even if machine was asleep)
else
  # Linux: use crontab
fi

Tips

  • Start with a small DCA amount to verify the setup works before going bigger
  • Check logs after the first run: tail -20 ~/.config/moonpay/logs/trading.log
  • Scripts don't contain secrets — mp decrypts wallets via OS keychain at runtime
  • The machine must be logged in (user session active) for keychain access to work
  • Price checks via mp token search are free; swaps cost gas
  • Limit order checks every 5 minutes is reasonable — don't go below 1 minute
  • Use bc -l for decimal price comparison (bash can't compare floats natively)
  • If bc isn't available, use: awk "BEGIN {exit !($PRICE < $TARGET)}"
  • Always tag cron entries with # moonpay:{name} so they can be found and removed

Related skills

  • moonpay-swap-tokens — Swap and bridge command syntax
  • moonpay-check-wallet — Check balances before setting up automation
  • moonpay-discover-tokens — Research tokens and resolve addresses
  • moonpay-price-alerts — Observe-only price notifications (no trading)

Frequently asked questions

What does the Moonpay Trading Automation AI skill do?

Set up automated trading strategies — DCA, limit orders, and stop losses — by composing mp CLI commands with OS scheduling (cron/launchd).

Why use Moonpay Trading Automation on TypingMind?

Because you install it once and use it with any model. Moonpay Trading Automation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Moonpay Trading Automation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/moonpay/skills/tree/main/skills/moonpay-trading-automation. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Moonpay Trading Automation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Moonpay Trading Automation?

As many as you like. As long as a model supports skills, you can use Moonpay Trading Automation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Moonpay Trading Automation AI skill free?

Yes. It is published on GitHub by moonpay under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇