alchemy-agentic-gatewa…
Use when accessing Alchemy APIs for RPC calls, token balances, NFT metadata, asset transfers, transaction simulation, or…
Set up automated trading strategies — DCA, limit orders, and stop losses — by composing mp CLI commands with OS scheduling (cron/launchd).
$ npx -y skills add moonpay/skills --skill moonpay-trading-automation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/moonpay-trading-automationContext preview
The summary Claude sees to decide when to auto-load this skill.
Set up automated trading strategies — DCA, limit orders, and stop losses — by composing mp CLI commands with OS scheduling (cron/launchd).
name: moonpay-trading-automation description: Set up automated trading strategies — DCA, limit orders, and stop losses — by composing mp CLI commands with OS scheduling (cron/launchd). tags: [trading, automation]
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.
Every strategy uses the same base pattern. Scripts live in `~/.config/moonpay/scripts/` and log to `~/.config/moonpay/logs/trading.log`.
#!/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:
"Buy $5 of SOL every day at 9am"
Use the base pattern above with the user's token, amount, wallet, and chain.
# 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:
Write a plist to `~/Library/LaunchAgents/com.moonpay.dca-sol.plist`:
<?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`.
"Buy SOL when price drops below $80"
#!/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"
fiSchedule every 5 minutes:
"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:
# --- 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 "Agent Skills for crypto infrastructure — wallet management, token trading, cross-chain bridges, fiat on/off ramp, prediction markets, and more. Skills are instructional folders that AI agents load dynamically to perform specialized tasks.
Use when accessing Alchemy APIs for RPC calls, token balances, NFT metadata, asset transfers, transaction simulation, or…
Integrates Alchemy blockchain APIs using an API key. Requires $ALCHEMY_API_KEY to be set; if unavailable, use the…
Query blockchain data via Allium APIs. Token prices, wallet balances, transactions, historical data. Use when user asks about…
Query blockchain data via Allium APIs. Supports API key, x402 micropayments, and Tempo auth. Covers prices, wallets, tokens, and…
Paid API marketplace for AI agents via Corbits. Search hundreds of premium API proxies, call them with automatic USDC…
Blockchain analytics via Dune REST API — execute DuneSQL queries against live on-chain data, discover decoded contract tables,…