Automating Crypto Operations: Complete Playbook
How to automate repetitive crypto tasks using Python scripts, cron jobs, and AI assistants. From monitoring to reporting.
Automating Crypto Operations: Complete Playbook
Introduction
Manual crypto management is time-consuming. This guide covers automation strategies using Python, cron jobs, and AI assistants to streamline operations.
Automation Levels
Level 1: Basic Monitoring (Beginner)
- Price alerts
- Balance checking
- Simple notifications
Level 2: Data Collection (Intermediate)
- Automated data gathering
- Spreadsheet updates
- Report generation
Level 3: Full Automation (Advanced)
- Auto-trading bots
- Self-healing systems
- Intelligent decision making
Python Automation Scripts
1. Price Monitor
import requests
import time
# Check BTC price every 5 minutes
def check_btc_price():
url = "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"
response = requests.get(url)
data = response.json()
price = float(data['price'])
if price > 70000: # Alert threshold
print(f"🚨 BTC above $70k! Current: ${price}")
return price
# Schedule with cron: */5 * * * * /usr/bin/python3 /home/user/check_price.py
2. Mining Status Reporter
import subprocess
import json
from datetime import datetime
def check_mining_status():
# Check process running
result = subprocess.run(
['pgrep', '-f', 'nara'],
capture_output=True,
text=True
)
is_running = result.returncode == 0
# Log to file
with open('mining_log.txt', 'a') as f:
timestamp = datetime.now().isoformat()
status = "RUNNING" if is_running else "STOPPED"
f.write(f"{timestamp}: Mining {status}\n")
return is_running
3. Balance Tracker
import json
from pathlib import Path
def track_balances():
wallets = Path("wallets").glob("*.json")
total = 0
for wallet in wallets:
# Read balance from each wallet
data = json.loads(wallet.read_text())
balance = data.get('balance', 0)
total += balance
# Save to tracking sheet
with open('balance_history.csv', 'a') as f:
f.write(f"{datetime.now().date()},{total}\n")
Cron Job Setup
Basic Syntax
* * * * * command
│ │ │ │ │
│ │ │ │ └─── Day of week (0-7)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59)
Common Schedules
# Every 5 minutes
*/5 * * * * /usr/bin/python3 /home/user/check_prices.py
# Every hour
0 * * * * /usr/bin/python3 /home/user/update_sheet.py
# Every day at 8am
0 8 * * * /usr/bin/python3 /home/user/daily_report.py
# Every Monday at 9am
0 9 * * 1 /usr/bin/python3 /home/user/weekly_summary.py
Using Hermes Cron
# Via Rin (AI assistant)
"Rin, schedule daily NARA balance check at 9am"
# Rin executes:
cronjob.create(
schedule="0 9 * * *",
prompt="Check NARA mining status and current balance"
)
Web Dashboard Automation
Flask Status Dashboard
from flask import Flask, jsonify
import psutil
import subprocess
app = Flask(__name__)
@app.route('/api/status')
def get_status():
return jsonify({
'cpu': psutil.cpu_percent(),
'ram': psutil.virtual_memory().percent,
'mining': check_mining_process(),
'timestamp': datetime.now().isoformat()
})
def check_mining_process():
result = subprocess.run(
['pgrep', '-f', 'nara'],
capture_output=True
)
return result.returncode == 0
AI-Powered Automation
Smart Alerts
Instead of simple threshold alerts:
"Rin, monitor BTC price and alert me when:
1. Price drops more than 5% in 1 hour
2. RSI goes below 30 on 4h timeframe
3. Volume spike >200% of average"
Automated Research
"Rin, every Monday:
1. Check top 10 trending crypto projects on Twitter
2. Analyze their on-chain metrics
3. Create summary report
4. Send to my Telegram"
Best Practices
1. Error Handling
try:
result = risky_operation()
except Exception as e:
log_error(e)
send_alert(f"Automation failed: {e}")
# Don't crash other operations
2. Rate Limiting
import time
# Don't hammer APIs
for symbol in symbols:
check_price(symbol)
time.sleep(1) # Wait 1 second between calls
3. Logging
import logging
logging.basicConfig(
filename='crypto_automation.log',
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
logging.info("Price check started")
logging.warning("API rate limit approaching")
4. Security
- Store credentials in
.envfiles (not in code) - Use read-only API keys when possible
- Encrypt sensitive data
- Limit automation to safe operations only
Automation Ideas
Daily Tasks
- [ ] Check all wallet balances
- [ ] Update tracking spreadsheet
- [ ] Verify mining operations running
- [ ] Check news for portfolio coins
Weekly Tasks
- [ ] Generate performance report
- [ ] Analyze gas fees patterns
- [ ] Review airdrop farming progress
- [ ] Backup wallet files
Monthly Tasks
- [ ] Portfolio rebalancing analysis
- [ ] VPS performance optimization
- [ ] Security audit (check for leaks)
- [ ] Strategy review and adjustment
Conclusion
Start small: 1. ✅ Set up basic monitoring 2. ✅ Automate one repetitive task 3. ✅ Build on success 4. ✅ Gradually increase automation
Goal: Spend less time on repetitive tasks, more time on strategy and alpha discovery!