feat(oi): add open interest scraper module

add new oi_scraper directory for collecting open interest data
and update the main EA to integrate with the scraper functionality
This commit is contained in:
Kunthawat Greethong
2026-01-04 17:35:14 +07:00
parent d79bf572ef
commit 28a4546cd8
9 changed files with 1278 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
# CME OI Scraper - PowerShell Script
# Copy this file to: run_scraper.ps1
# ==========================================
# Configuration
# ==========================================
$scriptPath = "C:\Users\YourUsername\Gitea\MeanRevisionEA\oi_scraper"
$logFile = "$scriptPath\scraper.log"
$csvFile = "$scriptPath\oi_data.csv"
$mt5Path = "C:\Users\YourUsername\AppData\Roaming\MetaQuotes\Terminal\[Your_Terminal_ID]\MQL5\Files\oi_data.csv"
# ==========================================
# Helper Functions
# ==========================================
function Write-Log {
param([string]$message)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logEntry = "[$timestamp] $message"
Write-Output $logEntry | Add-Content $logFile
Write-Host $logEntry
}
# ==========================================
# Main Script
# ==========================================
# Navigate to script directory
cd $scriptPath
Write-Log "=========================================="
Write-Log "CME OI Scraper - Daily Update"
Write-Log "=========================================="
try {
# Run Python scraper
Write-Log "Starting Python scraper..."
& python main.py *>> $logFile 2>&1
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) {
Write-Log "Python scraper completed successfully"
# Check if CSV was created
if (Test-Path $csvFile)) {
$fileInfo = Get-Item $csvFile
Write-Log "CSV file found (Last modified: $($fileInfo.LastWriteTime))"
# Copy to MT5 directory
Write-Log "Copying CSV to MetaTrader 5 Files directory..."
try {
Copy-Item -Path $csvFile -Destination $mt5Path -Force
Write-Log "CSV successfully copied to MT5 directory"
# Verify copy
if (Test-Path $mt5Path)) {
Write-Log "Verified: MT5 CSV file exists"
} else {
Write-Log "ERROR: MT5 CSV file not found after copy"
}
} catch {
Write-Log "ERROR: Failed to copy to MT5 directory - $_"
}
} else {
Write-Log "WARNING: CSV file not found after scraper execution"
}
} else {
Write-Log "ERROR: Python scraper failed with exit code $exitCode"
}
} catch {
Write-Log "ERROR: Script failed - $($_.Exception.Message)"
exit 1
}
Write-Log "=========================================="
Write-Log "Script completed"
Write-Log "=========================================="