Skip to main content

Use case: The autonomous trader

Set up a fully automated trading strategy — including DCA, limit orders, stop losses, and price alerts — that runs in your own non-custodial wallet with no server required.

Updated today

What this builds


An agent that executes a complete trading strategy automatically, using your own non-custodial wallet. You define the rules once; the agent runs them indefinitely.

The core loop is: Define strategy → Execute on schedule → Monitor positions → Exit on rules

The moonpay-trading-automation skill composes CLI commands with your OS scheduler — cron on Linux/Mac, launchd on Mac, or Task Scheduler on Windows. No new infrastructure, no always-on server. Your machine runs the strategy in the background.

Install the required skills


</> Bash
npx skills add moonpay/skills --skill moonpay-trading-automation moonpay-swap-tokens moonpay-price-alerts

Skills used: moonpay-trading-automation · moonpay-swap-tokens · moonpay-virtual-account · moonpay-price-alerts · moonpay-check-wallet · maiat-token-safety · thoughtproof-reasoning-check

Set up a DCA strategy


Dollar-cost averaging (DCA) lets you buy a fixed amount of a token on a recurring schedule.

Example prompt:

> Set up a DCA: buy $50 of SOL every day at 9am for 30 days. Use my "main" wallet.

The agent will:

  1. Verify your wallet is funded

  2. Generate a shell script using mp token swap

  3. Schedule it via cron

  4. Confirm the schedule is active

The generated script looks like this:

</> Bash
# Generated by agent, runs daily at 9:00 AM
mp token swap \
--wallet main \
--chain solana \
--from-token USDC \
--from-amount 50 \
--to-token SOL

Add a limit order


A limit order triggers a buy only when a token reaches your target price.

Example prompt:

> Also: if ETH drops below $2,800, buy $200 of ETH. Check every 15 minutes.

The agent generates a conditional script that checks the price before executing:

</> Bash
#!/bin/bash
PRICE=$(mp -f compact token retrieve --token ETH --chain ethereum | jq '.price')
if (( $(echo "$PRICE < 2800" | bc -l) )); then
mp token swap --wallet main --chain ethereum \
--from-token USDC --from-amount 200 --to-token ETH
fi

This script runs every 15 minutes via cron.

Add a stop loss


A stop loss automatically sells your position if the price falls below a threshold.

Example prompt:

> If SOL drops 25% from my average entry price, sell everything.

The agent tracks your entry prices from trade history and generates a stop-loss monitor that runs on schedule.

Add safety gates


Safety gates protect your funds by running checks before any trade executes.

Token safety check

Example prompt:

> Before any automated buy, always run a token safety check. Only execute if the token passes.

The agent prepends maiat-token-safety checks to every generated script. Honeypots and rug pulls are caught before funds move.

Reasoning verification for high-value trades

Example prompt:

> For any single trade above $500, run a ThoughtProof check and only execute if it returns ALLOW.

Tip: Combining both safety gates gives you layered protection — token-level fraud detection plus logic-level verification on your largest trades.

Set up price alerts


Price alerts notify you when a token hits a target — no trades involved.

Example prompt:

> Send me a desktop notification when SOL hits $250.
> Also alert me when BTC drops below $80,000.

moonpay-price-alerts sets up a local monitor that runs as a lightweight background process. Stack as many alerts as you want.

Check in on your strategy


At any time, you can query your strategy's performance:

- How's my DCA doing? 
- What's my average SOL entry price?
- How much USDC have I spent on the strategy so far?- Show me all trades from the last 7 days.

moonpay-check-wallet and moonpay-export-data handle all of these queries.

Fund your strategy from fiat


To go fully automated starting from fiat currency:

  1. Use moonpay-virtual-account to set up a virtual bank account (IBAN or ACH) connected to your wallet

  2. Wire funds from your bank

  3. The agent detects the deposit and starts the DCA automatically

Note: The only manual step is the initial bank transfer. Everything else runs automatically after that.

Full example session


Here's everything set up in a single conversation:

Example prompt:

Set up the following:
> - DCA: $30 of SOL every day at 8am
> - Limit order: buy $200 ETH if price drops below $2,800
> - Stop loss: sell all SOL if it drops 30% from my average entry
> - Alert: notify me when SOL hits $300
> - Safety gate: run token check before every buy

Use my "main" wallet. My budget is $500/month total — pause all buying if I hit that.

The agent sets up four cron jobs, a budget monitor, and a price alert. Total setup time: one conversation.

FAQs


Do I need a server or cloud infrastructure?

No. The agent uses your machine's built-in OS scheduler (cron, launchd, or Task Scheduler). Your computer needs to be on and running for scheduled jobs to execute.

Is my wallet custodial?

No. This strategy runs entirely in your own non-custodial wallet. You hold your keys at all times.

What happens if a token fails the safety check?

The trade is blocked before any funds move. The agent will not execute a swap if maiat-token-safety flags the token.

Can I pause or cancel a strategy?

Yes. You can ask the agent to list, pause, or remove any scheduled jobs at any time during the conversation.

Did this answer your question?