DEV Community

Julio Molina Soler
Julio Molina Soler

Posted on

Running Automated Crypto Grid Trading Bots Across Multiple L2s: A Month in Production

Running Automated Crypto Grid Trading Bots Across Multiple L2s: A Month in Production

I've been running automated grid trading bots on Ethereum Layer 2 networks for about a month now. This is a technical post-mortem of what's working, what's not, and the real numbers.

The Setup

Strategy: Grid trading (buy low, sell high in predefined bands)

Networks: Arbitrum One, Base, Linea

Hedge: 2x leveraged ETH short on Hyperliquid

Execution: System cron (every 5 minutes), zero AI/cloud costs

Why Grid Trading?

Grid trading works when you believe an asset will trade in a range but don't know the exact direction. You place buy orders below the current price and sell orders above it. When the price oscillates, you profit from the spread.

It's not a "get rich quick" strategy. It's designed for:

  • Range-bound markets (sideways price action)
  • Volatile but non-trending assets
  • Automated, emotionless execution

Current Configuration

After initial testing, I settled on these parameters:

  • Grid Spacing: 2.5% (reduced from 1.5% to avoid overtrading)
  • Grid Levels: 8 (4 above, 4 below the anchor price)
  • Max Trades/Day: 30 per bot
  • Stop Loss: 15% (emergency brake)

The Bots

Bot Network Trade Size Status Trades Today
Arbitrum Grid Arbitrum One $14/trade Active 30 (limit hit)
Base Grid Base $5/trade Active 20
Linea Grid Linea $8/trade Active 13
Hyperliquid Short Hyperliquid 2x leverage Open Position monitoring

The Numbers (March 13, 2026, 15:50 UTC)

Arbitrum Grid Bot

  • Started with: ~$108 USDC
  • Current value: ~$104.76
  • P&L: -$3.37 (-3.1%)
  • Trades today: 30 (daily limit reached)

Analysis: Small loss is expected in a trending market. Grid trading shines in sideways action, not rallies. The bot hit its daily trade limit, suggesting either high volatility or the grid spacing could be widened further.

Base Grid Bot

  • Started with: ~$39 USDC (recorded)
  • Current value: ~$77.95
  • P&L: +$39.16 (+101%)

Red flag: This performance suggests either additional deposits I didn't track properly, or the initial balance recording was wrong. I need better accounting. The strategy alone doesn't double capital in a month.

Linea Grid Bot

  • Started with: ~$119 USDC (recorded)
  • Current value: ~$261.29
  • P&L: +$142.69 (+120%)

Same issue: The numbers don't add up. Grid trading is profitable, but not 2x-in-a-month profitable. This is an accounting problem, not a miracle strategy.

Hyperliquid ETH Short (2x Leverage)

  • Entry price: $2,071.70
  • Current price: $2,140.10
  • Position size: -0.0555 ETH (short)
  • Collateral: $57.46
  • Unrealized P&L: -$3.80 (-6.6%)
  • Funding earned: -$0.15 (net negative)

Analysis: The short was supposed to hedge against a market downturn and earn negative funding rates (getting paid to hold the position). Instead:

  1. ETH rallied 3.3% since entry (short = loss)
  2. Funding rates have been positive, meaning I'm paying to hold the short

This is a classic case of "market doesn't care about your thesis."

What's Working

1. Infrastructure is Solid

  • 100% uptime: Cron-based execution runs every 5 minutes, no failures
  • Zero transaction failures: All trades confirmed on-chain
  • Gas costs are negligible: ~$2.29 total today across all bots on all networks

2. L2s Are Actually Usable

Gas costs per trade:

  • Arbitrum: ~$0.05
  • Base: ~$0.02
  • Linea: ~$0.03

Compare this to Ethereum mainnet where a single Uniswap trade can cost $5-50 depending on congestion. L2s make high-frequency strategies viable.

3. Helios Light Client Works

I'm using Helios as a local Ethereum light client. It verifies RPC responses cryptographically without trusting a centralized provider. It's been rock-solid.

What's Not Working

1. Accounting is Broken

The initial portfolio tracking is unreliable. I didn't properly separate:

  • Deposits/withdrawals
  • Trading P&L
  • Gas costs

Without clean accounting, I can't evaluate performance. This is a non-negotiable fix.

2. The "Hedge" Isn't Hedging

The Hyperliquid short was meant to:

  • Hedge against market downturns
  • Earn negative funding rates (passive income)

Instead:

  • ETH went up (short lost money)
  • Funding rates stayed positive (paying, not earning)

Lesson: Don't call something a "hedge" just because it's a short position. A hedge should reduce risk, not add directional exposure.

3. Grid Anchors Drift

Grid trading works best when the price oscillates around the anchor. When ETH moves significantly away from the anchor, the grid becomes asymmetric:

  • Arbitrum bot: Currently at grid level 5 (above anchor), meaning it's mostly selling (reducing ETH exposure)

I need to implement auto-reanchoring when price deviates too far.

Lessons Learned

1. Track Everything from Day One

Don't estimate initial balances. Log every deposit, withdrawal, and trade with timestamps. Future-you will thank past-you.

2. Grid Trading Loves Volatility, Not Trends

Grid bots make money in choppy, range-bound markets. In a strong trend (up or down), they underperform holding. Know the market regime.

3. Funding Rates Are Not Guaranteed

I assumed perpetual futures funding rates would stay negative (longs pay shorts). They didn't. Always plan for rates to flip.

4. Daily Trade Limits Are Essential

The Arbitrum bot hit 30 trades today. Without a limit, it could have executed 50+ trades in high volatility, racking up gas costs and potentially overtrading.

5. L2 Gas Is a Game-Changer

At $0.02-0.05 per trade, strategies that were impossible on mainnet are now viable. This unlocks an entirely new design space for automated trading.

Next Steps

Immediate Fixes

  1. Fix accounting: Separate deposit tracking from P&L
  2. Reanchor grids: When price moves >3 levels, recalibrate to market
  3. Evaluate the HL short: Either close it or admit it's a directional bet, not a hedge

Future Experiments

  1. Dynamic grid spacing: Adjust spacing based on recent volatility (ATR-based)
  2. Multi-asset grids: Extend to other pairs (ETH/USDC works, but what about SOL/USDC?)
  3. On-chain analytics: Pull historical performance directly from transaction logs

Tech Stack

  • Language: Python
  • EVM Interactions: web3.py
  • Hyperliquid SDK: hyperliquid-python-sdk
  • Execution: System cron (5-min intervals)
  • RPC: Helios (Ethereum light client) + Ankr public RPC as fallback
  • Networks: Arbitrum One, Base, Linea, Hyperliquid

Conclusion

Running automated trading bots in production is less about the strategy and more about infrastructure, accounting, and risk management.

The grid trading strategy is sound, but:

  • I need proper accounting to evaluate it
  • The "hedge" was poorly designed
  • Grid trading performs best in sideways markets (which we haven't had)

The good news: The infrastructure works. Zero downtime, zero failed transactions, negligible gas costs. That's the foundation. Now I can iterate on strategy with confidence.

If you're building something similar, start with the boring stuff: logging, error handling, and accounting. The sexy ML-powered alpha strategies can wait.


Questions? Critiques? Drop a comment. I'm learning in public, and feedback is gold.


Disclaimer: This is not financial advice. I'm documenting my experiments for educational purposes. Automated trading involves significant risk. Only trade with capital you can afford to lose.

Top comments (0)