lazy-okx-dca

SKILL.md

Lazy OKX DCA - Automated Dollar Cost Averaging

Automated DCA strategy powered by OKX OnchainOS DEX API. Execute scheduled token purchases across 20+ chains with optimal routing through 500+ DEXs.

When to Use

Apply this skill when:

  • Setting up automated token purchases (DCA) via OKX
  • Finding optimal swap rates across OKX DEXs
  • Monitoring token prices and execution history
  • Managing portfolio accumulation strategies

Prerequisites

1. Install OKX OnchainOS Skills

npx skills add okx/onchainos-skills

2. Get OKX API Credentials

Visit OKX OnchainOS Developer Portal:

  1. Connect your OKX Wallet
  2. Navigate to API Key management
  3. Create a new API Key
  4. Save the following credentials:
    • OK-ACCESS-KEY (API Key)
    • OK-ACCESS-SECRET (Secret Key)
    • OK-ACCESS-PASSPHRASE (Passphrase)

3. Configure Environment Variables

Add credentials to your OpenClaw config:

Via openclaw.json (recommended):

Edit ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "lazy-okx-dca": {
        "env": {
          "OKX_API_KEY": "your-api-key",
          "OKX_SECRET_KEY": "your-secret-key",
          "OKX_PASSPHRASE": "your-passphrase",
          "WALLET_PRIVATE_KEY": "your-wallet-private-key"
        }
      }
    }
  }
}

Via .env file:

Create .env in project directory:

OKX_API_KEY=your-api-key
OKX_SECRET_KEY=your-secret-key
OKX_PASSPHRASE=your-passphrase
WALLET_PRIVATE_KEY=your-wallet-private-key

Via shell profile:

Add to ~/.zshrc or ~/.bashrc:

export OKX_API_KEY="your-api-key"
export OKX_SECRET_KEY="your-secret-key"
export OKX_PASSPHRASE="your-passphrase"
export WALLET_PRIVATE_KEY="your-wallet-private-key"

Run source ~/.zshrc to apply changes.

4. Verify Installation

Restart OpenClaw and test:

"What's the current price of ETH?"

OKX Capabilities

Feature Description
Multi-chain Ethereum, Polygon, Arbitrum, Optimism, Solana, Sui, TON, X-Layer, 20+ chains
DEX Aggregation Routes across 500+ DEXs for optimal pricing
Best Price Real-time comparison with smart order splitting
Low Slippage Intelligent routing minimizes price impact

Supported Chains

Chain Status Popular Tokens
Ethereum Supported ETH, USDC, USDT
Polygon Supported MATIC, USDC
Arbitrum Supported ETH, USDC
Optimism Supported ETH, USDC
Solana Supported SOL, USDC
Base Supported ETH, USDC
X-Layer Supported OKB, USDC
Sui Supported SUI
TON Supported TON

See OKX OnchainOS Docs for full list.

Usage Patterns

Single Purchase

"Buy 100 USDC worth of ETH with 0.5% slippage"

Setup DCA Schedule

"Set up weekly DCA: buy 50 USDC of BTC every Monday at 10am"

Query Best Rate

"Show me the best rate for swapping 1 ETH to USDC across all DEXs"

View History

"Show my recent DCA transactions"

Environment Variables

Required

Variable Description Source
OKX_API_KEY OKX API key OKX OnchainOS
OKX_SECRET_KEY OKX API secret Same as above
OKX_PASSPHRASE OKX API passphrase Same as above
WALLET_PRIVATE_KEY Wallet private key for signing Your wallet export

Optional

Variable Default Description
DCA_DEFAULT_AMOUNT 100 Default DCA amount (USDC)
DCA_DEFAULT_TOKEN ETH Default purchase token
DCA_DEFAULT_SLIPPAGE 0.005 Default slippage (0.5%)
DCA_DEFAULT_CHAIN eth Default blockchain

Workflow

1. Receive DCA instruction
2. Query OKX DEX API for optimal quote
3. Display price estimate + slippage + fees
4. Wait for user confirmation
5. Construct transaction data
6. Sign and broadcast (requires private key)
7. Log transaction
8. Wait for on-chain confirmation

Security Notes

  1. Private key storage: Keys stored locally only, never uploaded
  2. Test first: Use small amounts for initial testing (e.g., 1 USDC)
  3. Slippage settings: Increase during high volatility to avoid failed transactions
  4. Gas fees: Be aware of on-chain gas costs for small transactions
  5. Dedicated wallet: Use a separate wallet for DCA operations

DCA Psychology Tips

  1. Cost averaging: Buy less at highs, more at lows, lowering average cost
  2. Emotional stability: No need to watch markets, avoid FOMO and panic selling
  3. Long-term focus: Time in market beats timing the market
  4. Automation: Discipline matters more than timing
Weekly Installs
3
First Seen
8 days ago
Installed on
amp3
cline3
openclaw3
opencode3
cursor3
kimi-cli3