A standalone market monitoring and analysis system for Derive protocol ETH options markets.
This system continuously monitors Derive options markets to identify trading opportunities based on spreads, volumes, and market dynamics. It provides real-time market scanning, historical trend analysis, and opportunity scoring.
The main scanning engine that:
- Fetches all active ETH options from Derive
- Collects orderbook depths and ticker data
- Calculates spreads, volumes, and Greeks
- Scores opportunities based on configurable criteria
- Saves timestamped snapshots to JSON files
Analysis tool for market data that provides:
- Latest snapshot analysis
- Historical comparison between snapshots
- Trend analysis across multiple snapshots
- Opportunity identification by strategy type
- Spread and volume analytics
Template configuration file with:
- API credentials placeholders
- Scanning parameters
- Output settings
- Opportunity scoring weights
- Strategy definitions
-
Install Elixir Dependencies The scripts will auto-install required dependencies on first run.
-
Configure API Access
- Copy
config.json.templatetoconfig.json - Add your Derive API credentials
- Adjust scanning parameters as needed
- Copy
-
Set Environment Variables (Optional)
export DERIVE_API_KEY="your_api_key" export DERIVE_API_SECRET="your_api_secret" export DERIVE_SUBACCOUNT_ID="your_subaccount_id" export DERIVE_RPC_URL="https://api.derive.xyz" export MARKET_DATA_DIR="market_data"
# Run with default settings (uses environment variables or defaults)
elixir watcher.exs
# Run with custom output directory
elixir watcher.exs /path/to/output/dir
# Run continuously (with cron or loop)
while true; do
elixir watcher.exs
sleep 600 # Wait 10 minutes
done# Analyze the latest snapshot
elixir analyzer.exs latest
# Compare two snapshots
elixir analyzer.exs compare market_data/market_1234.json market_data/market_5678.json
# Analyze trends across all snapshots
elixir analyzer.exs trends market_data
# Find top opportunities in latest snapshot
elixir analyzer.exs opportunities
# Find opportunities in specific file
elixir analyzer.exs opportunities market_data/market_1234.jsonMarket snapshots are saved as JSON files with the following structure:
{
"timestamp": "2025-01-31T12:00:00Z",
"markets_scanned": 150,
"data": [
{
"instrument_name": "ETH-31JAN25-3800-C",
"strike": 3800,
"type": "CALL",
"expiry": "31JAN25",
"days_to_expiry": 3.5,
"best_bid": 120.50,
"best_ask": 126.50,
"spread_dollars": 6.00,
"spread_percent": 4.74,
"volume_24h": 45.2,
"open_interest": 123.5,
"greeks": {
"delta": 0.55,
"gamma": 0.0012,
"theta": -15.2,
"vega": 8.3,
"iv": 0.65
},
"opportunity_scores": {
"total_score": 75,
"spread_score": 100,
"volume_score": 70,
"oi_score": 80,
"competition_score": 70
}
}
]
}Markets are scored from 0-100 based on:
-
Spread Score (40% weight)
- Optimal: $3-10 (score: 100)
- Too tight (<$1): Heavy competition (score: 20)
- Too wide (>$20): Likely illiquid (score: 40)
-
Volume Score (30% weight)
- Based on 24-hour trading volume
- Higher volume = higher score
-
Open Interest Score (20% weight)
- Indicates market liquidity
- More OI = higher score
-
Competition Score (10% weight)
- Based on spread tightness
- Wider spreads = less competition = higher score
The analyzer identifies opportunities for different strategies:
-
Short-term High Theta (≤7 days, spread ≥$5)
- Capture high time decay on near-expiry options
- Higher risk but potentially higher returns
-
Medium-term Balanced (7-21 days, good volume)
- Balance between theta decay and time value
- More stable spreads
-
High Volume Markets (≥100 contracts/day)
- Focus on liquid markets
- Easier to enter/exit positions
-
Wide Spread Opportunities (≥$20 spread)
- Less competitive markets
- Potential for larger profit margins
# Add to crontab for automatic scanning every 10 minutes
*/10 * * * * /usr/bin/elixir /path/to/watcher.exs >> /var/log/derive_watcher.log 2>&1Create a service file /etc/systemd/system/derive-watcher.service:
[Unit]
Description=Derive Options Market Watcher
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/path/to/watcher
ExecStart=/usr/bin/elixir watcher.exs
Restart=always
RestartSec=600
[Install]
WantedBy=multi-user.targetTo prevent disk space issues:
- Set
max_files_to_keepin config - Implement log rotation
- Archive old data periodically
Example cleanup script:
# Keep only last 7 days of data
find market_data -name "market_*.json" -mtime +7 -delete-
API Connection Issues
- Verify API credentials
- Check network connectivity
- Ensure RPC URL is correct
-
No Data Returned
- Check if markets are active
- Verify strike range and expiry parameters
- Ensure ETH price fetch is working
-
High Memory Usage
- Reduce
days_aheadparameter - Limit
strike_range_percent - Process fewer instruments at once
- Reduce
This software is provided as-is for educational and research purposes. Use at your own risk when trading real assets.
Contributions welcome! Please ensure:
- Code is well-documented
- No hardcoded credentials
- Tests for new features
- Clear commit messages