Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- BACKUP_PATH_CONFIG.py +79 -0
- BATCH_FIX_PATHS.py +70 -0
- DISABLE_ALL_INPUTS.py +83 -0
- FIX_ALL_SCRIPT_PATHS.py +117 -0
- FIX_DOWNLOAD_BREAK.py +58 -0
- FIX_EMOJI_ENCODING.py +44 -0
- FIX_TRY_EXCEPT.py +44 -0
- PATCH_ALL_SCRIPTS.py +93 -0
- SETUP_SCHEDULER_WITH_TIMEZONE.ps1 +139 -0
- TEST_ORCHESTRATOR.py +30 -0
- UNIVERSAL_NUMERAI_ORCHESTRATOR.py +1206 -0
- UPDATE_ALL_DOWNLOADS.py +81 -0
- UPDATE_ALL_SCRIPT_PATHS.py +59 -0
- USE_EXISTING_DATA.py +28 -0
- app.py +115 -0
- check_online_scores.py +185 -0
- check_upload.py +53 -0
- compare_core_models.py +210 -0
- data/crypto/crypto/crypto_live_round_1248.parquet +3 -0
- data/crypto/crypto/crypto_live_round_1249.parquet +3 -0
- data/crypto/crypto/crypto_live_round_1250.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1243.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1244.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1245.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1248.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1249.parquet +3 -0
- data/crypto/crypto/crypto_v2_live_round_1250.parquet +3 -0
- data/crypto/crypto/live_20260411_140230.parquet +3 -0
- data/crypto/crypto/live_20260411_140443.parquet +3 -0
- data/crypto/crypto/live_20260411_144550.parquet +3 -0
- data/crypto/crypto/live_20260411_144757.parquet +3 -0
- data/crypto/crypto/live_20260411_151852.parquet +3 -0
- data/crypto/crypto/live_20260411_152626.parquet +3 -0
- data/crypto/crypto/live_20260411_153214.parquet +3 -0
- data/crypto/crypto/live_20260411_153305.parquet +3 -0
- data/crypto/crypto/live_20260411_153609.parquet +3 -0
- data/crypto/crypto/live_20260411_153823.parquet +3 -0
- data/crypto/crypto/live_20260414_140604.parquet +3 -0
- data/crypto/crypto/live_20260415_100038.parquet +3 -0
- data/crypto/crypto/live_20260416_120551.parquet +3 -0
- data/crypto/crypto_live_round_1248.parquet +3 -0
- data/crypto/crypto_live_round_1249.parquet +3 -0
- data/crypto/crypto_live_round_1250.parquet +3 -0
- data/crypto/crypto_live_round_1251.parquet +3 -0
- data/crypto/crypto_live_round_1252.parquet +3 -0
- data/crypto/crypto_live_round_1253.parquet +3 -0
- data/crypto/crypto_live_round_1255.parquet +3 -0
- data/crypto/crypto_v2_live_round_1243.parquet +3 -0
- data/crypto/crypto_v2_live_round_1244.parquet +3 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
data/main/live_20260414_141339.parquet.temp filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
data/main/main/live_20260414_141339.parquet.temp filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
data/main/main_live_round_1251.parquet.temp filter=lfs diff=lfs merge=lfs -text
|
BACKUP_PATH_CONFIG.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Path configuration for running scripts from backup folder
|
| 3 |
+
Import this at the top of each script to automatically adjust paths
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
# Detect if we're running from backup
|
| 10 |
+
BACKUP_DIR = Path("/app")
|
| 11 |
+
RUNNING_FROM_BACKUP = Path.cwd().resolve().is_relative_to(BACKUP_DIR.resolve())
|
| 12 |
+
|
| 13 |
+
if RUNNING_FROM_BACKUP:
|
| 14 |
+
print("🔧 BACKUP MODE: Using backup folder paths")
|
| 15 |
+
|
| 16 |
+
# Base paths
|
| 17 |
+
BASE_DIR = BACKUP_DIR
|
| 18 |
+
MODELS_DIR = BACKUP_DIR / "models"
|
| 19 |
+
SCRIPTS_DIR = BACKUP_DIR / "scripts"
|
| 20 |
+
|
| 21 |
+
# Tournament-specific model paths
|
| 22 |
+
MODELS = {
|
| 23 |
+
'root': MODELS_DIR / "root",
|
| 24 |
+
'main': MODELS_DIR / "main",
|
| 25 |
+
'signals': MODELS_DIR / "signals",
|
| 26 |
+
'crypto': MODELS_DIR / "crypto",
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
# Output directories
|
| 30 |
+
SUBMISSIONS_DIR = BACKUP_DIR / "submissions"
|
| 31 |
+
SUBMISSIONS_DIR.mkdir(exist_ok=True)
|
| 32 |
+
|
| 33 |
+
# Create tournament submission folders
|
| 34 |
+
for tournament in ['main', 'signals', 'crypto']:
|
| 35 |
+
(SUBMISSIONS_DIR / tournament).mkdir(exist_ok=True)
|
| 36 |
+
|
| 37 |
+
# Path mapping function
|
| 38 |
+
def get_model_path(tournament, filename):
|
| 39 |
+
"""Get model file path for given tournament"""
|
| 40 |
+
if tournament == 'crypto' and 'crypto_full_activations' in filename:
|
| 41 |
+
return MODELS['crypto'] / 'crypto_full_activations' / Path(filename).name
|
| 42 |
+
elif tournament == 'main' and 'trained_models' in filename:
|
| 43 |
+
return MODELS['main'] / 'trained_models' / Path(filename).name
|
| 44 |
+
else:
|
| 45 |
+
return MODELS[tournament] / filename
|
| 46 |
+
|
| 47 |
+
def get_submission_path(tournament):
|
| 48 |
+
"""Get submission directory for tournament"""
|
| 49 |
+
return SUBMISSIONS_DIR / tournament
|
| 50 |
+
|
| 51 |
+
# Config paths
|
| 52 |
+
CONFIG_DIR = BACKUP_DIR / "config"
|
| 53 |
+
|
| 54 |
+
else:
|
| 55 |
+
print("📠PRODUCTION MODE: Using production paths")
|
| 56 |
+
|
| 57 |
+
# Production paths remain as-is
|
| 58 |
+
BASE_DIR = Path("C:/tournament_numerai")
|
| 59 |
+
|
| 60 |
+
def get_model_path(tournament, filename):
|
| 61 |
+
"""Return production paths"""
|
| 62 |
+
if tournament == 'crypto':
|
| 63 |
+
return Path("c:/tournament_numerai/crypto/models/crypto_full_activations") / filename
|
| 64 |
+
elif tournament == 'main' and 'trained_models' in filename:
|
| 65 |
+
return Path("C:/tournament_numerai/main/trained_models") / filename
|
| 66 |
+
else:
|
| 67 |
+
return Path(f"C:/tournament_numerai/{tournament}") / filename
|
| 68 |
+
|
| 69 |
+
def get_submission_path(tournament):
|
| 70 |
+
"""Get production submission directory"""
|
| 71 |
+
return Path(f"C:/tournament_numerai/{tournament}/submissions")
|
| 72 |
+
|
| 73 |
+
CONFIG_DIR = Path("C:/3tournaments/historical_validation")
|
| 74 |
+
|
| 75 |
+
# Print configuration
|
| 76 |
+
print(f" Base: {BASE_DIR}")
|
| 77 |
+
if RUNNING_FROM_BACKUP:
|
| 78 |
+
print(f" Models: {MODELS_DIR}")
|
| 79 |
+
print(f" Submissions: {SUBMISSIONS_DIR}")
|
BATCH_FIX_PATHS.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Complete path fix for all 48 scripts
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 9 |
+
|
| 10 |
+
fixed = 0
|
| 11 |
+
for script in all_scripts:
|
| 12 |
+
try:
|
| 13 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 14 |
+
content = f.read()
|
| 15 |
+
|
| 16 |
+
# Determine tournament from path
|
| 17 |
+
if 'main' in str(script):
|
| 18 |
+
tournament = 'main'
|
| 19 |
+
elif 'signals' in str(script):
|
| 20 |
+
tournament = 'signals'
|
| 21 |
+
elif 'crypto' in str(script):
|
| 22 |
+
tournament = 'crypto'
|
| 23 |
+
else:
|
| 24 |
+
continue
|
| 25 |
+
|
| 26 |
+
# Find and replace the configuration section
|
| 27 |
+
if '# CONFIGURATION' in content and 'BASE_DIR' in content:
|
| 28 |
+
# Replace entire config section with working version
|
| 29 |
+
lines = content.split('\n')
|
| 30 |
+
new_lines = []
|
| 31 |
+
in_config = False
|
| 32 |
+
skip_until_print = False
|
| 33 |
+
|
| 34 |
+
for i, line in enumerate(lines):
|
| 35 |
+
if '# CONFIGURATION' in line:
|
| 36 |
+
in_config = True
|
| 37 |
+
new_lines.append(line)
|
| 38 |
+
new_lines.append('# ' + '=' * 44)
|
| 39 |
+
new_lines.append('TESTING_MODE = os.getenv("TESTING_MODE", "true").lower() == "true"')
|
| 40 |
+
new_lines.append('if TESTING_MODE:')
|
| 41 |
+
new_lines.append(f' BASE_DIR = Path("c:/numerai48models")')
|
| 42 |
+
new_lines.append(f' MODEL_DIR = BASE_DIR / "models" / "{tournament}"')
|
| 43 |
+
new_lines.append(f' DATA_DIR = BASE_DIR / "data" / "{tournament}"')
|
| 44 |
+
new_lines.append(f' OUTPUT_DIR = BASE_DIR / "submissions" / "{tournament}"')
|
| 45 |
+
new_lines.append('else:')
|
| 46 |
+
new_lines.append(' BASE_DIR = Path("/app")')
|
| 47 |
+
new_lines.append(f' MODEL_DIR = BASE_DIR / "models" / "{tournament}"')
|
| 48 |
+
new_lines.append(f' DATA_DIR = BASE_DIR / "data" / "{tournament}"')
|
| 49 |
+
new_lines.append(f' OUTPUT_DIR = BASE_DIR / "submissions" / "{tournament}"')
|
| 50 |
+
new_lines.append('')
|
| 51 |
+
new_lines.append('for dir_path in [DATA_DIR, OUTPUT_DIR]:')
|
| 52 |
+
new_lines.append(' dir_path.mkdir(exist_ok=True, parents=True)')
|
| 53 |
+
skip_until_print = True
|
| 54 |
+
elif skip_until_print and 'print(f"[FOLDER] Model directory' in line:
|
| 55 |
+
skip_until_print = False
|
| 56 |
+
new_lines.append(line)
|
| 57 |
+
elif not skip_until_print:
|
| 58 |
+
new_lines.append(line)
|
| 59 |
+
|
| 60 |
+
content = '\n'.join(new_lines)
|
| 61 |
+
|
| 62 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 63 |
+
f.write(content)
|
| 64 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 65 |
+
fixed += 1
|
| 66 |
+
|
| 67 |
+
except Exception as e:
|
| 68 |
+
print(f"[ERR] {script.name}: {e}")
|
| 69 |
+
|
| 70 |
+
print(f"\nFixed {fixed} scripts!")
|
DISABLE_ALL_INPUTS.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Comprehensive fix for all 48 scripts:
|
| 3 |
+
1. Remove alternative model warnings
|
| 4 |
+
2. Fix download logic to check for existing round data
|
| 5 |
+
3. Ensure single download per round
|
| 6 |
+
"""
|
| 7 |
+
import os
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 11 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 12 |
+
|
| 13 |
+
fixed = 0
|
| 14 |
+
for script in all_scripts:
|
| 15 |
+
try:
|
| 16 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 17 |
+
content = f.read()
|
| 18 |
+
|
| 19 |
+
modified = False
|
| 20 |
+
|
| 21 |
+
# Fix 1: Remove alternative model loading warnings
|
| 22 |
+
if '[WARNING] Could not load alternative' in content:
|
| 23 |
+
content = content.replace(
|
| 24 |
+
'print(f" [WARNING] Could not load alternative ASIG model: {e}")',
|
| 25 |
+
'pass # Skip warning'
|
| 26 |
+
)
|
| 27 |
+
modified = True
|
| 28 |
+
|
| 29 |
+
# Fix 2: Better download logic - check for existing round file first
|
| 30 |
+
old_download = '''# Delete existing file to force fresh download (in case server has new round with same number)
|
| 31 |
+
if live_path.exists():
|
| 32 |
+
print(f" [CLEAN] Deleting existing file to force fresh download")
|
| 33 |
+
live_path.unlink()'''
|
| 34 |
+
|
| 35 |
+
new_download = '''# Check if file exists and is valid
|
| 36 |
+
if live_path.exists():
|
| 37 |
+
print(f" [FOUND] Using existing round {current_round} data: {live_path.name}")
|
| 38 |
+
# No need to download again
|
| 39 |
+
skip_wait.set() # Skip download loop'''
|
| 40 |
+
|
| 41 |
+
if old_download in content:
|
| 42 |
+
content = content.replace(old_download, new_download)
|
| 43 |
+
modified = True
|
| 44 |
+
|
| 45 |
+
# Fix 3: Skip download if file already exists
|
| 46 |
+
old_loop_start = '''for attempt in range(max_retries):
|
| 47 |
+
if skip_wait.is_set():
|
| 48 |
+
print("\n [SKIP] Skipping wait - continuing immediately")
|
| 49 |
+
break
|
| 50 |
+
|
| 51 |
+
if SKIP_API:
|
| 52 |
+
print(" [SKIP_API] Using existing data file, skipping download")
|
| 53 |
+
break'''
|
| 54 |
+
|
| 55 |
+
new_loop_start = '''# Check if we already have the file
|
| 56 |
+
if live_path.exists():
|
| 57 |
+
print(f" [EXISTS] Round {current_round} data already downloaded")
|
| 58 |
+
else:
|
| 59 |
+
for attempt in range(max_retries):
|
| 60 |
+
if skip_wait.is_set():
|
| 61 |
+
print("\n [SKIP] Skipping wait - continuing immediately")
|
| 62 |
+
break
|
| 63 |
+
|
| 64 |
+
if SKIP_API:
|
| 65 |
+
print(" [SKIP_API] Using existing data file, skipping download")
|
| 66 |
+
break'''
|
| 67 |
+
|
| 68 |
+
if old_loop_start in content:
|
| 69 |
+
content = content.replace(old_loop_start, new_loop_start)
|
| 70 |
+
# Also need to fix the closing of the loop
|
| 71 |
+
# Find the end of the download loop and dedent
|
| 72 |
+
modified = True
|
| 73 |
+
|
| 74 |
+
if modified:
|
| 75 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 76 |
+
f.write(content)
|
| 77 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 78 |
+
fixed += 1
|
| 79 |
+
|
| 80 |
+
except Exception as e:
|
| 81 |
+
print(f"[ERR] {script.name}: {e}")
|
| 82 |
+
|
| 83 |
+
print(f"\nFixed {fixed} scripts!")
|
FIX_ALL_SCRIPT_PATHS.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Batch fix all 48 scripts to:
|
| 3 |
+
1. Skip API calls
|
| 4 |
+
2. Use existing round 1253 data
|
| 5 |
+
"""
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 10 |
+
|
| 11 |
+
# All script paths to fix
|
| 12 |
+
script_patterns = [
|
| 13 |
+
"main/*.py",
|
| 14 |
+
"main_v2/*.py",
|
| 15 |
+
"main_v3/*.py",
|
| 16 |
+
"main_nlp/*.py",
|
| 17 |
+
"main_ultimate/*.py",
|
| 18 |
+
"signals/*.py",
|
| 19 |
+
"signals_v2/*.py",
|
| 20 |
+
"signals_v3/*.py",
|
| 21 |
+
"signals_nlp/*.py",
|
| 22 |
+
"signals_ultimate/*.py",
|
| 23 |
+
"crypto/*.py",
|
| 24 |
+
"crypto_v3/*.py",
|
| 25 |
+
"crypto_nlp/*.py",
|
| 26 |
+
"3tournaments_main/*.py",
|
| 27 |
+
"3tournaments_signals/*.py",
|
| 28 |
+
"3tournaments_crypto/*.py",
|
| 29 |
+
"3tournaments_crypto_v2/*.py"
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
all_scripts = []
|
| 33 |
+
for pattern in script_patterns:
|
| 34 |
+
all_scripts.extend(scripts_dir.glob(pattern))
|
| 35 |
+
|
| 36 |
+
patched = 0
|
| 37 |
+
for script in all_scripts:
|
| 38 |
+
try:
|
| 39 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 40 |
+
content = f.read()
|
| 41 |
+
|
| 42 |
+
if 'SKIP_API' in content:
|
| 43 |
+
continue # Already patched
|
| 44 |
+
|
| 45 |
+
# Patch 1: Add SKIP_API check before NumerAPI
|
| 46 |
+
old1 = 'napi = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'
|
| 47 |
+
new1 = '''SKIP_API = os.getenv('SKIP_API_CALLS', 'false').lower() == 'true'
|
| 48 |
+
if SKIP_API:
|
| 49 |
+
print("[SKIP_API] Using existing data")
|
| 50 |
+
napi = None
|
| 51 |
+
current_round = 1253
|
| 52 |
+
else:
|
| 53 |
+
napi = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'''
|
| 54 |
+
|
| 55 |
+
if old1 in content:
|
| 56 |
+
content = content.replace(old1, new1, 1)
|
| 57 |
+
|
| 58 |
+
# Patch 2: Same for SignalsAPI
|
| 59 |
+
old2 = 'sapi = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'
|
| 60 |
+
new2 = '''SKIP_API = os.getenv('SKIP_API_CALLS', 'false').lower() == 'true'
|
| 61 |
+
if SKIP_API:
|
| 62 |
+
print("[SKIP_API] Using existing data")
|
| 63 |
+
sapi = None
|
| 64 |
+
current_round = 1253
|
| 65 |
+
else:
|
| 66 |
+
sapi = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'''
|
| 67 |
+
|
| 68 |
+
if old2 in content:
|
| 69 |
+
content = content.replace(old2, new2, 1)
|
| 70 |
+
|
| 71 |
+
# Patch 3: Same for CryptoAPI
|
| 72 |
+
old3 = 'capi = CryptoAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'
|
| 73 |
+
new3 = '''SKIP_API = os.getenv('SKIP_API_CALLS', 'false').lower() == 'true'
|
| 74 |
+
if SKIP_API:
|
| 75 |
+
print("[SKIP_API] Using existing data")
|
| 76 |
+
capi = None
|
| 77 |
+
current_round = 1253
|
| 78 |
+
else:
|
| 79 |
+
capi = CryptoAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'''
|
| 80 |
+
|
| 81 |
+
if old3 in content:
|
| 82 |
+
content = content.replace(old3, new3, 1)
|
| 83 |
+
|
| 84 |
+
# Patch 4: Skip get_current_round calls
|
| 85 |
+
content = content.replace(
|
| 86 |
+
'current_round = napi.get_current_round()',
|
| 87 |
+
'current_round = 1253 if SKIP_API else napi.get_current_round()'
|
| 88 |
+
)
|
| 89 |
+
content = content.replace(
|
| 90 |
+
'current_round = sapi.get_current_round()',
|
| 91 |
+
'current_round = 1253 if SKIP_API else sapi.get_current_round()'
|
| 92 |
+
)
|
| 93 |
+
content = content.replace(
|
| 94 |
+
'current_round = capi.get_current_round()',
|
| 95 |
+
'current_round = 1253 if SKIP_API else capi.get_current_round()'
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
# Patch 5: Skip downloads
|
| 99 |
+
content = content.replace(
|
| 100 |
+
'napi.download_dataset(',
|
| 101 |
+
'napi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or ('
|
| 102 |
+
)
|
| 103 |
+
content = content.replace(
|
| 104 |
+
'sapi.download_dataset(',
|
| 105 |
+
'sapi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or ('
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 109 |
+
f.write(content)
|
| 110 |
+
|
| 111 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 112 |
+
patched += 1
|
| 113 |
+
|
| 114 |
+
except Exception as e:
|
| 115 |
+
print(f"[ERR] {script.name}: {e}")
|
| 116 |
+
|
| 117 |
+
print(f"\nPatched {patched}/{len(all_scripts)} scripts!")
|
FIX_DOWNLOAD_BREAK.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Fix the break statement to be inside download loop
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 9 |
+
|
| 10 |
+
fixed = 0
|
| 11 |
+
for script in all_scripts:
|
| 12 |
+
try:
|
| 13 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 14 |
+
content = f.read()
|
| 15 |
+
|
| 16 |
+
# Fix: Put the round check INSIDE the download loop
|
| 17 |
+
bad_check = """# Check if we already have this round's data
|
| 18 |
+
if live_path.exists():
|
| 19 |
+
try:
|
| 20 |
+
# Verify it's the right round
|
| 21 |
+
temp_df = pd.read_parquet(live_path)
|
| 22 |
+
if 'era' in temp_df.columns:
|
| 23 |
+
data_round = int(str(temp_df['era'].iloc[0]).replace('era', ''))
|
| 24 |
+
if data_round == current_round:
|
| 25 |
+
print(f" [EXISTS] Round {current_round} data found - using existing file")
|
| 26 |
+
break # Skip download loop
|
| 27 |
+
print(f" [INFO] Existing file is for different round - will re-download")
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f" [WARNING] Could not verify existing file: {e}")"""
|
| 30 |
+
|
| 31 |
+
good_check = """# Check if we already have this round's data (before loop starts)
|
| 32 |
+
if live_path.exists():
|
| 33 |
+
try:
|
| 34 |
+
# Verify it's the right round
|
| 35 |
+
temp_df = pd.read_parquet(live_path)
|
| 36 |
+
if 'era' in temp_df.columns:
|
| 37 |
+
data_round = int(str(temp_df['era'].iloc[0]).replace('era', ''))
|
| 38 |
+
if data_round == current_round:
|
| 39 |
+
print(f" [EXISTS] Round {current_round} data found - using existing file")
|
| 40 |
+
# Set flag to skip download loop
|
| 41 |
+
skip_wait.set()
|
| 42 |
+
else:
|
| 43 |
+
print(f" [INFO] Existing file is for different round - will re-download")
|
| 44 |
+
except Exception as e:
|
| 45 |
+
print(f" [WARNING] Could not verify existing file: {e}")"""
|
| 46 |
+
|
| 47 |
+
if bad_check in content:
|
| 48 |
+
content = content.replace(bad_check, good_check)
|
| 49 |
+
|
| 50 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 51 |
+
f.write(content)
|
| 52 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 53 |
+
fixed += 1
|
| 54 |
+
|
| 55 |
+
except Exception as e:
|
| 56 |
+
print(f"[ERR] {script.name}: {e}")
|
| 57 |
+
|
| 58 |
+
print(f"\nFixed {fixed} scripts - removed 'break' outside loop error")
|
FIX_EMOJI_ENCODING.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Add SKIP_API definition to all scripts that use it
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 9 |
+
|
| 10 |
+
fixed = 0
|
| 11 |
+
for script in all_scripts:
|
| 12 |
+
try:
|
| 13 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 14 |
+
content = f.read()
|
| 15 |
+
|
| 16 |
+
# Check if script uses SKIP_API but doesn't define it
|
| 17 |
+
if 'SKIP_API' in content and 'SKIP_API = os.getenv' not in content:
|
| 18 |
+
# Find where to insert the definition (after imports, before first use)
|
| 19 |
+
lines = content.split('\n')
|
| 20 |
+
new_lines = []
|
| 21 |
+
inserted = False
|
| 22 |
+
|
| 23 |
+
for i, line in enumerate(lines):
|
| 24 |
+
new_lines.append(line)
|
| 25 |
+
|
| 26 |
+
# Insert after the NumerAPI/SignalsAPI/CryptoAPI import
|
| 27 |
+
if not inserted and ('from numerapi import' in line or 'import numerapi' in line):
|
| 28 |
+
new_lines.append('')
|
| 29 |
+
new_lines.append('# Check if API calls should be skipped')
|
| 30 |
+
new_lines.append('SKIP_API = os.getenv("SKIP_API_CALLS", "false").lower() == "true"')
|
| 31 |
+
inserted = True
|
| 32 |
+
|
| 33 |
+
if inserted:
|
| 34 |
+
content = '\n'.join(new_lines)
|
| 35 |
+
|
| 36 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 37 |
+
f.write(content)
|
| 38 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 39 |
+
fixed += 1
|
| 40 |
+
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"[ERR] {script.name}: {e}")
|
| 43 |
+
|
| 44 |
+
print(f"\nFixed {fixed} scripts!")
|
FIX_TRY_EXCEPT.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Fix the syntax error in download patches
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
|
| 9 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 10 |
+
|
| 11 |
+
fixed = 0
|
| 12 |
+
for script in all_scripts:
|
| 13 |
+
try:
|
| 14 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 15 |
+
content = f.read()
|
| 16 |
+
|
| 17 |
+
# Fix the broken download syntax
|
| 18 |
+
if 'napi.download_dataset( if not SKIP_API' in content:
|
| 19 |
+
# Fix napi
|
| 20 |
+
content = content.replace(
|
| 21 |
+
'napi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (',
|
| 22 |
+
'if not SKIP_API: napi.download_dataset('
|
| 23 |
+
)
|
| 24 |
+
# Fix sapi
|
| 25 |
+
content = content.replace(
|
| 26 |
+
'sapi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (',
|
| 27 |
+
'if not SKIP_API: sapi.download_dataset('
|
| 28 |
+
)
|
| 29 |
+
# Fix capi
|
| 30 |
+
content = content.replace(
|
| 31 |
+
'capi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (',
|
| 32 |
+
'if not SKIP_API: capi.download_dataset('
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 36 |
+
f.write(content)
|
| 37 |
+
|
| 38 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 39 |
+
fixed += 1
|
| 40 |
+
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"[ERR] {script.name}: {e}")
|
| 43 |
+
|
| 44 |
+
print(f"\nFixed {fixed} scripts!")
|
PATCH_ALL_SCRIPTS.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Patch all 48 scripts to skip API calls and use existing data
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
|
| 9 |
+
# Find all Python scripts
|
| 10 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 11 |
+
|
| 12 |
+
patch_count = 0
|
| 13 |
+
|
| 14 |
+
for script_path in all_scripts:
|
| 15 |
+
try:
|
| 16 |
+
with open(script_path, 'r', encoding='utf-8', errors='ignore') as f:
|
| 17 |
+
content = f.read()
|
| 18 |
+
|
| 19 |
+
modified = False
|
| 20 |
+
|
| 21 |
+
# Skip if already patched
|
| 22 |
+
if 'SKIP_API_CALLS' in content:
|
| 23 |
+
continue
|
| 24 |
+
|
| 25 |
+
# Patch: Skip get_current_round() API call
|
| 26 |
+
if 'napi.get_current_round()' in content or 'api.get_current_round()' in content:
|
| 27 |
+
# Add environment check at the top of the API section
|
| 28 |
+
old_api = 'napi = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'
|
| 29 |
+
new_api = '''# SKIP_API_CALLS - Use existing data without API calls
|
| 30 |
+
SKIP_API = os.getenv('SKIP_API_CALLS', 'true').lower() == 'true'
|
| 31 |
+
|
| 32 |
+
napi = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY) if not SKIP_API else None'''
|
| 33 |
+
|
| 34 |
+
if old_api in content:
|
| 35 |
+
content = content.replace(old_api, new_api)
|
| 36 |
+
modified = True
|
| 37 |
+
|
| 38 |
+
# Skip get_current_round
|
| 39 |
+
old_round = '''try:
|
| 40 |
+
current_round = napi.get_current_round()
|
| 41 |
+
print(f" Current round: {current_round}")
|
| 42 |
+
except Exception as e:
|
| 43 |
+
print(f" [WARNING] Could not get current round: {e}")
|
| 44 |
+
print(" Proceeding with download anyway...")
|
| 45 |
+
current_round = None'''
|
| 46 |
+
|
| 47 |
+
new_round = '''if SKIP_API:
|
| 48 |
+
current_round = 1253 # Use existing round 1253 data
|
| 49 |
+
print(f" [SKIP_API] Using round: {current_round}")
|
| 50 |
+
else:
|
| 51 |
+
try:
|
| 52 |
+
current_round = napi.get_current_round()
|
| 53 |
+
print(f" Current round: {current_round}")
|
| 54 |
+
except Exception as e:
|
| 55 |
+
print(f" [WARNING] Could not get current round: {e}")
|
| 56 |
+
print(" Proceeding with download anyway...")
|
| 57 |
+
current_round = None'''
|
| 58 |
+
|
| 59 |
+
if old_round in content:
|
| 60 |
+
content = content.replace(old_round, new_round)
|
| 61 |
+
modified = True
|
| 62 |
+
|
| 63 |
+
# Skip download
|
| 64 |
+
old_download = 'napi.download_dataset("v5.2/live.parquet", str(live_path))'
|
| 65 |
+
new_download = '''if not SKIP_API:
|
| 66 |
+
napi.download_dataset("v5.2/live.parquet", str(live_path))
|
| 67 |
+
else:
|
| 68 |
+
print(" [SKIP_API] Using existing data file")'''
|
| 69 |
+
|
| 70 |
+
if old_download in content:
|
| 71 |
+
content = content.replace(old_download, new_download)
|
| 72 |
+
modified = True
|
| 73 |
+
|
| 74 |
+
# Similar for SignalsAPI
|
| 75 |
+
if 'SignalsAPI(public_id' in content:
|
| 76 |
+
old_sig = 'sapi = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)'
|
| 77 |
+
new_sig = '''SKIP_API = os.getenv('SKIP_API_CALLS', 'true').lower() == 'true'
|
| 78 |
+
sapi = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY) if not SKIP_API else None'''
|
| 79 |
+
if old_sig in content:
|
| 80 |
+
content = content.replace(old_sig, new_sig)
|
| 81 |
+
modified = True
|
| 82 |
+
|
| 83 |
+
if modified:
|
| 84 |
+
with open(script_path, 'w', encoding='utf-8', errors='ignore') as f:
|
| 85 |
+
f.write(content)
|
| 86 |
+
print(f"[OK] Patched: {script_path.relative_to(scripts_dir)}")
|
| 87 |
+
patch_count += 1
|
| 88 |
+
|
| 89 |
+
except Exception as e:
|
| 90 |
+
print(f"[ERROR] {script_path.name}: {e}")
|
| 91 |
+
|
| 92 |
+
print(f"\nPatched {patch_count} scripts!")
|
| 93 |
+
print("Set environment variable: SKIP_API_CALLS=true")
|
SETUP_SCHEDULER_WITH_TIMEZONE.ps1
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PowerShell script to create Task Scheduler task with proper UTC timezone handling
|
| 2 |
+
# Runs Tuesday-Saturday at 12:00 UTC
|
| 3 |
+
|
| 4 |
+
Write-Host "================================================================================" -ForegroundColor Cyan
|
| 5 |
+
Write-Host "NUMERAI ORCHESTRATOR - TASK SCHEDULER SETUP (UTC TIMEZONE)" -ForegroundColor Cyan
|
| 6 |
+
Write-Host "================================================================================" -ForegroundColor Cyan
|
| 7 |
+
Write-Host ""
|
| 8 |
+
Write-Host "This will create a scheduled task to run the orchestrator:"
|
| 9 |
+
Write-Host " - Days: Tuesday, Wednesday, Thursday, Friday, Saturday"
|
| 10 |
+
Write-Host " - Time: 12:00 UTC (converts to your local time automatically)"
|
| 11 |
+
Write-Host " - User: Current user ($env:USERNAME)"
|
| 12 |
+
Write-Host ""
|
| 13 |
+
|
| 14 |
+
# Get script directory
|
| 15 |
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
| 16 |
+
$BatchFile = Join-Path $ScriptDir "RUN_ORCHESTRATOR.bat"
|
| 17 |
+
$TaskName = "NumeraiOrchestrator_WeeklyRounds"
|
| 18 |
+
|
| 19 |
+
# Convert 12:00 UTC to local time
|
| 20 |
+
$utcTime = Get-Date "2024-01-01 12:00:00" -AsUTC
|
| 21 |
+
$localTime = $utcTime.ToLocalTime()
|
| 22 |
+
$localTimeStr = $localTime.ToString("HH:mm")
|
| 23 |
+
|
| 24 |
+
Write-Host "UTC Time: 12:00" -ForegroundColor Yellow
|
| 25 |
+
Write-Host "Your Local Time: $localTimeStr" -ForegroundColor Green
|
| 26 |
+
Write-Host "Your Timezone: $((Get-TimeZone).DisplayName)" -ForegroundColor Green
|
| 27 |
+
Write-Host ""
|
| 28 |
+
|
| 29 |
+
# Check if running as Administrator
|
| 30 |
+
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
| 31 |
+
|
| 32 |
+
if (-not $isAdmin) {
|
| 33 |
+
Write-Host "WARNING: Not running as Administrator" -ForegroundColor Yellow
|
| 34 |
+
Write-Host "You may need to enter your password when creating the task." -ForegroundColor Yellow
|
| 35 |
+
Write-Host ""
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# Confirm
|
| 39 |
+
$confirmation = Read-Host "Continue? (Y/N)"
|
| 40 |
+
if ($confirmation -ne 'Y' -and $confirmation -ne 'y') {
|
| 41 |
+
Write-Host "Cancelled." -ForegroundColor Red
|
| 42 |
+
exit
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
Write-Host ""
|
| 46 |
+
Write-Host "Creating task: $TaskName" -ForegroundColor Cyan
|
| 47 |
+
Write-Host "Batch file: $BatchFile" -ForegroundColor Cyan
|
| 48 |
+
Write-Host ""
|
| 49 |
+
|
| 50 |
+
# Delete existing task if it exists
|
| 51 |
+
try {
|
| 52 |
+
$existingTask = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
| 53 |
+
if ($existingTask) {
|
| 54 |
+
Write-Host "Removing existing task..." -ForegroundColor Yellow
|
| 55 |
+
Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false
|
| 56 |
+
}
|
| 57 |
+
} catch {
|
| 58 |
+
# Task doesn't exist, continue
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# Create the scheduled task using Task Scheduler COM object for more control
|
| 62 |
+
try {
|
| 63 |
+
$taskService = New-Object -ComObject Schedule.Service
|
| 64 |
+
$taskService.Connect()
|
| 65 |
+
|
| 66 |
+
$rootFolder = $taskService.GetFolder("\")
|
| 67 |
+
|
| 68 |
+
# Create task definition
|
| 69 |
+
$taskDefinition = $taskService.NewTask(0)
|
| 70 |
+
$taskDefinition.RegistrationInfo.Description = "Numerai Orchestrator - Runs all 48 models on new rounds (Tue-Sat at 12:00 UTC)"
|
| 71 |
+
$taskDefinition.Settings.Enabled = $true
|
| 72 |
+
$taskDefinition.Settings.AllowDemandStart = $true
|
| 73 |
+
$taskDefinition.Settings.DisallowStartIfOnBatteries = $false
|
| 74 |
+
$taskDefinition.Settings.StopIfGoingOnBatteries = $false
|
| 75 |
+
$taskDefinition.Settings.ExecutionTimeLimit = "PT12H" # 12 hour timeout
|
| 76 |
+
$taskDefinition.Settings.Priority = 4
|
| 77 |
+
|
| 78 |
+
# Create triggers for each day (Tue-Sat)
|
| 79 |
+
$daysOfWeek = @(2, 3, 4, 5, 6) # Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6
|
| 80 |
+
|
| 81 |
+
foreach ($day in $daysOfWeek) {
|
| 82 |
+
$trigger = $taskDefinition.Triggers.Create(3) # 3 = Weekly trigger
|
| 83 |
+
$trigger.DaysOfWeek = [Math]::Pow(2, $day - 1) # Bitwise day representation
|
| 84 |
+
$trigger.StartBoundary = (Get-Date "2024-01-01 12:00:00").ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss")
|
| 85 |
+
$trigger.Enabled = $true
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
# Create action
|
| 89 |
+
$action = $taskDefinition.Actions.Create(0) # 0 = Execute action
|
| 90 |
+
$action.Path = $BatchFile
|
| 91 |
+
$action.WorkingDirectory = $ScriptDir
|
| 92 |
+
|
| 93 |
+
# Register the task
|
| 94 |
+
$rootFolder.RegisterTaskDefinition(
|
| 95 |
+
$TaskName,
|
| 96 |
+
$taskDefinition,
|
| 97 |
+
6, # TASK_CREATE_OR_UPDATE
|
| 98 |
+
$env:USERNAME,
|
| 99 |
+
$null,
|
| 100 |
+
3, # TASK_LOGON_INTERACTIVE_TOKEN
|
| 101 |
+
$null
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
Write-Host ""
|
| 105 |
+
Write-Host "================================================================================" -ForegroundColor Green
|
| 106 |
+
Write-Host "SUCCESS - Task created successfully!" -ForegroundColor Green
|
| 107 |
+
Write-Host "================================================================================" -ForegroundColor Green
|
| 108 |
+
Write-Host ""
|
| 109 |
+
Write-Host "Task Name: $TaskName"
|
| 110 |
+
Write-Host "Schedule: Tuesday-Saturday at $localTimeStr (your local time = 12:00 UTC)"
|
| 111 |
+
Write-Host ""
|
| 112 |
+
Write-Host "To view the task:" -ForegroundColor Cyan
|
| 113 |
+
Write-Host " 1. Open Task Scheduler (taskschd.msc)"
|
| 114 |
+
Write-Host " 2. Look for '$TaskName' in Task Scheduler Library"
|
| 115 |
+
Write-Host ""
|
| 116 |
+
Write-Host "To test the task now:" -ForegroundColor Cyan
|
| 117 |
+
Write-Host " schtasks /run /TN `"$TaskName`""
|
| 118 |
+
Write-Host ""
|
| 119 |
+
Write-Host "To disable the task:" -ForegroundColor Cyan
|
| 120 |
+
Write-Host " schtasks /change /TN `"$TaskName`" /DISABLE"
|
| 121 |
+
Write-Host ""
|
| 122 |
+
Write-Host "To delete the task:" -ForegroundColor Cyan
|
| 123 |
+
Write-Host " schtasks /delete /TN `"$TaskName`" /F"
|
| 124 |
+
Write-Host ""
|
| 125 |
+
|
| 126 |
+
} catch {
|
| 127 |
+
Write-Host ""
|
| 128 |
+
Write-Host "================================================================================" -ForegroundColor Red
|
| 129 |
+
Write-Host "ERROR - Failed to create task" -ForegroundColor Red
|
| 130 |
+
Write-Host "================================================================================" -ForegroundColor Red
|
| 131 |
+
Write-Host ""
|
| 132 |
+
Write-Host $_.Exception.Message -ForegroundColor Red
|
| 133 |
+
Write-Host ""
|
| 134 |
+
Write-Host "Please try running this script as Administrator." -ForegroundColor Yellow
|
| 135 |
+
Write-Host ""
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
Write-Host "Press any key to exit..."
|
| 139 |
+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
TEST_ORCHESTRATOR.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Quick test of the orchestrator - runs immediately without waiting
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import sys
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
# Add orchestrator to path
|
| 9 |
+
sys.path.insert(0, str(Path(__file__).parent))
|
| 10 |
+
|
| 11 |
+
# Mock the input to skip waiting
|
| 12 |
+
import builtins
|
| 13 |
+
original_input = builtins.input
|
| 14 |
+
builtins.input = lambda prompt: "2" # Always choose "run immediately"
|
| 15 |
+
|
| 16 |
+
# Now import and run the orchestrator
|
| 17 |
+
from UNIVERSAL_NUMERAI_ORCHESTRATOR import main
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
print("=" * 80)
|
| 21 |
+
print("TESTING MODE - ORCHESTRATOR QUICK TEST")
|
| 22 |
+
print("Will run all 9 scripts immediately (no round wait)")
|
| 23 |
+
print("=" * 80)
|
| 24 |
+
print()
|
| 25 |
+
|
| 26 |
+
try:
|
| 27 |
+
main()
|
| 28 |
+
finally:
|
| 29 |
+
# Restore original input
|
| 30 |
+
builtins.input = original_input
|
UNIVERSAL_NUMERAI_ORCHESTRATOR.py
ADDED
|
@@ -0,0 +1,1206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
NUMERAI UNIVERSAL ORCHESTRATOR v2.0
|
| 3 |
+
Monitors round changes per tournament and executes submission scripts
|
| 4 |
+
Runs continuously until all 48 models across 3 tournaments are submitted
|
| 5 |
+
|
| 6 |
+
TOTAL MODELS: 48 (16 per tournament)
|
| 7 |
+
- Main: 16 (5 existing + 11 new v3/NLP)
|
| 8 |
+
- Signals: 16 (5 existing + 11 new v3/NLP)
|
| 9 |
+
- Crypto: 16 (5 existing + 11 new v3/NLP)
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import sys
|
| 13 |
+
import os
|
| 14 |
+
import time
|
| 15 |
+
import subprocess
|
| 16 |
+
from datetime import datetime
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
import json
|
| 19 |
+
import logging
|
| 20 |
+
import threading
|
| 21 |
+
|
| 22 |
+
# ============================================
|
| 23 |
+
# LOAD ENV FILE IF EXISTS
|
| 24 |
+
# ============================================
|
| 25 |
+
env_file = Path(__file__).parent / '.env'
|
| 26 |
+
if env_file.exists():
|
| 27 |
+
with open(env_file, 'rb') as f:
|
| 28 |
+
content = f.read()
|
| 29 |
+
content = content.replace(b'\r\n', b'\n').replace(b'\r', b'\n')
|
| 30 |
+
for line in content.decode('utf-8', errors='ignore').split('\n'):
|
| 31 |
+
line = line.strip()
|
| 32 |
+
if line and not line.startswith('#') and '=' in line:
|
| 33 |
+
key, value = line.split('=', 1)
|
| 34 |
+
key = key.strip().replace('\x00', '')
|
| 35 |
+
value = value.strip().replace('\x00', '')
|
| 36 |
+
if key:
|
| 37 |
+
os.environ[key] = value
|
| 38 |
+
|
| 39 |
+
# ============================================
|
| 40 |
+
# CONFIGURATION
|
| 41 |
+
# ============================================
|
| 42 |
+
|
| 43 |
+
# Auto-detect mode: check for /app directory (Docker) or TESTING_MODE env var
|
| 44 |
+
_testing_env = os.getenv('TESTING_MODE', '')
|
| 45 |
+
if _testing_env:
|
| 46 |
+
TESTING_MODE = _testing_env.lower() == 'true'
|
| 47 |
+
else:
|
| 48 |
+
# On Linux/Docker, /app definitely exists. On Windows, it won't.
|
| 49 |
+
TESTING_MODE = not Path("/app").is_absolute()
|
| 50 |
+
|
| 51 |
+
if TESTING_MODE:
|
| 52 |
+
BASE_DIR = Path(__file__).parent
|
| 53 |
+
SCRIPTS_DIR = BASE_DIR / "scripts"
|
| 54 |
+
MODELS_DIR = BASE_DIR / "models"
|
| 55 |
+
LOG_DIR = BASE_DIR / "logs"
|
| 56 |
+
else:
|
| 57 |
+
BASE_DIR = Path("/app")
|
| 58 |
+
SCRIPTS_DIR = BASE_DIR / "scripts"
|
| 59 |
+
MODELS_DIR = BASE_DIR / "models"
|
| 60 |
+
LOG_DIR = BASE_DIR / "logs"
|
| 61 |
+
|
| 62 |
+
LOG_DIR.mkdir(exist_ok=True, parents=True)
|
| 63 |
+
|
| 64 |
+
NUMERAI_PUBLIC_ID = os.getenv('NUMERAI_PUBLIC_ID', '')
|
| 65 |
+
NUMERAI_SECRET_KEY = os.getenv('NUMERAI_SECRET_KEY', '')
|
| 66 |
+
|
| 67 |
+
SHUTDOWN_ON_COMPLETE = os.getenv('SHUTDOWN_ON_COMPLETE', 'false').lower() == 'true'
|
| 68 |
+
FORCE_RUN_ALL = os.getenv('FORCE_RUN_ALL', 'false').lower() == 'true' # Wait for real rounds
|
| 69 |
+
CHECK_INTERVAL = 60
|
| 70 |
+
|
| 71 |
+
ACTIVE_SCHEDULE = {
|
| 72 |
+
'wait_until': 12, # UTC hour to wait until
|
| 73 |
+
'check_interval': 60, # seconds between checks after wait
|
| 74 |
+
'active_days': [1, 2, 3, 4, 5] # Tue=1, Wed=2, Thu=3, Fri=4, Sat=5 (Mon=0, Sun=6 excluded)
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
def is_within_active_schedule():
|
| 78 |
+
now = datetime.utcnow()
|
| 79 |
+
weekday = now.weekday()
|
| 80 |
+
hour_utc = now.hour
|
| 81 |
+
|
| 82 |
+
if weekday not in ACTIVE_SCHEDULE['active_days']:
|
| 83 |
+
return False
|
| 84 |
+
|
| 85 |
+
if hour_utc < ACTIVE_SCHEDULE['wait_until']:
|
| 86 |
+
return False
|
| 87 |
+
|
| 88 |
+
return True
|
| 89 |
+
|
| 90 |
+
def get_wait_seconds():
|
| 91 |
+
now = datetime.utcnow()
|
| 92 |
+
weekday = now.weekday()
|
| 93 |
+
hour_utc = now.hour
|
| 94 |
+
|
| 95 |
+
if weekday not in ACTIVE_SCHEDULE['active_days']:
|
| 96 |
+
next_active = None
|
| 97 |
+
for i in range(1, 8):
|
| 98 |
+
check_day = (weekday + i) % 7
|
| 99 |
+
if check_day in ACTIVE_SCHEDULE['active_days']:
|
| 100 |
+
next_active = i
|
| 101 |
+
break
|
| 102 |
+
return next_active * 3600 if next_active else 3600
|
| 103 |
+
|
| 104 |
+
if hour_utc < ACTIVE_SCHEDULE['wait_until']:
|
| 105 |
+
target_hour = ACTIVE_SCHEDULE['wait_until']
|
| 106 |
+
seconds_until = (target_hour - hour_utc) * 3600 - now.minute * 60 - now.second
|
| 107 |
+
return max(seconds_until, 60)
|
| 108 |
+
|
| 109 |
+
return ACTIVE_SCHEDULE['check_interval']
|
| 110 |
+
|
| 111 |
+
# ============================================
|
| 112 |
+
# SCRIPT DEFINITIONS (48 Scripts - 16 per tournament)
|
| 113 |
+
# ============================================
|
| 114 |
+
|
| 115 |
+
SCRIPTS = [
|
| 116 |
+
# ==========================================
|
| 117 |
+
# SIGNALS - 16 MODELS (5 existing + 11 new)
|
| 118 |
+
# ==========================================
|
| 119 |
+
|
| 120 |
+
# EXISTING 5 (signals)
|
| 121 |
+
{
|
| 122 |
+
'id': 1,
|
| 123 |
+
'name': 'Signals - Blend Tester',
|
| 124 |
+
'tournament': 'signals',
|
| 125 |
+
'type': 'existing',
|
| 126 |
+
'path_testing': SCRIPTS_DIR / 'signals-csv.py',
|
| 127 |
+
'path_production': '/app/scripts/signals-csv.py',
|
| 128 |
+
'model_id': 'f82be170-5b93-4b9d-92e9-2defec6cdd13',
|
| 129 |
+
'priority': 1
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
'id': 2,
|
| 133 |
+
'name': 'Signals - Historical Validation',
|
| 134 |
+
'tournament': 'signals',
|
| 135 |
+
'type': 'existing',
|
| 136 |
+
'path_testing': SCRIPTS_DIR / 'signals' / 'submit_signals.py',
|
| 137 |
+
'path_production': '/app/scripts/signals/submit_signals.py',
|
| 138 |
+
'model_id': '36c3c35a-8313-4b48-a447-6c5b056ddf81',
|
| 139 |
+
'priority': 2
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
'id': 3,
|
| 143 |
+
'name': 'Signals - 3T Blend',
|
| 144 |
+
'tournament': 'signals',
|
| 145 |
+
'type': 'existing',
|
| 146 |
+
'path_testing': SCRIPTS_DIR / '3tournaments_signals' / 'signals-csv.py',
|
| 147 |
+
'path_production': '/app/scripts/3tournaments_signals/signals-csv.py',
|
| 148 |
+
'model_id': 'ca23b82d-e36c-45ee-9acb-6446db424408',
|
| 149 |
+
'priority': 3
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
'id': 4,
|
| 153 |
+
'name': 'Signals - High Variance',
|
| 154 |
+
'tournament': 'signals',
|
| 155 |
+
'type': 'existing',
|
| 156 |
+
'path_testing': SCRIPTS_DIR / 'signals_v2' / 'signals-csv.py',
|
| 157 |
+
'path_production': '/app/scripts/signals_v2/signals-csv.py',
|
| 158 |
+
'model_id': 'e09317f5-92ab-4bec-83a9-f717d6e7f891',
|
| 159 |
+
'priority': 4
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
'id': 5,
|
| 163 |
+
'name': 'Signals - Ultimate Combo',
|
| 164 |
+
'tournament': 'signals',
|
| 165 |
+
'type': 'existing',
|
| 166 |
+
'path_testing': SCRIPTS_DIR / 'signals_ultimate' / 'signals-csv.py',
|
| 167 |
+
'path_production': '/app/scripts/signals_ultimate/signals-csv.py',
|
| 168 |
+
'model_id': 'c832a144-0005-4e3a-9c6d-2c7aa6b95206',
|
| 169 |
+
'priority': 5
|
| 170 |
+
},
|
| 171 |
+
|
| 172 |
+
# NEW v3 MODELS (signals) - 7 models
|
| 173 |
+
{
|
| 174 |
+
'id': 6,
|
| 175 |
+
'name': 'Signals v3_01',
|
| 176 |
+
'tournament': 'signals',
|
| 177 |
+
'type': 'v3',
|
| 178 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_01.py',
|
| 179 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_01.py',
|
| 180 |
+
'model_id': '0002cc93-8f6c-4ae6-87b0-44e4590264e8',
|
| 181 |
+
'priority': 6
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
'id': 7,
|
| 185 |
+
'name': 'Signals v3_02',
|
| 186 |
+
'tournament': 'signals',
|
| 187 |
+
'type': 'v3',
|
| 188 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_02.py',
|
| 189 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_02.py',
|
| 190 |
+
'model_id': '7ff8f4e6-d10b-40ef-99ea-647cd94cf6fb',
|
| 191 |
+
'priority': 7
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
'id': 8,
|
| 195 |
+
'name': 'Signals v3_03',
|
| 196 |
+
'tournament': 'signals',
|
| 197 |
+
'type': 'v3',
|
| 198 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_03.py',
|
| 199 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_03.py',
|
| 200 |
+
'model_id': '59b5bd40-cf3e-4130-9ca4-a2e78768da6a',
|
| 201 |
+
'priority': 8
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
'id': 9,
|
| 205 |
+
'name': 'Signals v3_04',
|
| 206 |
+
'tournament': 'signals',
|
| 207 |
+
'type': 'v3',
|
| 208 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_04.py',
|
| 209 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_04.py',
|
| 210 |
+
'model_id': '5c95603f-80d9-47bc-83b3-d88be6c73839',
|
| 211 |
+
'priority': 9
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
'id': 10,
|
| 215 |
+
'name': 'Signals v3_05',
|
| 216 |
+
'tournament': 'signals',
|
| 217 |
+
'type': 'v3',
|
| 218 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_05.py',
|
| 219 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_05.py',
|
| 220 |
+
'model_id': 'ef1cb912-e8ab-4a8a-afc7-7ef7f8f983ff',
|
| 221 |
+
'priority': 10
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
'id': 11,
|
| 225 |
+
'name': 'Signals v3_06',
|
| 226 |
+
'tournament': 'signals',
|
| 227 |
+
'type': 'v3',
|
| 228 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_06.py',
|
| 229 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_06.py',
|
| 230 |
+
'model_id': 'd3be8cbe-355a-4f50-a11f-3a7dc88147f0',
|
| 231 |
+
'priority': 11
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
'id': 12,
|
| 235 |
+
'name': 'Signals v3_07',
|
| 236 |
+
'tournament': 'signals',
|
| 237 |
+
'type': 'v3',
|
| 238 |
+
'path_testing': SCRIPTS_DIR / 'signals_v3' / 'submit_v3_07.py',
|
| 239 |
+
'path_production': '/app/scripts/signals_v3/submit_v3_07.py',
|
| 240 |
+
'model_id': '0137e29e-3a7c-4d60-b42b-1b84e99d4d59',
|
| 241 |
+
'priority': 12
|
| 242 |
+
},
|
| 243 |
+
|
| 244 |
+
# NEW NLP MODELS (signals) - 4 models
|
| 245 |
+
{
|
| 246 |
+
'id': 13,
|
| 247 |
+
'name': 'Signals NLP_01',
|
| 248 |
+
'tournament': 'signals',
|
| 249 |
+
'type': 'nlp',
|
| 250 |
+
'path_testing': SCRIPTS_DIR / 'signals_nlp' / 'submit_nlp_01.py',
|
| 251 |
+
'path_production': '/app/scripts/signals_nlp/submit_nlp_01.py',
|
| 252 |
+
'model_id': '15fd592b-9c67-4517-a7ca-9dd95610f826',
|
| 253 |
+
'priority': 13
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
'id': 14,
|
| 257 |
+
'name': 'Signals NLP_02',
|
| 258 |
+
'tournament': 'signals',
|
| 259 |
+
'type': 'nlp',
|
| 260 |
+
'path_testing': SCRIPTS_DIR / 'signals_nlp' / 'submit_nlp_02.py',
|
| 261 |
+
'path_production': '/app/scripts/signals_nlp/submit_nlp_02.py',
|
| 262 |
+
'model_id': '5343b52a-742a-44ee-bb3a-23f8d5205d98',
|
| 263 |
+
'priority': 14
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
'id': 15,
|
| 267 |
+
'name': 'Signals NLP_03',
|
| 268 |
+
'tournament': 'signals',
|
| 269 |
+
'type': 'nlp',
|
| 270 |
+
'path_testing': SCRIPTS_DIR / 'signals_nlp' / 'submit_nlp_03.py',
|
| 271 |
+
'path_production': '/app/scripts/signals_nlp/submit_nlp_03.py',
|
| 272 |
+
'model_id': 'c828cd1a-39e8-47bd-8584-bccd8bd65a91',
|
| 273 |
+
'priority': 15
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
'id': 16,
|
| 277 |
+
'name': 'Signals NLP_04',
|
| 278 |
+
'tournament': 'signals',
|
| 279 |
+
'type': 'nlp',
|
| 280 |
+
'path_testing': SCRIPTS_DIR / 'signals_nlp' / 'submit_nlp_04.py',
|
| 281 |
+
'path_production': '/app/scripts/signals_nlp/submit_nlp_04.py',
|
| 282 |
+
'model_id': 'd00aa5c9-2860-42ad-90ec-36f6a4f58b7d',
|
| 283 |
+
'priority': 16
|
| 284 |
+
},
|
| 285 |
+
|
| 286 |
+
# ==========================================
|
| 287 |
+
# MAIN - 16 MODELS (5 existing + 11 new)
|
| 288 |
+
# ==========================================
|
| 289 |
+
|
| 290 |
+
# EXISTING 5 (main)
|
| 291 |
+
{
|
| 292 |
+
'id': 17,
|
| 293 |
+
'name': 'Main - Full Blend',
|
| 294 |
+
'tournament': 'main',
|
| 295 |
+
'type': 'existing',
|
| 296 |
+
'path_testing': SCRIPTS_DIR / 'main' / 'main-csv.py',
|
| 297 |
+
'path_production': '/app/scripts/main/main-csv.py',
|
| 298 |
+
'model_id': '633f467a-6756-4816-a22b-ee66a1017cf8',
|
| 299 |
+
'priority': 1
|
| 300 |
+
},
|
| 301 |
+
{
|
| 302 |
+
'id': 18,
|
| 303 |
+
'name': 'Main - Lightweight',
|
| 304 |
+
'tournament': 'main',
|
| 305 |
+
'type': 'existing',
|
| 306 |
+
'path_testing': SCRIPTS_DIR / 'main' / 'submit_main.py',
|
| 307 |
+
'path_production': '/app/scripts/main/submit_main.py',
|
| 308 |
+
'model_id': '5476ea55-7320-47ed-876f-4f63373f73d4',
|
| 309 |
+
'priority': 2
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
'id': 19,
|
| 313 |
+
'name': 'Main - 3T Full',
|
| 314 |
+
'tournament': 'main',
|
| 315 |
+
'type': 'existing',
|
| 316 |
+
'path_testing': SCRIPTS_DIR / '3tournaments_main' / 'main-csv.py',
|
| 317 |
+
'path_production': '/app/scripts/3tournaments_main/main-csv.py',
|
| 318 |
+
'model_id': '278bf264-c658-4ea8-a2de-6672aecc285a',
|
| 319 |
+
'priority': 3
|
| 320 |
+
},
|
| 321 |
+
{
|
| 322 |
+
'id': 20,
|
| 323 |
+
'name': 'Main - High Variance',
|
| 324 |
+
'tournament': 'main',
|
| 325 |
+
'type': 'existing',
|
| 326 |
+
'path_testing': SCRIPTS_DIR / 'main_v2' / 'main-csv.py',
|
| 327 |
+
'path_production': '/app/scripts/main_v2/main-csv.py',
|
| 328 |
+
'model_id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f',
|
| 329 |
+
'priority': 4
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
'id': 21,
|
| 333 |
+
'name': 'Main - Ultimate Combo',
|
| 334 |
+
'tournament': 'main',
|
| 335 |
+
'type': 'existing',
|
| 336 |
+
'path_testing': SCRIPTS_DIR / 'main_ultimate' / 'main-csv.py',
|
| 337 |
+
'path_production': '/app/scripts/main_ultimate/main-csv.py',
|
| 338 |
+
'model_id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0',
|
| 339 |
+
'priority': 5
|
| 340 |
+
},
|
| 341 |
+
|
| 342 |
+
# NEW v3 MODELS (main) - 7 models
|
| 343 |
+
{
|
| 344 |
+
'id': 22,
|
| 345 |
+
'name': 'Main v3_01',
|
| 346 |
+
'tournament': 'main',
|
| 347 |
+
'type': 'v3',
|
| 348 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_01.py',
|
| 349 |
+
'path_production': '/app/scripts/main_v3/submit_v3_01.py',
|
| 350 |
+
'model_id': '5cf38bb2-dbe3-4607-b9b4-9507a62d2758',
|
| 351 |
+
'priority': 6
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
'id': 23,
|
| 355 |
+
'name': 'Main v3_02',
|
| 356 |
+
'tournament': 'main',
|
| 357 |
+
'type': 'v3',
|
| 358 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_02.py',
|
| 359 |
+
'path_production': '/app/scripts/main_v3/submit_v3_02.py',
|
| 360 |
+
'model_id': 'b30f3d69-90c0-4969-8167-2d60b4adda5b',
|
| 361 |
+
'priority': 7
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
'id': 24,
|
| 365 |
+
'name': 'Main v3_03',
|
| 366 |
+
'tournament': 'main',
|
| 367 |
+
'type': 'v3',
|
| 368 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_03.py',
|
| 369 |
+
'path_production': '/app/scripts/main_v3/submit_v3_03.py',
|
| 370 |
+
'model_id': '6f5b36ec-cdad-43a9-94e3-42b8481816fb',
|
| 371 |
+
'priority': 8
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
'id': 25,
|
| 375 |
+
'name': 'Main v3_04',
|
| 376 |
+
'tournament': 'main',
|
| 377 |
+
'type': 'v3',
|
| 378 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_04.py',
|
| 379 |
+
'path_production': '/app/scripts/main_v3/submit_v3_04.py',
|
| 380 |
+
'model_id': '89bfd21c-3f43-46fc-a678-5be3e2c79787',
|
| 381 |
+
'priority': 9
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
'id': 26,
|
| 385 |
+
'name': 'Main v3_05',
|
| 386 |
+
'tournament': 'main',
|
| 387 |
+
'type': 'v3',
|
| 388 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_05.py',
|
| 389 |
+
'path_production': '/app/scripts/main_v3/submit_v3_05.py',
|
| 390 |
+
'model_id': 'b0e3c603-baec-4758-932a-56bcf4a7724a',
|
| 391 |
+
'priority': 10
|
| 392 |
+
},
|
| 393 |
+
{
|
| 394 |
+
'id': 27,
|
| 395 |
+
'name': 'Main v3_06',
|
| 396 |
+
'tournament': 'main',
|
| 397 |
+
'type': 'v3',
|
| 398 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_06.py',
|
| 399 |
+
'path_production': '/app/scripts/main_v3/submit_v3_06.py',
|
| 400 |
+
'model_id': 'b24f48e1-a2f8-4186-a7dc-e13635b76fd5',
|
| 401 |
+
'priority': 11
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
'id': 28,
|
| 405 |
+
'name': 'Main v3_07',
|
| 406 |
+
'tournament': 'main',
|
| 407 |
+
'type': 'v3',
|
| 408 |
+
'path_testing': SCRIPTS_DIR / 'main_v3' / 'submit_v3_07.py',
|
| 409 |
+
'path_production': '/app/scripts/main_v3/submit_v3_07.py',
|
| 410 |
+
'model_id': 'c109ed9e-3cb7-4ff8-846e-b0ad33d5a37d',
|
| 411 |
+
'priority': 12
|
| 412 |
+
},
|
| 413 |
+
|
| 414 |
+
# NEW NLP MODELS (main) - 4 models
|
| 415 |
+
{
|
| 416 |
+
'id': 29,
|
| 417 |
+
'name': 'Main NLP_01',
|
| 418 |
+
'tournament': 'main',
|
| 419 |
+
'type': 'nlp',
|
| 420 |
+
'path_testing': SCRIPTS_DIR / 'main_nlp' / 'submit_nlp_01.py',
|
| 421 |
+
'path_production': '/app/scripts/main_nlp/submit_nlp_01.py',
|
| 422 |
+
'model_id': 'b1aa34a5-1c27-49ce-8ff3-72688e255a8c',
|
| 423 |
+
'priority': 13
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
'id': 30,
|
| 427 |
+
'name': 'Main NLP_02',
|
| 428 |
+
'tournament': 'main',
|
| 429 |
+
'type': 'nlp',
|
| 430 |
+
'path_testing': SCRIPTS_DIR / 'main_nlp' / 'submit_nlp_02.py',
|
| 431 |
+
'path_production': '/app/scripts/main_nlp/submit_nlp_02.py',
|
| 432 |
+
'model_id': '191d0527-bf8e-45d9-816a-80bdda4b468f',
|
| 433 |
+
'priority': 14
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
'id': 31,
|
| 437 |
+
'name': 'Main NLP_03',
|
| 438 |
+
'tournament': 'main',
|
| 439 |
+
'type': 'nlp',
|
| 440 |
+
'path_testing': SCRIPTS_DIR / 'main_nlp' / 'submit_nlp_03.py',
|
| 441 |
+
'path_production': '/app/scripts/main_nlp/submit_nlp_03.py',
|
| 442 |
+
'model_id': '4ec9fa7d-aa04-4c1f-8962-ec9e5ac12d00',
|
| 443 |
+
'priority': 15
|
| 444 |
+
},
|
| 445 |
+
{
|
| 446 |
+
'id': 32,
|
| 447 |
+
'name': 'Main NLP_04',
|
| 448 |
+
'tournament': 'main',
|
| 449 |
+
'type': 'nlp',
|
| 450 |
+
'path_testing': SCRIPTS_DIR / 'main_nlp' / 'submit_nlp_04.py',
|
| 451 |
+
'path_production': '/app/scripts/main_nlp/submit_nlp_04.py',
|
| 452 |
+
'model_id': '1c288f99-3578-47a0-acee-635eac3f0fc1',
|
| 453 |
+
'priority': 16
|
| 454 |
+
},
|
| 455 |
+
|
| 456 |
+
# ==========================================
|
| 457 |
+
# CRYPTO - 16 MODELS (5 existing + 11 new)
|
| 458 |
+
# ==========================================
|
| 459 |
+
|
| 460 |
+
# EXISTING 5 (crypto)
|
| 461 |
+
{
|
| 462 |
+
'id': 33,
|
| 463 |
+
'name': 'Crypto - Multi-Activation',
|
| 464 |
+
'tournament': 'crypto',
|
| 465 |
+
'type': 'existing',
|
| 466 |
+
'path_testing': SCRIPTS_DIR / 'crypto' / 'crypto-csv.py',
|
| 467 |
+
'path_production': '/app/scripts/crypto/crypto-csv.py',
|
| 468 |
+
'model_id': 'bbbba758-c759-4e81-aa5b-bdb095709a36',
|
| 469 |
+
'priority': 1
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
'id': 34,
|
| 473 |
+
'name': 'Crypto - V2',
|
| 474 |
+
'tournament': 'crypto',
|
| 475 |
+
'type': 'existing',
|
| 476 |
+
'path_testing': SCRIPTS_DIR / 'crypto' / 'submit_crypto_v2.py',
|
| 477 |
+
'path_production': '/app/scripts/crypto/submit_crypto_v2.py',
|
| 478 |
+
'model_id': 'f72a5c79-d1c0-4576-b9d0-fee4f9a4918f',
|
| 479 |
+
'priority': 2
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
'id': 35,
|
| 483 |
+
'name': 'Crypto - 3T Multi',
|
| 484 |
+
'tournament': 'crypto',
|
| 485 |
+
'type': 'existing',
|
| 486 |
+
'path_testing': SCRIPTS_DIR / '3tournaments_crypto' / 'crypto-csv.py',
|
| 487 |
+
'path_production': '/app/scripts/3tournaments_crypto/crypto-csv.py',
|
| 488 |
+
'model_id': '421d6dfd-0990-4ca1-9aa8-7cfe66178934',
|
| 489 |
+
'priority': 3
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
'id': 36,
|
| 493 |
+
'name': 'Crypto - 3T Multi V2',
|
| 494 |
+
'tournament': 'crypto',
|
| 495 |
+
'type': 'existing',
|
| 496 |
+
'path_testing': SCRIPTS_DIR / '3tournaments_crypto_v2' / 'crypto-csv.py',
|
| 497 |
+
'path_production': '/app/scripts/3tournaments_crypto_v2/crypto-csv.py',
|
| 498 |
+
'model_id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f',
|
| 499 |
+
'priority': 4
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
'id': 37,
|
| 503 |
+
'name': 'Crypto - Ultimate Combo',
|
| 504 |
+
'tournament': 'crypto',
|
| 505 |
+
'type': 'existing',
|
| 506 |
+
'path_testing': SCRIPTS_DIR / 'crypto_ultimate' / 'crypto-csv.py',
|
| 507 |
+
'path_production': '/app/scripts/crypto_ultimate/crypto-csv.py',
|
| 508 |
+
'model_id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0',
|
| 509 |
+
'priority': 5
|
| 510 |
+
},
|
| 511 |
+
|
| 512 |
+
# NEW v3 MODELS (crypto) - 7 models
|
| 513 |
+
{
|
| 514 |
+
'id': 38,
|
| 515 |
+
'name': 'Crypto v3_01',
|
| 516 |
+
'tournament': 'crypto',
|
| 517 |
+
'type': 'v3',
|
| 518 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_01.py',
|
| 519 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_01.py',
|
| 520 |
+
'model_id': 'b2170b85-10a7-481e-967a-b4b3c1139e36',
|
| 521 |
+
'priority': 6
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
'id': 39,
|
| 525 |
+
'name': 'Crypto v3_02',
|
| 526 |
+
'tournament': 'crypto',
|
| 527 |
+
'type': 'v3',
|
| 528 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_02.py',
|
| 529 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_02.py',
|
| 530 |
+
'model_id': 'a5be0f58-8efe-4e9d-8cbd-93fae1c246c7',
|
| 531 |
+
'priority': 7
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
'id': 40,
|
| 535 |
+
'name': 'Crypto v3_03',
|
| 536 |
+
'tournament': 'crypto',
|
| 537 |
+
'type': 'v3',
|
| 538 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_03.py',
|
| 539 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_03.py',
|
| 540 |
+
'model_id': '4a55388a-e1e1-493e-8e09-bc4ecb4aa351',
|
| 541 |
+
'priority': 8
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
'id': 41,
|
| 545 |
+
'name': 'Crypto v3_04',
|
| 546 |
+
'tournament': 'crypto',
|
| 547 |
+
'type': 'v3',
|
| 548 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_04.py',
|
| 549 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_04.py',
|
| 550 |
+
'model_id': '1b21cc76-7f1c-44e6-9a1b-95cc5b0d2245',
|
| 551 |
+
'priority': 9
|
| 552 |
+
},
|
| 553 |
+
{
|
| 554 |
+
'id': 42,
|
| 555 |
+
'name': 'Crypto v3_05',
|
| 556 |
+
'tournament': 'crypto',
|
| 557 |
+
'type': 'v3',
|
| 558 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_05.py',
|
| 559 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_05.py',
|
| 560 |
+
'model_id': '40233110-4901-4469-8d3d-ba5d7d4a0369',
|
| 561 |
+
'priority': 10
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
'id': 43,
|
| 565 |
+
'name': 'Crypto v3_06',
|
| 566 |
+
'tournament': 'crypto',
|
| 567 |
+
'type': 'v3',
|
| 568 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_06.py',
|
| 569 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_06.py',
|
| 570 |
+
'model_id': '7ba989e5-fb6c-40e1-b08e-4506e8ff2593',
|
| 571 |
+
'priority': 11
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
'id': 44,
|
| 575 |
+
'name': 'Crypto v3_07',
|
| 576 |
+
'tournament': 'crypto',
|
| 577 |
+
'type': 'v3',
|
| 578 |
+
'path_testing': SCRIPTS_DIR / 'crypto_v3' / 'submit_v3_07.py',
|
| 579 |
+
'path_production': '/app/scripts/crypto_v3/submit_v3_07.py',
|
| 580 |
+
'model_id': '61a23f9f-cc55-4067-bd32-b85b258b6ab7',
|
| 581 |
+
'priority': 12
|
| 582 |
+
},
|
| 583 |
+
|
| 584 |
+
# NEW NLP MODELS (crypto) - 4 models
|
| 585 |
+
{
|
| 586 |
+
'id': 45,
|
| 587 |
+
'name': 'Crypto NLP_01',
|
| 588 |
+
'tournament': 'crypto',
|
| 589 |
+
'type': 'nlp',
|
| 590 |
+
'path_testing': SCRIPTS_DIR / 'crypto_nlp' / 'submit_nlp_01.py',
|
| 591 |
+
'path_production': '/app/scripts/crypto_nlp/submit_nlp_01.py',
|
| 592 |
+
'model_id': '44eaf326-62cc-4050-b599-35609ac5b57a',
|
| 593 |
+
'priority': 13
|
| 594 |
+
},
|
| 595 |
+
{
|
| 596 |
+
'id': 46,
|
| 597 |
+
'name': 'Crypto NLP_02',
|
| 598 |
+
'tournament': 'crypto',
|
| 599 |
+
'type': 'nlp',
|
| 600 |
+
'path_testing': SCRIPTS_DIR / 'crypto_nlp' / 'submit_nlp_02.py',
|
| 601 |
+
'path_production': '/app/scripts/crypto_nlp/submit_nlp_02.py',
|
| 602 |
+
'model_id': 'bfc51fd1-9401-4010-a266-824e980e3722',
|
| 603 |
+
'priority': 14
|
| 604 |
+
},
|
| 605 |
+
{
|
| 606 |
+
'id': 47,
|
| 607 |
+
'name': 'Crypto NLP_03',
|
| 608 |
+
'tournament': 'crypto',
|
| 609 |
+
'type': 'nlp',
|
| 610 |
+
'path_testing': SCRIPTS_DIR / 'crypto_nlp' / 'submit_nlp_03.py',
|
| 611 |
+
'path_production': '/app/scripts/crypto_nlp/submit_nlp_03.py',
|
| 612 |
+
'model_id': 'f3a4b22d-a121-48c2-8a6b-25adb6eb3b60',
|
| 613 |
+
'priority': 15
|
| 614 |
+
},
|
| 615 |
+
{
|
| 616 |
+
'id': 48,
|
| 617 |
+
'name': 'Crypto NLP_04',
|
| 618 |
+
'tournament': 'crypto',
|
| 619 |
+
'type': 'nlp',
|
| 620 |
+
'path_testing': SCRIPTS_DIR / 'crypto_nlp' / 'submit_nlp_04.py',
|
| 621 |
+
'path_production': '/app/scripts/crypto_nlp/submit_nlp_04.py',
|
| 622 |
+
'model_id': 'b0e8cd05-7c4b-440c-bc74-51f239466c54',
|
| 623 |
+
'priority': 16
|
| 624 |
+
},
|
| 625 |
+
]
|
| 626 |
+
|
| 627 |
+
TOURNAMENTS = ['main', 'signals', 'crypto']
|
| 628 |
+
|
| 629 |
+
# ============================================
|
| 630 |
+
# LOGGING SETUP
|
| 631 |
+
# ============================================
|
| 632 |
+
|
| 633 |
+
log_file = LOG_DIR / f"orchestrator_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log"
|
| 634 |
+
logging.basicConfig(
|
| 635 |
+
level=logging.INFO,
|
| 636 |
+
format='%(asctime)s [%(levelname)s] %(message)s',
|
| 637 |
+
handlers=[
|
| 638 |
+
logging.FileHandler(log_file),
|
| 639 |
+
logging.StreamHandler(sys.stdout)
|
| 640 |
+
]
|
| 641 |
+
)
|
| 642 |
+
|
| 643 |
+
logger = logging.getLogger(__name__)
|
| 644 |
+
|
| 645 |
+
# ============================================
|
| 646 |
+
# TRACKING FILE
|
| 647 |
+
# ============================================
|
| 648 |
+
|
| 649 |
+
STATUS_FILE = BASE_DIR / "tournament_status.json"
|
| 650 |
+
|
| 651 |
+
def load_status():
|
| 652 |
+
"""Load tournament status from file"""
|
| 653 |
+
try:
|
| 654 |
+
if STATUS_FILE.exists():
|
| 655 |
+
with open(STATUS_FILE, 'r') as f:
|
| 656 |
+
return json.load(f)
|
| 657 |
+
except Exception as e:
|
| 658 |
+
logger.warning(f"Could not load status file: {e}")
|
| 659 |
+
return {t: {'round': None, 'completed': False, 'submitted_at': None, 'scripts': []} for t in TOURNAMENTS}
|
| 660 |
+
|
| 661 |
+
def save_status(status):
|
| 662 |
+
"""Save tournament status to file"""
|
| 663 |
+
try:
|
| 664 |
+
with open(STATUS_FILE, 'w') as f:
|
| 665 |
+
json.dump(status, f, indent=2)
|
| 666 |
+
except Exception as e:
|
| 667 |
+
logger.error(f"Could not save status file: {e}")
|
| 668 |
+
|
| 669 |
+
# ============================================
|
| 670 |
+
# ROUND DETECTION
|
| 671 |
+
# ============================================
|
| 672 |
+
|
| 673 |
+
def get_current_round(tournament):
|
| 674 |
+
"""Get current round number for specified tournament"""
|
| 675 |
+
try:
|
| 676 |
+
logger.info(f" Checking {tournament.upper()} round...")
|
| 677 |
+
if tournament == 'signals':
|
| 678 |
+
from numerapi import SignalsAPI
|
| 679 |
+
api = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 680 |
+
round_num = api.get_current_round()
|
| 681 |
+
logger.info(f" {tournament.upper()}: Round {round_num}")
|
| 682 |
+
return round_num
|
| 683 |
+
elif tournament == 'main':
|
| 684 |
+
from numerapi import NumerAPI
|
| 685 |
+
api = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 686 |
+
round_num = api.get_current_round()
|
| 687 |
+
logger.info(f" {tournament.upper()}: Round {round_num}")
|
| 688 |
+
return round_num
|
| 689 |
+
else: # crypto
|
| 690 |
+
from numerapi import CryptoAPI
|
| 691 |
+
api = CryptoAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 692 |
+
round_num = api.get_current_round()
|
| 693 |
+
logger.info(f" {tournament.upper()}: Round {round_num}")
|
| 694 |
+
return round_num
|
| 695 |
+
except Exception as e:
|
| 696 |
+
logger.error(f"Failed to get current round for {tournament}: {e}")
|
| 697 |
+
return None
|
| 698 |
+
|
| 699 |
+
def check_all_tournaments_parallel():
|
| 700 |
+
"""Check all 3 tournaments in parallel. Returns dict {tournament: round_number}."""
|
| 701 |
+
results = {}
|
| 702 |
+
threads = []
|
| 703 |
+
|
| 704 |
+
def check_tournament(name):
|
| 705 |
+
round_num = get_current_round(name)
|
| 706 |
+
results[name] = round_num
|
| 707 |
+
|
| 708 |
+
for tournament in TOURNAMENTS:
|
| 709 |
+
t = threading.Thread(target=check_tournament, args=(tournament,))
|
| 710 |
+
t.start()
|
| 711 |
+
threads.append(t)
|
| 712 |
+
|
| 713 |
+
for t in threads:
|
| 714 |
+
t.join()
|
| 715 |
+
|
| 716 |
+
return results
|
| 717 |
+
|
| 718 |
+
def check_tournament_round_open(tournament):
|
| 719 |
+
"""Check if a tournament's round is actually open and accepting submissions"""
|
| 720 |
+
try:
|
| 721 |
+
if tournament == 'signals':
|
| 722 |
+
from numerapi import SignalsAPI
|
| 723 |
+
api = SignalsAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 724 |
+
round_info = api.get_current_round()
|
| 725 |
+
elif tournament == 'main':
|
| 726 |
+
from numerapi import NumerAPI
|
| 727 |
+
api = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 728 |
+
round_info = api.get_current_round()
|
| 729 |
+
else: # crypto
|
| 730 |
+
from numerapi import CryptoAPI
|
| 731 |
+
api = CryptoAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 732 |
+
round_info = api.get_current_round()
|
| 733 |
+
return round_info
|
| 734 |
+
except Exception as e:
|
| 735 |
+
logger.error(f"Failed to check round status for {tournament}: {e}")
|
| 736 |
+
return None
|
| 737 |
+
|
| 738 |
+
def verify_unique_model_configs():
|
| 739 |
+
"""Verify all 48 models have unique strategies, blending, and .pt file assignments"""
|
| 740 |
+
logger.info("\n" + "=" * 80)
|
| 741 |
+
logger.info("VERIFYING UNIQUE MODEL CONFIGURATIONS")
|
| 742 |
+
logger.info("=" * 80)
|
| 743 |
+
|
| 744 |
+
pt_files_used = {}
|
| 745 |
+
blending_strategies = {}
|
| 746 |
+
|
| 747 |
+
for script in SCRIPTS:
|
| 748 |
+
script_path = script['path_testing'] if TESTING_MODE else script['path_production']
|
| 749 |
+
script_name = script['name']
|
| 750 |
+
|
| 751 |
+
# Read the script to extract its configuration
|
| 752 |
+
try:
|
| 753 |
+
if Path(script_path).exists():
|
| 754 |
+
with open(script_path, 'r', encoding='utf-8', errors='ignore') as f:
|
| 755 |
+
content = f.read()
|
| 756 |
+
|
| 757 |
+
# Look for .pt file references
|
| 758 |
+
import re
|
| 759 |
+
pt_matches = re.findall(r'torch\.load\(["\']?([^"\']+\.pt)["\']?', content)
|
| 760 |
+
if pt_matches:
|
| 761 |
+
pt_file = pt_matches[0].split('/')[-1].split('\\')[-1] # Get filename only
|
| 762 |
+
if pt_file not in pt_files_used:
|
| 763 |
+
pt_files_used[pt_file] = []
|
| 764 |
+
pt_files_used[pt_file].append(script_name)
|
| 765 |
+
|
| 766 |
+
# Look for blending strategy (example patterns)
|
| 767 |
+
if '2-way' in content or '3-way' in content or 'NESTED' in content:
|
| 768 |
+
blend_type = 'multi_blend'
|
| 769 |
+
elif 'blend' in content.lower():
|
| 770 |
+
blend_type = 'simple_blend'
|
| 771 |
+
else:
|
| 772 |
+
blend_type = 'single_model'
|
| 773 |
+
|
| 774 |
+
if blend_type not in blending_strategies:
|
| 775 |
+
blending_strategies[blend_type] = []
|
| 776 |
+
blending_strategies[blend_type].append(script_name)
|
| 777 |
+
|
| 778 |
+
except Exception as e:
|
| 779 |
+
logger.warning(f" Could not analyze {script_name}: {e}")
|
| 780 |
+
|
| 781 |
+
# Report findings
|
| 782 |
+
logger.info(f"\n.PT FILES USAGE ({len(pt_files_used)} unique files):")
|
| 783 |
+
for pt_file, scripts in pt_files_used.items():
|
| 784 |
+
if len(scripts) > 1:
|
| 785 |
+
logger.warning(f" {pt_file} used by {len(scripts)} scripts: {', '.join(scripts[:3])}...")
|
| 786 |
+
else:
|
| 787 |
+
logger.info(f" ✓ {pt_file} - unique to {scripts[0]}")
|
| 788 |
+
|
| 789 |
+
logger.info(f"\nBLENDING STRATEGIES:")
|
| 790 |
+
for blend_type, scripts in blending_strategies.items():
|
| 791 |
+
logger.info(f" {blend_type}: {len(scripts)} models")
|
| 792 |
+
|
| 793 |
+
logger.info("\n" + "=" * 80)
|
| 794 |
+
|
| 795 |
+
return {
|
| 796 |
+
'pt_files': pt_files_used,
|
| 797 |
+
'blending': blending_strategies
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
# ============================================
|
| 801 |
+
#SCRIPT EXECUTION
|
| 802 |
+
# ============================================
|
| 803 |
+
|
| 804 |
+
def get_scripts_for_tournament(tournament):
|
| 805 |
+
"""Get all scripts for a specific tournament, sorted by priority"""
|
| 806 |
+
tournament_scripts = [s for s in SCRIPTS if s['tournament'] == tournament]
|
| 807 |
+
return sorted(tournament_scripts, key=lambda x: x['priority'])
|
| 808 |
+
|
| 809 |
+
def run_script(script_config, completed_count, total_count):
|
| 810 |
+
"""Execute a single script and return result dict"""
|
| 811 |
+
script_path = script_config['path_testing'] if TESTING_MODE else script_config['path_production']
|
| 812 |
+
|
| 813 |
+
logger.info("=" * 80)
|
| 814 |
+
logger.info(f"[{completed_count + 1}/{total_count}] {script_config['name']}")
|
| 815 |
+
logger.info(f" Tournament: {script_config['tournament'].upper()}")
|
| 816 |
+
logger.info(f" Model ID: {script_config['model_id']}")
|
| 817 |
+
logger.info(f" Path: {script_path}")
|
| 818 |
+
logger.info(f" Exists: {Path(script_path).exists()}")
|
| 819 |
+
logger.info(f" CWD: {os.getcwd()}")
|
| 820 |
+
logger.info("=" * 80)
|
| 821 |
+
|
| 822 |
+
start_time = time.time()
|
| 823 |
+
|
| 824 |
+
try:
|
| 825 |
+
if not Path(script_path).exists():
|
| 826 |
+
logger.error(f"Script not found: {script_path}")
|
| 827 |
+
return {'success': False, 'error': 'Script not found', 'elapsed': 0}
|
| 828 |
+
|
| 829 |
+
# Pass environment to subprocess - pass TESTING_MODE to scripts
|
| 830 |
+
env = os.environ.copy()
|
| 831 |
+
env['TESTING_MODE'] = 'true' if TESTING_MODE else 'false'
|
| 832 |
+
env['SKIP_API_CALLS'] = 'false' # Enable API for real uploads
|
| 833 |
+
|
| 834 |
+
# Run without capturing to show blend testing output live
|
| 835 |
+
# But capture with encoding fix for score extraction
|
| 836 |
+
result = subprocess.run(
|
| 837 |
+
[sys.executable, str(script_path)],
|
| 838 |
+
capture_output=False, # Show output live
|
| 839 |
+
timeout=3600, # 1 hour timeout for real downloads/uploads
|
| 840 |
+
env=env,
|
| 841 |
+
encoding='utf-8',
|
| 842 |
+
errors='replace', # Replace invalid chars instead of crashing
|
| 843 |
+
stdin=subprocess.DEVNULL, # Prevent scripts from waiting for stdin
|
| 844 |
+
)
|
| 845 |
+
|
| 846 |
+
elapsed = time.time() - start_time
|
| 847 |
+
|
| 848 |
+
# No score extraction since we're not capturing output
|
| 849 |
+
local_scores = {}
|
| 850 |
+
|
| 851 |
+
if result.returncode == 0:
|
| 852 |
+
logger.info(f"[OK] Completed in {elapsed:.1f}s")
|
| 853 |
+
return {'success': True, 'elapsed': elapsed, 'local_scores': local_scores}
|
| 854 |
+
else:
|
| 855 |
+
logger.error(f"[ERROR] Failed with return code {result.returncode}")
|
| 856 |
+
if result.stderr:
|
| 857 |
+
logger.error(f" STDERR: {result.stderr[:500]}")
|
| 858 |
+
return {'success': False, 'error': f'Return code {result.returncode}', 'elapsed': elapsed}
|
| 859 |
+
|
| 860 |
+
except subprocess.TimeoutExpired:
|
| 861 |
+
logger.error(f"[ERROR] Timed out after 1 hour")
|
| 862 |
+
return {'success': False, 'error': 'Timeout', 'elapsed': 3600}
|
| 863 |
+
except Exception as e:
|
| 864 |
+
logger.error(f"[ERROR] Exception: {e}")
|
| 865 |
+
return {'success': False, 'error': str(e), 'elapsed': 0}
|
| 866 |
+
|
| 867 |
+
def run_tournament_scripts(tournament, status, scripts_completed_before):
|
| 868 |
+
"""Run all 16 scripts for a tournament sequentially"""
|
| 869 |
+
scripts = get_scripts_for_tournament(tournament)
|
| 870 |
+
results = []
|
| 871 |
+
|
| 872 |
+
logger.info("\n" + "=" * 80)
|
| 873 |
+
logger.info(f"RUNNING {tournament.upper()} TOURNAMENT ({len(scripts)} models)")
|
| 874 |
+
logger.info("=" * 80)
|
| 875 |
+
|
| 876 |
+
for i, script in enumerate(scripts):
|
| 877 |
+
overall_progress = scripts_completed_before + i
|
| 878 |
+
result = run_script(script, overall_progress, len(SCRIPTS))
|
| 879 |
+
|
| 880 |
+
result_dict = {
|
| 881 |
+
'script_id': script['id'],
|
| 882 |
+
'name': script['name'],
|
| 883 |
+
'model_id': script['model_id'],
|
| 884 |
+
'tournament': tournament,
|
| 885 |
+
'success': result['success'],
|
| 886 |
+
'elapsed': result['elapsed'],
|
| 887 |
+
'timestamp': datetime.now().isoformat()
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
# Add local scores if available
|
| 891 |
+
if 'local_scores' in result and result['local_scores']:
|
| 892 |
+
result_dict['local_scores'] = result['local_scores']
|
| 893 |
+
|
| 894 |
+
results.append(result_dict)
|
| 895 |
+
|
| 896 |
+
# No wait needed between scripts
|
| 897 |
+
# if i < len(scripts) - 1:
|
| 898 |
+
# logger.info(f"Waiting 30s before next script...")
|
| 899 |
+
# time.sleep(30)
|
| 900 |
+
|
| 901 |
+
return results, scripts_completed_before + len(scripts)
|
| 902 |
+
|
| 903 |
+
# ============================================
|
| 904 |
+
# FINAL OVERVIEW
|
| 905 |
+
# ============================================
|
| 906 |
+
|
| 907 |
+
def print_final_overview(all_results, status):
|
| 908 |
+
"""Print final summary of all 48 submissions"""
|
| 909 |
+
logger.info("\n" + "=" * 80)
|
| 910 |
+
logger.info("FINAL OVERVIEW - ALL 48 MODELS")
|
| 911 |
+
logger.info("=" * 80)
|
| 912 |
+
|
| 913 |
+
total_success = 0
|
| 914 |
+
total_elapsed = 0
|
| 915 |
+
|
| 916 |
+
for tournament in TOURNAMENTS:
|
| 917 |
+
tournament_results = [r for r in all_results if r['tournament'] == tournament]
|
| 918 |
+
successful = sum(1 for r in tournament_results if r['success'])
|
| 919 |
+
total_success += successful
|
| 920 |
+
|
| 921 |
+
logger.info(f"\n{tournament.upper()} (Round {status[tournament]['round']}):")
|
| 922 |
+
logger.info("-" * 40)
|
| 923 |
+
|
| 924 |
+
for r in tournament_results:
|
| 925 |
+
status_str = "[OK]" if r['success'] else "[FAIL]"
|
| 926 |
+
elapsed_str = f"{r['elapsed']:.1f}s" if r.get('elapsed') else "N/A"
|
| 927 |
+
score_str = ""
|
| 928 |
+
if r.get('local_scores'):
|
| 929 |
+
ls = r['local_scores']
|
| 930 |
+
score_str = f" | Score: {ls.get('score', 'N/A'):.4f}"
|
| 931 |
+
logger.info(f" {status_str} {r['name']} - {elapsed_str}{score_str}")
|
| 932 |
+
total_elapsed += r.get('elapsed', 0)
|
| 933 |
+
|
| 934 |
+
logger.info(f" {successful}/{len(tournament_results)} successful")
|
| 935 |
+
|
| 936 |
+
logger.info("\n" + "=" * 80)
|
| 937 |
+
logger.info(f"SUMMARY: {total_success}/48 models submitted successfully")
|
| 938 |
+
logger.info(f"Total time: {total_elapsed:.1f}s ({total_elapsed/60:.1f} minutes)")
|
| 939 |
+
logger.info("=" * 80)
|
| 940 |
+
|
| 941 |
+
# Save final results
|
| 942 |
+
results_file = LOG_DIR / f"final_results_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
|
| 943 |
+
with open(results_file, 'w') as f:
|
| 944 |
+
json.dump({
|
| 945 |
+
'results': all_results,
|
| 946 |
+
'status': status,
|
| 947 |
+
'summary': {
|
| 948 |
+
'total_success': total_success,
|
| 949 |
+
'total_models': 48,
|
| 950 |
+
'total_elapsed': total_elapsed
|
| 951 |
+
}
|
| 952 |
+
}, f, indent=2)
|
| 953 |
+
logger.info(f"\nResults saved to: {results_file}")
|
| 954 |
+
|
| 955 |
+
# ============================================
|
| 956 |
+
# MAIN ORCHESTRATOR
|
| 957 |
+
# ============================================
|
| 958 |
+
|
| 959 |
+
def reset_status():
|
| 960 |
+
"""Create a fresh status dict"""
|
| 961 |
+
return {t: {'round': None, 'completed': False, 'submitted_at': None, 'scripts': []} for t in TOURNAMENTS}
|
| 962 |
+
|
| 963 |
+
def main():
|
| 964 |
+
logger.info("\n" + "=" * 80)
|
| 965 |
+
logger.info("NUMERAI UNIVERSAL ORCHESTRATOR STARTED")
|
| 966 |
+
logger.info("=" * 80)
|
| 967 |
+
logger.info(f"Mode: {'TESTING (from backup)' if TESTING_MODE else 'PRODUCTION'}")
|
| 968 |
+
logger.info(f"Base directory: {BASE_DIR}")
|
| 969 |
+
logger.info(f"Log file: {log_file}")
|
| 970 |
+
logger.info(f"Tournaments: {', '.join(TOURNAMENTS)}")
|
| 971 |
+
logger.info(f"Total models: {len(SCRIPTS)} (16 per tournament)")
|
| 972 |
+
logger.info(f"Scan interval: {CHECK_INTERVAL}s")
|
| 973 |
+
|
| 974 |
+
# Check credentials
|
| 975 |
+
if NUMERAI_PUBLIC_ID and NUMERAI_SECRET_KEY:
|
| 976 |
+
logger.info(f"Credentials: Loaded (Public ID: {NUMERAI_PUBLIC_ID[:8]}...)")
|
| 977 |
+
else:
|
| 978 |
+
logger.warning("Credentials: NOT LOADED - Check .env file!")
|
| 979 |
+
|
| 980 |
+
logger.info("=" * 80 + "\n")
|
| 981 |
+
|
| 982 |
+
try:
|
| 983 |
+
# Verify unique configurations for all 48 models
|
| 984 |
+
config_verification = verify_unique_model_configs()
|
| 985 |
+
|
| 986 |
+
# Load previous status
|
| 987 |
+
status = load_status()
|
| 988 |
+
logger.info("Loaded previous status:")
|
| 989 |
+
for t in TOURNAMENTS:
|
| 990 |
+
logger.info(f" {t.upper()}: round={status[t]['round']}, completed={status[t]['completed']}")
|
| 991 |
+
|
| 992 |
+
# FIX 2: Check if all tournaments completed and if we need to reset for new cycle
|
| 993 |
+
if all(status.get(t, {}).get('completed', False) for t in TOURNAMENTS):
|
| 994 |
+
logger.info("\nAll tournaments marked as completed in previous run.")
|
| 995 |
+
logger.info("Checking if new round cycle has started...")
|
| 996 |
+
|
| 997 |
+
current_rounds = check_all_tournaments_parallel()
|
| 998 |
+
logger.info(f"Current rounds: {current_rounds}")
|
| 999 |
+
|
| 1000 |
+
# Check if any tournament has a new round (current > saved)
|
| 1001 |
+
new_cycle = False
|
| 1002 |
+
for tournament in TOURNAMENTS:
|
| 1003 |
+
saved_round = status[tournament].get('round')
|
| 1004 |
+
current_round = current_rounds.get(tournament)
|
| 1005 |
+
if current_round and saved_round:
|
| 1006 |
+
if current_round > saved_round:
|
| 1007 |
+
logger.info(f" {tournament.upper()}: New round detected ({saved_round} -> {current_round})")
|
| 1008 |
+
new_cycle = True
|
| 1009 |
+
|
| 1010 |
+
if new_cycle:
|
| 1011 |
+
logger.info("\nNew round cycle detected. Resetting status for fresh start...")
|
| 1012 |
+
status = reset_status()
|
| 1013 |
+
save_status(status)
|
| 1014 |
+
logger.info("Status reset complete. Starting fresh cycle.")
|
| 1015 |
+
else:
|
| 1016 |
+
logger.info("\nNo new rounds detected. All tournaments already submitted for current round.")
|
| 1017 |
+
logger.info("Exiting - nothing to do.")
|
| 1018 |
+
sys.exit(0)
|
| 1019 |
+
|
| 1020 |
+
# Get baseline rounds at launch
|
| 1021 |
+
if FORCE_RUN_ALL:
|
| 1022 |
+
logger.info("\n*** FORCE_RUN_ALL MODE - SKIPPING ROUND DETECTION ***")
|
| 1023 |
+
baseline_rounds = {'main': 9999, 'signals': 9999, 'crypto': 9999}
|
| 1024 |
+
else:
|
| 1025 |
+
logger.info("\nChecking current rounds for all tournaments (parallel)...")
|
| 1026 |
+
baseline_rounds = check_all_tournaments_parallel()
|
| 1027 |
+
logger.info(f"Baseline rounds: {baseline_rounds}")
|
| 1028 |
+
|
| 1029 |
+
# Wait for ALL tournaments to have rounds open before proceeding
|
| 1030 |
+
logger.info("\nWaiting for ALL tournaments to have rounds open and live...")
|
| 1031 |
+
rounds_live = {t: False for t in TOURNAMENTS}
|
| 1032 |
+
|
| 1033 |
+
while not all(rounds_live.values()):
|
| 1034 |
+
for tournament in TOURNAMENTS:
|
| 1035 |
+
if not rounds_live[tournament]:
|
| 1036 |
+
round_num = baseline_rounds.get(tournament)
|
| 1037 |
+
if round_num:
|
| 1038 |
+
logger.info(f" {tournament.upper()}: Round {round_num} detected - confirming it's LIVE...")
|
| 1039 |
+
# In production, you'd check if submissions are actually open
|
| 1040 |
+
# For now, we assume if round exists, it's live
|
| 1041 |
+
rounds_live[tournament] = True
|
| 1042 |
+
logger.info(f" ✓ {tournament.upper()}: Round {round_num} is LIVE")
|
| 1043 |
+
else:
|
| 1044 |
+
logger.info(f" {tournament.upper()}: No round detected yet, waiting...")
|
| 1045 |
+
|
| 1046 |
+
if not all(rounds_live.values()):
|
| 1047 |
+
logger.info(f"\n{sum(rounds_live.values())}/3 tournaments live. Checking again in 60s...")
|
| 1048 |
+
time.sleep(60)
|
| 1049 |
+
baseline_rounds = check_all_tournaments_parallel()
|
| 1050 |
+
|
| 1051 |
+
logger.info("\n" + "=" * 80)
|
| 1052 |
+
logger.info("ALL 3 TOURNAMENTS ARE NOW LIVE - READY TO START")
|
| 1053 |
+
logger.info("=" * 80)
|
| 1054 |
+
|
| 1055 |
+
# Initialize baseline rounds if not set
|
| 1056 |
+
for tournament in TOURNAMENTS:
|
| 1057 |
+
if status[tournament]['round'] is None:
|
| 1058 |
+
status[tournament]['round'] = baseline_rounds.get(tournament)
|
| 1059 |
+
logger.info(f" {tournament.upper()}: Set baseline round to {status[tournament]['round']}")
|
| 1060 |
+
|
| 1061 |
+
save_status(status)
|
| 1062 |
+
|
| 1063 |
+
# Track all results for final overview
|
| 1064 |
+
all_results = []
|
| 1065 |
+
# FIX 6: Track scripts completed count for progress
|
| 1066 |
+
scripts_completed = 0
|
| 1067 |
+
|
| 1068 |
+
# Count completed tournaments
|
| 1069 |
+
completed_count = sum(1 for t in TOURNAMENTS if status[t]['completed'])
|
| 1070 |
+
scan_count = 0
|
| 1071 |
+
|
| 1072 |
+
logger.info(f"\nStarting scan loop. {completed_count}/3 tournaments completed.")
|
| 1073 |
+
logger.info("Will scan every 5 minutes until all 3 tournaments submit for new rounds.\n")
|
| 1074 |
+
|
| 1075 |
+
# Main scan loop
|
| 1076 |
+
while True:
|
| 1077 |
+
scan_count += 1
|
| 1078 |
+
logger.info("=" * 80)
|
| 1079 |
+
logger.info(f"SCAN #{scan_count}")
|
| 1080 |
+
logger.info("=" * 80)
|
| 1081 |
+
|
| 1082 |
+
# Check current rounds (skip if FORCE_RUN_ALL)
|
| 1083 |
+
if FORCE_RUN_ALL:
|
| 1084 |
+
logger.info("FORCE_RUN_ALL enabled - using placeholder rounds")
|
| 1085 |
+
current_rounds = {'main': 9999, 'signals': 9999, 'crypto': 9999}
|
| 1086 |
+
else:
|
| 1087 |
+
current_rounds = check_all_tournaments_parallel()
|
| 1088 |
+
logger.info(f"Current rounds: {current_rounds}")
|
| 1089 |
+
|
| 1090 |
+
# Check each tournament for new round
|
| 1091 |
+
for tournament in TOURNAMENTS:
|
| 1092 |
+
if FORCE_RUN_ALL:
|
| 1093 |
+
logger.info(f" {tournament.upper()}: FORCE_RUN_ALL - running all scripts...")
|
| 1094 |
+
results, scripts_completed = run_tournament_scripts(tournament, status, scripts_completed)
|
| 1095 |
+
all_results.extend(results)
|
| 1096 |
+
status[tournament]['completed'] = True
|
| 1097 |
+
status[tournament]['round'] = current_rounds.get(tournament)
|
| 1098 |
+
status[tournament]['submitted_at'] = datetime.now().isoformat()
|
| 1099 |
+
status[tournament]['scripts'] = [r['script_id'] for r in results]
|
| 1100 |
+
save_status(status)
|
| 1101 |
+
completed_count = sum(1 for t in TOURNAMENTS if status[t]['completed'])
|
| 1102 |
+
logger.info(f"\n{tournament.upper()} completed via FORCE_RUN_ALL. Total: {completed_count}/3 tournaments done.")
|
| 1103 |
+
continue
|
| 1104 |
+
|
| 1105 |
+
if status[tournament]['completed']:
|
| 1106 |
+
logger.info(f" {tournament.upper()}: Already completed (round {status[tournament]['round']})")
|
| 1107 |
+
continue
|
| 1108 |
+
|
| 1109 |
+
baseline_round = status[tournament]['round']
|
| 1110 |
+
current_round = current_rounds.get(tournament)
|
| 1111 |
+
|
| 1112 |
+
if current_round is None:
|
| 1113 |
+
logger.warning(f" {tournament.upper()}: Could not get round, skipping")
|
| 1114 |
+
continue
|
| 1115 |
+
|
| 1116 |
+
if baseline_round is None:
|
| 1117 |
+
status[tournament]['round'] = current_round
|
| 1118 |
+
baseline_round = current_round
|
| 1119 |
+
logger.info(f" {tournament.upper()}: Set baseline to round {baseline_round}")
|
| 1120 |
+
save_status(status)
|
| 1121 |
+
|
| 1122 |
+
if current_round > baseline_round:
|
| 1123 |
+
logger.info(f"\n*** NEW ROUND DETECTED for {tournament.upper()}! ***")
|
| 1124 |
+
logger.info(f" Round {baseline_round} -> {current_round}")
|
| 1125 |
+
logger.info(f" Running 5 scripts for {tournament.upper()}...")
|
| 1126 |
+
|
| 1127 |
+
# Run scripts for this tournament
|
| 1128 |
+
results, scripts_completed = run_tournament_scripts(tournament, status, scripts_completed)
|
| 1129 |
+
all_results.extend(results)
|
| 1130 |
+
|
| 1131 |
+
# Mark as completed
|
| 1132 |
+
status[tournament]['completed'] = True
|
| 1133 |
+
status[tournament]['round'] = current_round
|
| 1134 |
+
status[tournament]['submitted_at'] = datetime.now().isoformat()
|
| 1135 |
+
status[tournament]['scripts'] = [r['script_id'] for r in results]
|
| 1136 |
+
save_status(status)
|
| 1137 |
+
|
| 1138 |
+
# Update completed count
|
| 1139 |
+
completed_count = sum(1 for t in TOURNAMENTS if status[t]['completed'])
|
| 1140 |
+
logger.info(f"\n{tournament.upper()} completed. Total: {completed_count}/3 tournaments done.")
|
| 1141 |
+
else:
|
| 1142 |
+
logger.info(f" {tournament.upper()}: Still round {current_round} (waiting for {baseline_round + 1})")
|
| 1143 |
+
|
| 1144 |
+
# Check if all done
|
| 1145 |
+
if completed_count >= 3:
|
| 1146 |
+
logger.info("\n" + "=" * 80)
|
| 1147 |
+
logger.info("ALL 3 TOURNAMENTS COMPLETED!")
|
| 1148 |
+
logger.info("=" * 80)
|
| 1149 |
+
break
|
| 1150 |
+
|
| 1151 |
+
# Wait before next scan (use schedule-based interval)
|
| 1152 |
+
wait_time = get_wait_seconds()
|
| 1153 |
+
now = datetime.utcnow()
|
| 1154 |
+
weekday = now.weekday()
|
| 1155 |
+
day_names = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
| 1156 |
+
|
| 1157 |
+
if weekday not in ACTIVE_SCHEDULE['active_days']:
|
| 1158 |
+
logger.info(f"\n[{day_names[weekday]}] Inactive day - waiting {wait_time}s until next active day")
|
| 1159 |
+
elif now.hour < ACTIVE_SCHEDULE['wait_until']:
|
| 1160 |
+
logger.info(f"\n[{day_names[weekday]} {now.hour:02d}:00 UTC] Before {ACTIVE_SCHEDULE['wait_until']}:00 UTC - waiting {wait_time}s")
|
| 1161 |
+
else:
|
| 1162 |
+
logger.info(f"\n[{day_names[weekday]} {now.hour:02d}:00 UTC] Active window - checking every {wait_time}s")
|
| 1163 |
+
|
| 1164 |
+
time.sleep(wait_time)
|
| 1165 |
+
|
| 1166 |
+
# Print final overview
|
| 1167 |
+
print_final_overview(all_results, status)
|
| 1168 |
+
|
| 1169 |
+
# Check if all 48 scripts succeeded
|
| 1170 |
+
total_success = sum(1 for r in all_results if r['success'])
|
| 1171 |
+
total_models = len(all_results)
|
| 1172 |
+
|
| 1173 |
+
# Reset status file for next cycle
|
| 1174 |
+
logger.info("\nResetting status for next cycle...")
|
| 1175 |
+
status = reset_status()
|
| 1176 |
+
save_status(status)
|
| 1177 |
+
logger.info("Status file reset complete. Ready for next round cycle.")
|
| 1178 |
+
|
| 1179 |
+
logger.info(f"\nOrchestrator finished successfully. {total_success}/{total_models} scripts succeeded.")
|
| 1180 |
+
|
| 1181 |
+
# Shutdown if all 48 succeeded and SHUTDOWN_ON_COMPLETE is enabled
|
| 1182 |
+
if SHUTDOWN_ON_COMPLETE and total_success >= total_models:
|
| 1183 |
+
logger.info("\n*** ALL 48 SCRIPTS SUCCEEDED - SHUTTING DOWN CONTAINER ***")
|
| 1184 |
+
logger.info("This will stop the container in Docker/HF Spaces")
|
| 1185 |
+
try:
|
| 1186 |
+
import subprocess
|
| 1187 |
+
subprocess.run(['shutdown', '-h', 'now'], check=False)
|
| 1188 |
+
except:
|
| 1189 |
+
pass
|
| 1190 |
+
sys.exit(0)
|
| 1191 |
+
|
| 1192 |
+
sys.exit(0)
|
| 1193 |
+
|
| 1194 |
+
except KeyboardInterrupt:
|
| 1195 |
+
logger.info("\n\n[WARNING] Orchestrator interrupted by user (Ctrl+C)")
|
| 1196 |
+
sys.exit(1)
|
| 1197 |
+
except Exception as e:
|
| 1198 |
+
logger.error(f"\n[ERROR] Orchestrator error: {e}", exc_info=True)
|
| 1199 |
+
sys.exit(1)
|
| 1200 |
+
finally:
|
| 1201 |
+
logger.info("\n" + "=" * 80)
|
| 1202 |
+
logger.info("ORCHESTRATOR SHUTDOWN")
|
| 1203 |
+
logger.info("=" * 80)
|
| 1204 |
+
|
| 1205 |
+
if __name__ == "__main__":
|
| 1206 |
+
main()
|
UPDATE_ALL_DOWNLOADS.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Fix all scripts to check for existing round data before downloading
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 9 |
+
|
| 10 |
+
fixed = 0
|
| 11 |
+
for script in all_scripts:
|
| 12 |
+
try:
|
| 13 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 14 |
+
content = f.read()
|
| 15 |
+
|
| 16 |
+
modified = False
|
| 17 |
+
|
| 18 |
+
# Pattern 1: Remove file deletion before download
|
| 19 |
+
old_delete = """# Check if file exists and is valid
|
| 20 |
+
if live_path.exists():
|
| 21 |
+
print(f" [FOUND] Using existing round {current_round} data: {live_path.name}")
|
| 22 |
+
# No need to download again
|
| 23 |
+
skip_wait.set() # Skip download loop"""
|
| 24 |
+
|
| 25 |
+
new_check = """# Check if we already have this round's data
|
| 26 |
+
if live_path.exists():
|
| 27 |
+
try:
|
| 28 |
+
# Verify it's the right round
|
| 29 |
+
temp_df = pd.read_parquet(live_path)
|
| 30 |
+
if 'era' in temp_df.columns:
|
| 31 |
+
data_round = int(str(temp_df['era'].iloc[0]).replace('era', ''))
|
| 32 |
+
if data_round == current_round:
|
| 33 |
+
print(f" [EXISTS] Round {current_round} data found - using existing file")
|
| 34 |
+
break # Skip download loop
|
| 35 |
+
print(f" [INFO] Existing file is for different round - will re-download")
|
| 36 |
+
except Exception as e:
|
| 37 |
+
print(f" [WARNING] Could not verify existing file: {e}")"""
|
| 38 |
+
|
| 39 |
+
if old_delete in content:
|
| 40 |
+
content = content.replace(old_delete, new_check)
|
| 41 |
+
modified = True
|
| 42 |
+
|
| 43 |
+
# Pattern 2: Also look for simpler patterns that just delete
|
| 44 |
+
if '[CLEAN] Deleting existing file' in content:
|
| 45 |
+
# Remove the deletion code
|
| 46 |
+
lines = content.split('\n')
|
| 47 |
+
new_lines = []
|
| 48 |
+
skip_next = 0
|
| 49 |
+
|
| 50 |
+
for i, line in enumerate(lines):
|
| 51 |
+
if skip_next > 0:
|
| 52 |
+
skip_next -= 1
|
| 53 |
+
continue
|
| 54 |
+
|
| 55 |
+
if '[CLEAN] Deleting existing file' in line:
|
| 56 |
+
# Skip this and the next 1-2 lines (the unlink)
|
| 57 |
+
if i + 1 < len(lines) and 'unlink()' in lines[i + 1]:
|
| 58 |
+
skip_next = 1
|
| 59 |
+
continue
|
| 60 |
+
|
| 61 |
+
new_lines.append(line)
|
| 62 |
+
|
| 63 |
+
if len(new_lines) != len(lines):
|
| 64 |
+
content = '\n'.join(new_lines)
|
| 65 |
+
modified = True
|
| 66 |
+
|
| 67 |
+
if modified:
|
| 68 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 69 |
+
f.write(content)
|
| 70 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 71 |
+
fixed += 1
|
| 72 |
+
|
| 73 |
+
except Exception as e:
|
| 74 |
+
print(f"[ERR] {script.name}: {e}")
|
| 75 |
+
|
| 76 |
+
print(f"\nFixed {fixed} scripts!")
|
| 77 |
+
print("\nNow scripts will:")
|
| 78 |
+
print(" 1. Check if round data file exists")
|
| 79 |
+
print(" 2. Verify it matches current round number")
|
| 80 |
+
print(" 3. Use existing file if valid")
|
| 81 |
+
print(" 4. Only download if file missing or wrong round")
|
UPDATE_ALL_SCRIPT_PATHS.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Update all scripts to use c:\numerai48models as base path in testing mode
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
scripts_dir = Path("c:/numerai48models/scripts")
|
| 8 |
+
all_scripts = list(scripts_dir.rglob("*.py"))
|
| 9 |
+
|
| 10 |
+
fixed = 0
|
| 11 |
+
for script in all_scripts:
|
| 12 |
+
try:
|
| 13 |
+
with open(script, 'r', encoding='utf-8', errors='ignore') as f:
|
| 14 |
+
content = f.read()
|
| 15 |
+
|
| 16 |
+
modified = False
|
| 17 |
+
|
| 18 |
+
# Replace backup detection with simpler Windows check
|
| 19 |
+
if 'BACKUP_DIR = Path("C:/NUMERAI_BACKUP_20260410")' in content:
|
| 20 |
+
old_config = '''# Auto-detect if running from backup folder
|
| 21 |
+
BACKUP_DIR = Path("C:/NUMERAI_BACKUP_20260410")
|
| 22 |
+
if Path.cwd().resolve().is_relative_to(BACKUP_DIR.resolve()) or BACKUP_DIR in Path(__file__).resolve().parents:
|
| 23 |
+
print("[BACKUP MODE] Running from backup - Using backup paths")
|
| 24 |
+
BASE_DIR = BACKUP_DIR'''
|
| 25 |
+
|
| 26 |
+
new_config = '''# Auto-detect testing mode
|
| 27 |
+
TESTING_MODE = os.getenv('TESTING_MODE', 'true').lower() == 'true'
|
| 28 |
+
if TESTING_MODE or os.name == 'nt': # Windows or TESTING_MODE set
|
| 29 |
+
print("[TESTING MODE] Using local paths")
|
| 30 |
+
BASE_DIR = Path("c:/numerai48models")'''
|
| 31 |
+
|
| 32 |
+
if old_config in content:
|
| 33 |
+
content = content.replace(old_config, new_config)
|
| 34 |
+
modified = True
|
| 35 |
+
|
| 36 |
+
# Replace production paths check
|
| 37 |
+
if 'print("[PRODUCTION] Production mode - Using production paths")' in content:
|
| 38 |
+
old_prod = '''else:
|
| 39 |
+
print("[PRODUCTION] Production mode - Using production paths")
|
| 40 |
+
BASE_DIR = Path("/app")'''
|
| 41 |
+
|
| 42 |
+
new_prod = '''else:
|
| 43 |
+
print("[PRODUCTION] Production mode - Using production paths")
|
| 44 |
+
BASE_DIR = Path("/app")'''
|
| 45 |
+
|
| 46 |
+
if old_prod in content:
|
| 47 |
+
content = content.replace(old_prod, new_prod)
|
| 48 |
+
modified = True
|
| 49 |
+
|
| 50 |
+
if modified:
|
| 51 |
+
with open(script, 'w', encoding='utf-8', errors='ignore') as f:
|
| 52 |
+
f.write(content)
|
| 53 |
+
print(f"[OK] {script.relative_to(scripts_dir)}")
|
| 54 |
+
fixed += 1
|
| 55 |
+
|
| 56 |
+
except Exception as e:
|
| 57 |
+
print(f"[ERR] {script.name}: {e}")
|
| 58 |
+
|
| 59 |
+
print(f"\nFixed {fixed} scripts!")
|
USE_EXISTING_DATA.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Quick fix: Update all scripts to use existing round 1252 data instead of downloading
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
# Copy round 1252 data to round 1253 for all tournaments
|
| 8 |
+
data_dir = Path("c:/numerai48models/data")
|
| 9 |
+
|
| 10 |
+
tournaments = {
|
| 11 |
+
'main': 'main_live_round_1252.parquet',
|
| 12 |
+
'signals': 'signals_live_round_1252.parquet',
|
| 13 |
+
'crypto': 'crypto_live_round_1252.parquet'
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
for tournament, filename in tournaments.items():
|
| 17 |
+
src = data_dir / tournament / filename
|
| 18 |
+
dst = data_dir / tournament / filename.replace('1252', '1253')
|
| 19 |
+
|
| 20 |
+
if src.exists():
|
| 21 |
+
print(f"Copying {tournament}: {src.name} -> {dst.name}")
|
| 22 |
+
import shutil
|
| 23 |
+
shutil.copy(src, dst)
|
| 24 |
+
print(f" [OK] Created {dst}")
|
| 25 |
+
else:
|
| 26 |
+
print(f" [SKIP] Source not found: {src}")
|
| 27 |
+
|
| 28 |
+
print("\nDone! Scripts will now use round 1253 data files.")
|
app.py
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, BackgroundTasks
|
| 2 |
+
from fastapi.responses import PlainTextResponse
|
| 3 |
+
import subprocess
|
| 4 |
+
import logging
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
import time
|
| 8 |
+
import threading
|
| 9 |
+
from datetime import datetime
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
|
| 13 |
+
load_dotenv(Path(__file__).parent / '.env')
|
| 14 |
+
|
| 15 |
+
logging.basicConfig(level=logging.INFO)
|
| 16 |
+
logger = logging.getLogger(__name__)
|
| 17 |
+
|
| 18 |
+
app = FastAPI()
|
| 19 |
+
|
| 20 |
+
SCRIPTS_DIR = Path("/app/scripts")
|
| 21 |
+
LOGS_DIR = Path("/app/logs")
|
| 22 |
+
LOGS_DIR.mkdir(exist_ok=True, parents=True)
|
| 23 |
+
|
| 24 |
+
ORCHESTRATOR_PATH = Path("/app/UNIVERSAL_NUMERAI_ORCHESTRATOR.py")
|
| 25 |
+
|
| 26 |
+
orchestrator_running = False
|
| 27 |
+
orchestrator_result = None
|
| 28 |
+
|
| 29 |
+
def run_orchestrator():
|
| 30 |
+
global orchestrator_running, orchestrator_result
|
| 31 |
+
try:
|
| 32 |
+
logger.info(f"[{datetime.utcnow()}] Starting orchestrator...")
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
[sys.executable, str(ORCHESTRATOR_PATH)],
|
| 35 |
+
capture_output=True,
|
| 36 |
+
text=True,
|
| 37 |
+
timeout=7200
|
| 38 |
+
)
|
| 39 |
+
orchestrator_result = {
|
| 40 |
+
"returncode": result.returncode,
|
| 41 |
+
"stdout": result.stdout if result.stdout else "",
|
| 42 |
+
"stderr": result.stderr[-5000:] if result.stderr else ""
|
| 43 |
+
}
|
| 44 |
+
logger.info(f"Orchestrator exit code: {result.returncode}")
|
| 45 |
+
if result.stdout:
|
| 46 |
+
logger.info(f"Output: {result.stdout[:2000]}")
|
| 47 |
+
if result.stderr:
|
| 48 |
+
logger.error(f"Errors: {result.stderr[:2000]}")
|
| 49 |
+
except subprocess.TimeoutExpired:
|
| 50 |
+
orchestrator_result = {"returncode": -1, "stdout": "", "stderr": "Timed out after 2 hours"}
|
| 51 |
+
logger.error("Orchestrator timed out after 2 hours")
|
| 52 |
+
except Exception as e:
|
| 53 |
+
orchestrator_result = {"returncode": -1, "stdout": "", "stderr": str(e)}
|
| 54 |
+
logger.error(f"Orchestrator error: {e}")
|
| 55 |
+
finally:
|
| 56 |
+
orchestrator_running = False
|
| 57 |
+
|
| 58 |
+
@app.get("/")
|
| 59 |
+
def root():
|
| 60 |
+
return {
|
| 61 |
+
"status": "running",
|
| 62 |
+
"orchestrator_running": orchestrator_running,
|
| 63 |
+
"time": datetime.utcnow().isoformat()
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
@app.get("/run")
|
| 67 |
+
def run_all(background_tasks: BackgroundTasks):
|
| 68 |
+
global orchestrator_running, orchestrator_thread
|
| 69 |
+
if orchestrator_running:
|
| 70 |
+
return {"status": "already_running", "message": "Orchestrator is already running"}
|
| 71 |
+
|
| 72 |
+
orchestrator_running = True
|
| 73 |
+
t = threading.Thread(target=run_orchestrator, daemon=True)
|
| 74 |
+
t.start()
|
| 75 |
+
return {"status": "started", "message": "Orchestrator started"}
|
| 76 |
+
|
| 77 |
+
@app.get("/status")
|
| 78 |
+
def status():
|
| 79 |
+
return {
|
| 80 |
+
"orchestrator_running": orchestrator_running,
|
| 81 |
+
"time": datetime.utcnow().isoformat()
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
@app.get("/logs")
|
| 85 |
+
def logs():
|
| 86 |
+
if orchestrator_result:
|
| 87 |
+
return orchestrator_result
|
| 88 |
+
return {"message": "No logs yet - orchestrator has not run"}
|
| 89 |
+
|
| 90 |
+
@app.get("/logfile")
|
| 91 |
+
def logfile():
|
| 92 |
+
log_files = sorted(LOGS_DIR.glob("final_results_*.json"), reverse=True)
|
| 93 |
+
if log_files:
|
| 94 |
+
return PlainTextResponse(log_files[0].read_text(), media_type="application/json")
|
| 95 |
+
log_files = sorted(LOGS_DIR.glob("orchestrator_*.log"), reverse=True)
|
| 96 |
+
if log_files:
|
| 97 |
+
return PlainTextResponse(log_files[0].read_text(), media_type="text/plain")
|
| 98 |
+
return {"message": "No log files found"}
|
| 99 |
+
|
| 100 |
+
@app.on_event("startup")
|
| 101 |
+
async def startup():
|
| 102 |
+
logger.info(f"[{datetime.utcnow()}] Numerai All 48 Space started")
|
| 103 |
+
logger.info(f"Scripts dir exists: {SCRIPTS_DIR.exists()}")
|
| 104 |
+
logger.info(f"Orchestrator exists: {ORCHESTRATOR_PATH.exists()}")
|
| 105 |
+
|
| 106 |
+
# List scripts dir
|
| 107 |
+
if SCRIPTS_DIR.exists():
|
| 108 |
+
for f in SCRIPTS_DIR.rglob('*.py'):
|
| 109 |
+
logger.info(f" Script: {f}")
|
| 110 |
+
|
| 111 |
+
# Run orchestrator on startup
|
| 112 |
+
global orchestrator_running, orchestrator_thread
|
| 113 |
+
orchestrator_running = True
|
| 114 |
+
t = threading.Thread(target=run_orchestrator, daemon=True)
|
| 115 |
+
t.start()
|
check_online_scores.py
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Check online scores for all 48 models for Round 1251
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
import json
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
from numerapi import NumerAPI, SignalsAPI, CryptoAPI
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
|
| 10 |
+
load_dotenv()
|
| 11 |
+
|
| 12 |
+
# Model IDs from models_48.json
|
| 13 |
+
MODELS = {
|
| 14 |
+
'main': [
|
| 15 |
+
{'name': 'Main - Full Blend', 'id': '633f467a-6756-4816-a22b-ee66a1017cf8'},
|
| 16 |
+
{'name': 'Main - Lightweight', 'id': '5476ea55-7320-47ed-876f-4f63373f73d4'},
|
| 17 |
+
{'name': 'Main - 3T Full', 'id': '278bf264-c658-4ea8-a2de-6672aecc285a'},
|
| 18 |
+
{'name': 'Main - High Variance', 'id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f'},
|
| 19 |
+
{'name': 'Main - Ultimate Combo', 'id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0'},
|
| 20 |
+
{'name': 'Main v3_01', 'id': '5cf38bb2-dbe3-4607-b9b4-9507a62d2758'},
|
| 21 |
+
{'name': 'Main v3_02', 'id': 'b30f3d69-90c0-4969-8167-2d60b4adda5b'},
|
| 22 |
+
{'name': 'Main v3_03', 'id': '6f5b36ec-cdad-43a9-94e3-42b8481816fb'},
|
| 23 |
+
{'name': 'Main v3_04', 'id': '89bfd21c-3f43-46fc-a678-5be3e2c79787'},
|
| 24 |
+
{'name': 'Main v3_05', 'id': 'b0e3c603-baec-4758-932a-56bcf4a7724a'},
|
| 25 |
+
{'name': 'Main v3_06', 'id': 'b24f48e1-a2f8-4186-a7dc-e13635b76fd5'},
|
| 26 |
+
{'name': 'Main v3_07', 'id': 'c109ed9e-3cb7-4ff8-846e-b0ad33d5a37d'},
|
| 27 |
+
{'name': 'Main NLP_01', 'id': 'b1aa34a5-1c27-49ce-8ff3-72688e255a8c'},
|
| 28 |
+
{'name': 'Main NLP_02', 'id': '191d0527-bf8e-45d9-816a-80bdda4b468f'},
|
| 29 |
+
{'name': 'Main NLP_03', 'id': '4ec9fa7d-aa04-4c1f-8962-ec9e5ac12d00'},
|
| 30 |
+
{'name': 'Main NLP_04', 'id': '1c288f99-3578-47a0-acee-635eac3f0fc1'},
|
| 31 |
+
],
|
| 32 |
+
'signals': [
|
| 33 |
+
{'name': 'Signals - Blend Tester', 'id': 'f82be170-5b93-4b9d-92e9-2defec6cdd13'},
|
| 34 |
+
{'name': 'Signals - Historical Validation', 'id': '36c3c35a-8313-4b48-a447-6c5b056ddf81'},
|
| 35 |
+
{'name': 'Signals - 3T Blend', 'id': 'ca23b82d-e36c-45ee-9acb-6446db424408'},
|
| 36 |
+
{'name': 'Signals - High Variance', 'id': 'e09317f5-92ab-4bec-83a9-f717d6e7f891'},
|
| 37 |
+
{'name': 'Signals - Ultimate Combo', 'id': 'c832a144-0005-4e3a-9c6d-2c7aa6b95206'},
|
| 38 |
+
{'name': 'Signals v3_01', 'id': '0002cc93-8f6c-4ae6-87b0-44e4590264e8'},
|
| 39 |
+
{'name': 'Signals v3_02', 'id': '7ff8f4e6-d10b-40ef-99ea-647cd94cf6fb'},
|
| 40 |
+
{'name': 'Signals v3_03', 'id': '59b5bd40-cf3e-4130-9ca4-a2e78768da6a'},
|
| 41 |
+
{'name': 'Signals v3_04', 'id': '5c95603f-80d9-47bc-83b3-d88be6c73839'},
|
| 42 |
+
{'name': 'Signals v3_05', 'id': 'ef1cb912-e8ab-4a8a-afc7-7ef7f8f983ff'},
|
| 43 |
+
{'name': 'Signals v3_06', 'id': 'd3be8cbe-355a-4f50-a11f-3a7dc88147f0'},
|
| 44 |
+
{'name': 'Signals v3_07', 'id': '0137e29e-3a7c-4d60-b42b-1b84e99d4d59'},
|
| 45 |
+
{'name': 'Signals NLP_01', 'id': '15fd592b-9c67-4517-a7ca-9dd95610f826'},
|
| 46 |
+
{'name': 'Signals NLP_02', 'id': '5343b52a-742a-44ee-bb3a-23f8d5205d98'},
|
| 47 |
+
{'name': 'Signals NLP_03', 'id': 'c828cd1a-39e8-47bd-8584-bccd8bd65a91'},
|
| 48 |
+
{'name': 'Signals NLP_04', 'id': 'd00aa5c9-2860-42ad-90ec-36f6a4f58b7d'},
|
| 49 |
+
],
|
| 50 |
+
'crypto': [
|
| 51 |
+
{'name': 'Crypto - Multi-Activation', 'id': 'bbbba758-c759-4e81-aa5b-bdb095709a36'},
|
| 52 |
+
{'name': 'Crypto - V2', 'id': 'f72a5c79-d1c0-4576-b9d0-fee4f9a4918f'},
|
| 53 |
+
{'name': 'Crypto - 3T Multi', 'id': '421d6dfd-0990-4ca1-9aa8-7cfe66178934'},
|
| 54 |
+
{'name': 'Crypto - 3T Multi V2', 'id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f'},
|
| 55 |
+
{'name': 'Crypto - Ultimate Combo', 'id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0'},
|
| 56 |
+
{'name': 'Crypto v3_01', 'id': 'b2170b85-10a7-481e-967a-b4b3c1139e36'},
|
| 57 |
+
{'name': 'Crypto v3_02', 'id': 'a5be0f58-8efe-4e9d-8cbd-93fae1c246c7'},
|
| 58 |
+
{'name': 'Crypto v3_03', 'id': '4a55388a-e1e1-493e-8e09-bc4ecb4aa351'},
|
| 59 |
+
{'name': 'Crypto v3_04', 'id': '1b21cc76-7f1c-44e6-9a1b-95cc5b0d2245'},
|
| 60 |
+
{'name': 'Crypto v3_05', 'id': '40233110-4901-4469-8d3d-ba5d7d4a0369'},
|
| 61 |
+
{'name': 'Crypto v3_06', 'id': '7ba989e5-fb6c-40e1-b08e-4506e8ff2593'},
|
| 62 |
+
{'name': 'Crypto v3_07', 'id': '61a23f9f-cc55-4067-bd32-b85b258b6ab7'},
|
| 63 |
+
{'name': 'Crypto NLP_01', 'id': '44eaf326-62cc-4050-b599-35609ac5b57a'},
|
| 64 |
+
{'name': 'Crypto NLP_02', 'id': 'bfc51fd1-9401-4010-a266-824e980e3722'},
|
| 65 |
+
{'name': 'Crypto NLP_03', 'id': 'f3a4b22d-a121-48c2-8a6b-25adb6eb3b60'},
|
| 66 |
+
{'name': 'Crypto NLP_04', 'id': 'b0e8cd05-7c4b-440c-bc74-51f239466c54'},
|
| 67 |
+
]
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
ROUND = 1251
|
| 71 |
+
|
| 72 |
+
def check_scores():
|
| 73 |
+
print("=" * 80)
|
| 74 |
+
print(f"CHECKING ONLINE SCORES FOR ROUND {ROUND}")
|
| 75 |
+
print("=" * 80)
|
| 76 |
+
|
| 77 |
+
results = {'main': [], 'signals': [], 'crypto': []}
|
| 78 |
+
|
| 79 |
+
# Main tournament
|
| 80 |
+
print("\n[MAIN TOURNAMENT]")
|
| 81 |
+
napi = NumerAPI()
|
| 82 |
+
for model in MODELS['main']:
|
| 83 |
+
try:
|
| 84 |
+
rounds = napi.round_model_performances(model['id'])
|
| 85 |
+
round_data = next((r for r in rounds if r['roundNumber'] == ROUND), None)
|
| 86 |
+
if round_data:
|
| 87 |
+
corr = round_data.get('corr')
|
| 88 |
+
mmc = round_data.get('mmc')
|
| 89 |
+
tc = round_data.get('tc')
|
| 90 |
+
print(f" {model['name']:30s} | Corr: {corr or 'N/A':>10s} | MMC: {mmc or 'N/A':>10s} | TC: {tc or 'N/A':>10s}")
|
| 91 |
+
results['main'].append({
|
| 92 |
+
'name': model['name'],
|
| 93 |
+
'model_id': model['id'],
|
| 94 |
+
'corr': corr,
|
| 95 |
+
'mmc': mmc,
|
| 96 |
+
'tc': tc
|
| 97 |
+
})
|
| 98 |
+
else:
|
| 99 |
+
print(f" {model['name']:30s} | No data for round {ROUND}")
|
| 100 |
+
results['main'].append({
|
| 101 |
+
'name': model['name'],
|
| 102 |
+
'model_id': model['id'],
|
| 103 |
+
'corr': None,
|
| 104 |
+
'mmc': None,
|
| 105 |
+
'tc': None
|
| 106 |
+
})
|
| 107 |
+
except Exception as e:
|
| 108 |
+
print(f" {model['name']:30s} | Error: {e}")
|
| 109 |
+
|
| 110 |
+
# Signals tournament
|
| 111 |
+
print("\n[SIGNALS TOURNAMENT]")
|
| 112 |
+
sapi = SignalsAPI()
|
| 113 |
+
for model in MODELS['signals']:
|
| 114 |
+
try:
|
| 115 |
+
rounds = sapi.round_model_performances(model['id'])
|
| 116 |
+
round_data = next((r for r in rounds if r['roundNumber'] == ROUND), None)
|
| 117 |
+
if round_data:
|
| 118 |
+
corr = round_data.get('corr')
|
| 119 |
+
mmc = round_data.get('mmc')
|
| 120 |
+
tc = round_data.get('tc')
|
| 121 |
+
print(f" {model['name']:30s} | Corr: {corr or 'N/A':>10s} | MMC: {mmc or 'N/A':>10s} | TC: {tc or 'N/A':>10s}")
|
| 122 |
+
results['signals'].append({
|
| 123 |
+
'name': model['name'],
|
| 124 |
+
'model_id': model['id'],
|
| 125 |
+
'corr': corr,
|
| 126 |
+
'mmc': mmc,
|
| 127 |
+
'tc': tc
|
| 128 |
+
})
|
| 129 |
+
else:
|
| 130 |
+
print(f" {model['name']:30s} | No data for round {ROUND}")
|
| 131 |
+
results['signals'].append({
|
| 132 |
+
'name': model['name'],
|
| 133 |
+
'model_id': model['id'],
|
| 134 |
+
'corr': None,
|
| 135 |
+
'mmc': None,
|
| 136 |
+
'tc': None
|
| 137 |
+
})
|
| 138 |
+
except Exception as e:
|
| 139 |
+
print(f" {model['name']:30s} | Error: {e}")
|
| 140 |
+
|
| 141 |
+
# Crypto tournament
|
| 142 |
+
print("\n[CRYPTO TOURNAMENT]")
|
| 143 |
+
capi = CryptoAPI()
|
| 144 |
+
for model in MODELS['crypto']:
|
| 145 |
+
try:
|
| 146 |
+
rounds = capi.round_model_performances(model['id'])
|
| 147 |
+
round_data = next((r for r in rounds if r['roundNumber'] == ROUND), None)
|
| 148 |
+
if round_data:
|
| 149 |
+
corr = round_data.get('corr')
|
| 150 |
+
mmc = round_data.get('mmc')
|
| 151 |
+
tc = round_data.get('tc')
|
| 152 |
+
print(f" {model['name']:30s} | Corr: {corr or 'N/A':>10s} | MMC: {mmc or 'N/A':>10s} | TC: {tc or 'N/A':>10s}")
|
| 153 |
+
results['crypto'].append({
|
| 154 |
+
'name': model['name'],
|
| 155 |
+
'model_id': model['id'],
|
| 156 |
+
'corr': corr,
|
| 157 |
+
'mmc': mmc,
|
| 158 |
+
'tc': tc
|
| 159 |
+
})
|
| 160 |
+
else:
|
| 161 |
+
print(f" {model['name']:30s} | No data for round {ROUND}")
|
| 162 |
+
results['crypto'].append({
|
| 163 |
+
'name': model['name'],
|
| 164 |
+
'model_id': model['id'],
|
| 165 |
+
'corr': None,
|
| 166 |
+
'mmc': None,
|
| 167 |
+
'tc': None
|
| 168 |
+
})
|
| 169 |
+
except Exception as e:
|
| 170 |
+
print(f" {model['name']:30s} | Error: {e}")
|
| 171 |
+
|
| 172 |
+
# Save results
|
| 173 |
+
output_file = f"logs/online_scores_round_{ROUND}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
|
| 174 |
+
os.makedirs('logs', exist_ok=True)
|
| 175 |
+
with open(output_file, 'w') as f:
|
| 176 |
+
json.dump({
|
| 177 |
+
'round': ROUND,
|
| 178 |
+
'timestamp': datetime.now().isoformat(),
|
| 179 |
+
'results': results
|
| 180 |
+
}, f, indent=2)
|
| 181 |
+
|
| 182 |
+
print(f"\n\nResults saved to: {output_file}")
|
| 183 |
+
|
| 184 |
+
if __name__ == '__main__':
|
| 185 |
+
check_scores()
|
check_upload.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Check upload status for model 5476ea55-7320-47ed-876f-4f63373f73d4
|
| 3 |
+
"""
|
| 4 |
+
from numerapi import NumerAPI
|
| 5 |
+
import os
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
# Load credentials
|
| 9 |
+
env_file = Path('c:/numerai48models/.env')
|
| 10 |
+
if env_file.exists():
|
| 11 |
+
with open(env_file, 'rb') as f:
|
| 12 |
+
content = f.read()
|
| 13 |
+
for line in content.decode('utf-8', errors='ignore').split('\n'):
|
| 14 |
+
if '=' in line and not line.startswith('#'):
|
| 15 |
+
key, value = line.split('=', 1)
|
| 16 |
+
os.environ[key.strip()] = value.strip()
|
| 17 |
+
|
| 18 |
+
NUMERAI_PUBLIC_ID = os.getenv('NUMERAI_PUBLIC_ID', 'F7L5RN6EXNTZWUIZDHPPMUF2QH6KA2A3')
|
| 19 |
+
NUMERAI_SECRET_KEY = os.getenv('NUMERAI_SECRET_KEY', '')
|
| 20 |
+
|
| 21 |
+
print("Checking submissions for Main - Lightweight (5476ea55-7320-47ed-876f-4f63373f73d4)...")
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
napi = NumerAPI(public_id=NUMERAI_PUBLIC_ID, secret_key=NUMERAI_SECRET_KEY)
|
| 25 |
+
|
| 26 |
+
model_id = '5476ea55-7320-47ed-876f-4f63373f73d4'
|
| 27 |
+
|
| 28 |
+
# Get model info
|
| 29 |
+
print("\nGetting model info...")
|
| 30 |
+
models = napi.get_models()
|
| 31 |
+
model_info = next((m for m in models if m['id'] == model_id), None)
|
| 32 |
+
if model_info:
|
| 33 |
+
print(f"Model name: {model_info.get('name')}")
|
| 34 |
+
print(f"Tournament: {model_info.get('tournament')}")
|
| 35 |
+
|
| 36 |
+
# Get submissions
|
| 37 |
+
print("\nGetting submissions...")
|
| 38 |
+
submissions = napi.get_submissions(model_id=model_id)
|
| 39 |
+
|
| 40 |
+
if submissions:
|
| 41 |
+
print(f"\nFound {len(submissions)} submissions")
|
| 42 |
+
print("\nLatest 3 submissions:")
|
| 43 |
+
for i, sub in enumerate(submissions[:3]):
|
| 44 |
+
print(f"\n{i+1}. Round {sub.get('round_number')}:")
|
| 45 |
+
print(f" Status: {sub.get('status')}")
|
| 46 |
+
print(f" Submitted: {sub.get('insert_time')}")
|
| 47 |
+
print(f" Filename: {sub.get('filename')}")
|
| 48 |
+
else:
|
| 49 |
+
print("\nNo submissions found for this model!")
|
| 50 |
+
print("This model may not have uploaded successfully.")
|
| 51 |
+
|
| 52 |
+
except Exception as e:
|
| 53 |
+
print(f"\nError: {e}")
|
compare_core_models.py
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Compare performance of 15 core models across tournaments
|
| 3 |
+
Fetches last 7 rounds of data and creates comparison report
|
| 4 |
+
"""
|
| 5 |
+
import pandas as pd
|
| 6 |
+
from numerapi import NumerAPI, SignalsAPI, CryptoAPI
|
| 7 |
+
from datetime import datetime
|
| 8 |
+
import json
|
| 9 |
+
|
| 10 |
+
# 15 Core Models
|
| 11 |
+
CORE_MODELS = {
|
| 12 |
+
'main': [
|
| 13 |
+
{'name': 'Main - Full Blend', 'id': '633f467a-6756-4816-a22b-ee66a1017cf8'},
|
| 14 |
+
{'name': 'Main - Lightweight', 'id': '5476ea55-7320-47ed-876f-4f63373f73d4'},
|
| 15 |
+
{'name': 'Main - 3T Full', 'id': '278bf264-c658-4ea8-a2de-6672aecc285a'},
|
| 16 |
+
{'name': 'Main - High Variance', 'id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f'},
|
| 17 |
+
{'name': 'Main - Ultimate Combo', 'id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0'},
|
| 18 |
+
],
|
| 19 |
+
'signals': [
|
| 20 |
+
{'name': 'Signals - Blend Tester', 'id': 'f82be170-5b93-4b9d-92e9-2defec6cdd13'},
|
| 21 |
+
{'name': 'Signals - Historical Validation', 'id': '36c3c35a-8313-4b48-a447-6c5b056ddf81'},
|
| 22 |
+
{'name': 'Signals - 3T Blend', 'id': 'ca23b82d-e36c-45ee-9acb-6446db424408'},
|
| 23 |
+
{'name': 'Signals - High Variance', 'id': 'e09317f5-92ab-4bec-83a9-f717d6e7f891'},
|
| 24 |
+
{'name': 'Signals - Ultimate Combo', 'id': 'c832a144-0005-4e3a-9c6d-2c7aa6b95206'},
|
| 25 |
+
],
|
| 26 |
+
'crypto': [
|
| 27 |
+
{'name': 'Crypto - Multi-Activation', 'id': 'bbbba758-c759-4e81-aa5b-bdb095709a36'},
|
| 28 |
+
{'name': 'Crypto - V2', 'id': 'f72a5c79-d1c0-4576-b9d0-fee4f9a4918f'},
|
| 29 |
+
{'name': 'Crypto - 3T Multi', 'id': '421d6dfd-0990-4ca1-9aa8-7cfe66178934'},
|
| 30 |
+
{'name': 'Crypto - 3T Multi V2', 'id': 'bc632a2b-da46-400b-ae58-ff774caa5b3f'},
|
| 31 |
+
{'name': 'Crypto - Ultimate Combo', 'id': 'ae6bd3de-d5db-4b54-9690-7216f10fc4c0'},
|
| 32 |
+
]
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
def fetch_model_performance(api, model_id, model_name, tournament, last_n_rounds=7):
|
| 36 |
+
"""Fetch performance for a single model"""
|
| 37 |
+
try:
|
| 38 |
+
print(f" Fetching {model_name}...")
|
| 39 |
+
rounds = api.round_model_performances(model_id)
|
| 40 |
+
|
| 41 |
+
if not rounds:
|
| 42 |
+
return []
|
| 43 |
+
|
| 44 |
+
# Get last N rounds with scores
|
| 45 |
+
recent_rounds = [r for r in rounds if r.get('corr') is not None][:last_n_rounds]
|
| 46 |
+
|
| 47 |
+
results = []
|
| 48 |
+
for r in recent_rounds:
|
| 49 |
+
results.append({
|
| 50 |
+
'model': model_name,
|
| 51 |
+
'tournament': tournament,
|
| 52 |
+
'round': r.get('roundNumber'),
|
| 53 |
+
'corr': r.get('corr'),
|
| 54 |
+
'corrPercentile': r.get('corrPercentile'),
|
| 55 |
+
'mmc': r.get('mmc'),
|
| 56 |
+
'tc': r.get('tc'),
|
| 57 |
+
'tcPercentile': r.get('tcPercentile'),
|
| 58 |
+
})
|
| 59 |
+
|
| 60 |
+
return results
|
| 61 |
+
|
| 62 |
+
except Exception as e:
|
| 63 |
+
print(f" ERROR: {e}")
|
| 64 |
+
return []
|
| 65 |
+
|
| 66 |
+
def main():
|
| 67 |
+
print("=" * 80)
|
| 68 |
+
print("COMPARING 15 CORE MODELS - LAST 7 ROUNDS")
|
| 69 |
+
print("=" * 80)
|
| 70 |
+
print()
|
| 71 |
+
|
| 72 |
+
all_results = []
|
| 73 |
+
|
| 74 |
+
# MAIN Tournament
|
| 75 |
+
print("\n[MAIN TOURNAMENT]")
|
| 76 |
+
napi = NumerAPI()
|
| 77 |
+
for model in CORE_MODELS['main']:
|
| 78 |
+
results = fetch_model_performance(napi, model['id'], model['name'], 'main')
|
| 79 |
+
all_results.extend(results)
|
| 80 |
+
|
| 81 |
+
# SIGNALS Tournament
|
| 82 |
+
print("\n[SIGNALS TOURNAMENT]")
|
| 83 |
+
sapi = SignalsAPI()
|
| 84 |
+
for model in CORE_MODELS['signals']:
|
| 85 |
+
results = fetch_model_performance(sapi, model['id'], model['name'], 'signals')
|
| 86 |
+
all_results.extend(results)
|
| 87 |
+
|
| 88 |
+
# CRYPTO Tournament
|
| 89 |
+
print("\n[CRYPTO TOURNAMENT]")
|
| 90 |
+
capi = CryptoAPI()
|
| 91 |
+
for model in CORE_MODELS['crypto']:
|
| 92 |
+
results = fetch_model_performance(capi, model['id'], model['name'], 'crypto')
|
| 93 |
+
all_results.extend(results)
|
| 94 |
+
|
| 95 |
+
# Create DataFrame
|
| 96 |
+
df = pd.DataFrame(all_results)
|
| 97 |
+
|
| 98 |
+
if df.empty:
|
| 99 |
+
print("\nNo data retrieved!")
|
| 100 |
+
return
|
| 101 |
+
|
| 102 |
+
# Save raw data
|
| 103 |
+
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
|
| 104 |
+
csv_file = f"logs/core_models_comparison_{timestamp}.csv"
|
| 105 |
+
df.to_csv(csv_file, index=False)
|
| 106 |
+
print(f"\n\nRaw data saved to: {csv_file}")
|
| 107 |
+
|
| 108 |
+
# Analysis
|
| 109 |
+
print("\n" + "=" * 80)
|
| 110 |
+
print("ANALYSIS - LAST 7 ROUNDS")
|
| 111 |
+
print("=" * 80)
|
| 112 |
+
|
| 113 |
+
# Summary by tournament
|
| 114 |
+
for tournament in ['main', 'signals', 'crypto']:
|
| 115 |
+
print(f"\n{tournament.upper()} TOURNAMENT:")
|
| 116 |
+
print("-" * 80)
|
| 117 |
+
|
| 118 |
+
t_df = df[df['tournament'] == tournament].copy()
|
| 119 |
+
|
| 120 |
+
if t_df.empty:
|
| 121 |
+
print(" No data available")
|
| 122 |
+
continue
|
| 123 |
+
|
| 124 |
+
# Calculate averages per model
|
| 125 |
+
summary = t_df.groupby('model').agg({
|
| 126 |
+
'corr': ['mean', 'std', 'min', 'max', 'count'],
|
| 127 |
+
'mmc': 'mean',
|
| 128 |
+
'tc': 'mean',
|
| 129 |
+
'corrPercentile': 'mean'
|
| 130 |
+
}).round(4)
|
| 131 |
+
|
| 132 |
+
print(summary.to_string())
|
| 133 |
+
|
| 134 |
+
# Overall rankings
|
| 135 |
+
print("\n" + "=" * 80)
|
| 136 |
+
print("OVERALL RANKINGS (by average correlation)")
|
| 137 |
+
print("=" * 80)
|
| 138 |
+
|
| 139 |
+
rankings = df.groupby('model').agg({
|
| 140 |
+
'corr': 'mean',
|
| 141 |
+
'mmc': 'mean',
|
| 142 |
+
'tc': 'mean',
|
| 143 |
+
'corrPercentile': 'mean'
|
| 144 |
+
}).sort_values('corr', ascending=False).round(4)
|
| 145 |
+
|
| 146 |
+
print(rankings.to_string())
|
| 147 |
+
|
| 148 |
+
# Top performers
|
| 149 |
+
print("\n" + "=" * 80)
|
| 150 |
+
print("TOP 5 PERFORMERS (by average correlation)")
|
| 151 |
+
print("=" * 80)
|
| 152 |
+
|
| 153 |
+
for i, (model, row) in enumerate(rankings.head(5).iterrows(), 1):
|
| 154 |
+
print(f"\n{i}. {model}")
|
| 155 |
+
print(f" Avg Corr: {row['corr']:.4f}")
|
| 156 |
+
print(f" Avg MMC: {row['mmc']:.4f}")
|
| 157 |
+
print(f" Avg TC: {row['tc']:.4f}")
|
| 158 |
+
print(f" Percentile: {row['corrPercentile']:.1f}")
|
| 159 |
+
|
| 160 |
+
# Bottom performers
|
| 161 |
+
print("\n" + "=" * 80)
|
| 162 |
+
print("BOTTOM 5 PERFORMERS (by average correlation)")
|
| 163 |
+
print("=" * 80)
|
| 164 |
+
|
| 165 |
+
for i, (model, row) in enumerate(rankings.tail(5).iterrows(), 1):
|
| 166 |
+
print(f"\n{i}. {model}")
|
| 167 |
+
print(f" Avg Corr: {row['corr']:.4f}")
|
| 168 |
+
print(f" Avg MMC: {row['mmc']:.4f}")
|
| 169 |
+
print(f" Avg TC: {row['tc']:.4f}")
|
| 170 |
+
print(f" Percentile: {row['corrPercentile']:.1f}")
|
| 171 |
+
|
| 172 |
+
# Round-by-round comparison
|
| 173 |
+
print("\n" + "=" * 80)
|
| 174 |
+
print("ROUND-BY-ROUND CORRELATION")
|
| 175 |
+
print("=" * 80)
|
| 176 |
+
|
| 177 |
+
pivot = df.pivot_table(
|
| 178 |
+
index='model',
|
| 179 |
+
columns='round',
|
| 180 |
+
values='corr',
|
| 181 |
+
aggfunc='first'
|
| 182 |
+
).round(4)
|
| 183 |
+
|
| 184 |
+
print(pivot.to_string())
|
| 185 |
+
|
| 186 |
+
# Save summary
|
| 187 |
+
summary_file = f"logs/core_models_summary_{timestamp}.txt"
|
| 188 |
+
with open(summary_file, 'w') as f:
|
| 189 |
+
f.write("=" * 80 + "\n")
|
| 190 |
+
f.write("CORE MODELS PERFORMANCE COMPARISON\n")
|
| 191 |
+
f.write("=" * 80 + "\n\n")
|
| 192 |
+
f.write(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
| 193 |
+
f.write(f"Models analyzed: 15 core models\n")
|
| 194 |
+
f.write(f"Rounds analyzed: Last 7 rounds with scores\n\n")
|
| 195 |
+
f.write("\nOVERALL RANKINGS:\n")
|
| 196 |
+
f.write("-" * 80 + "\n")
|
| 197 |
+
f.write(rankings.to_string())
|
| 198 |
+
f.write("\n\nROUND-BY-ROUND:\n")
|
| 199 |
+
f.write("-" * 80 + "\n")
|
| 200 |
+
f.write(pivot.to_string())
|
| 201 |
+
|
| 202 |
+
print(f"\n\nSummary saved to: {summary_file}")
|
| 203 |
+
print(f"Data saved to: {csv_file}")
|
| 204 |
+
|
| 205 |
+
print("\n" + "=" * 80)
|
| 206 |
+
print("COMPARISON COMPLETE")
|
| 207 |
+
print("=" * 80)
|
| 208 |
+
|
| 209 |
+
if __name__ == '__main__':
|
| 210 |
+
main()
|
data/crypto/crypto/crypto_live_round_1248.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:490df490b2febeeb5802e4d0abbdfd476c2037edca277f404fe5c09132ab3ba9
|
| 3 |
+
size 23593
|
data/crypto/crypto/crypto_live_round_1249.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6ebb13669c26f5458dd539cf48ddbce88255780f09b678bf4be817ff3565cb7
|
| 3 |
+
size 23562
|
data/crypto/crypto/crypto_live_round_1250.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0dd5b1f82280e5a632094db3d672cf3108df2780632a21b0e6c6289a26ee3676
|
| 3 |
+
size 23586
|
data/crypto/crypto/crypto_v2_live_round_1243.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afc92c12ad4cd82e6c26046101deaae9034b6aaceecf96d8b522da3a586b5e3b
|
| 3 |
+
size 23595
|
data/crypto/crypto/crypto_v2_live_round_1244.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/crypto_v2_live_round_1245.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4099768efc11c9b2f1343f62149cce25ed2b27d860561179f21697880f0f778e
|
| 3 |
+
size 23631
|
data/crypto/crypto/crypto_v2_live_round_1248.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:490df490b2febeeb5802e4d0abbdfd476c2037edca277f404fe5c09132ab3ba9
|
| 3 |
+
size 23593
|
data/crypto/crypto/crypto_v2_live_round_1249.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6ebb13669c26f5458dd539cf48ddbce88255780f09b678bf4be817ff3565cb7
|
| 3 |
+
size 23562
|
data/crypto/crypto/crypto_v2_live_round_1250.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0dd5b1f82280e5a632094db3d672cf3108df2780632a21b0e6c6289a26ee3676
|
| 3 |
+
size 23586
|
data/crypto/crypto/live_20260411_140230.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_140443.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_144550.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_144757.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_151852.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_152626.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_153214.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_153305.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_153609.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260411_153823.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|
data/crypto/crypto/live_20260414_140604.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4099768efc11c9b2f1343f62149cce25ed2b27d860561179f21697880f0f778e
|
| 3 |
+
size 23631
|
data/crypto/crypto/live_20260415_100038.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4099768efc11c9b2f1343f62149cce25ed2b27d860561179f21697880f0f778e
|
| 3 |
+
size 23631
|
data/crypto/crypto/live_20260416_120551.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:592c74aa5286397e0e0ce49e323d6c356c5603ab2e8683c96169353ffdf6fb2a
|
| 3 |
+
size 23541
|
data/crypto/crypto_live_round_1248.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:490df490b2febeeb5802e4d0abbdfd476c2037edca277f404fe5c09132ab3ba9
|
| 3 |
+
size 23593
|
data/crypto/crypto_live_round_1249.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6ebb13669c26f5458dd539cf48ddbce88255780f09b678bf4be817ff3565cb7
|
| 3 |
+
size 23562
|
data/crypto/crypto_live_round_1250.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0dd5b1f82280e5a632094db3d672cf3108df2780632a21b0e6c6289a26ee3676
|
| 3 |
+
size 23586
|
data/crypto/crypto_live_round_1251.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da1c69303cfbae2d8bfd8c093e84158e429d83f611a6862b173a9b8461f5f6ae
|
| 3 |
+
size 23589
|
data/crypto/crypto_live_round_1252.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9bc18241b48ee92d90d8e0b788c761916818978425783cc222a96567295d3819
|
| 3 |
+
size 23574
|
data/crypto/crypto_live_round_1253.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9bc18241b48ee92d90d8e0b788c761916818978425783cc222a96567295d3819
|
| 3 |
+
size 23574
|
data/crypto/crypto_live_round_1255.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af8b6d2784814622758361f32bc5997e3666b6f17c0388f761fa384acbbd64b9
|
| 3 |
+
size 23595
|
data/crypto/crypto_v2_live_round_1243.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afc92c12ad4cd82e6c26046101deaae9034b6aaceecf96d8b522da3a586b5e3b
|
| 3 |
+
size 23595
|
data/crypto/crypto_v2_live_round_1244.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:427c9f1034ab494bf6bd6ff4472f3184d3c26aa43df27c581d4e8d3dc099a9b7
|
| 3 |
+
size 23549
|