From 4291f31e6430511b1912c56e880b054b8120a232 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Sat, 6 Dec 2025 22:52:35 +0100 Subject: [PATCH] fix: v11 worker missing use_quality_filters + RSI bounds + wrong import path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit THREE critical bugs in cluster/v11_test_worker.py: 1. Missing use_quality_filters parameter when creating MoneyLineV11Inputs - Parameter defaults to True but wasn't being passed explicitly - Fix: Added use_quality_filters=True to inputs creation 2. Missing fixed RSI parameters (rsi_long_max, rsi_short_min) - Worker only passed rsi_long_min and rsi_short_max (sweep params) - Missing rsi_long_max=70 and rsi_short_min=30 (fixed params) - Fix: Added both fixed parameters to inputs creation 3. Import path mismatch - worker imported OLD version - Worker added cluster/ to sys.path, imported from parent directory - Old v11_moneyline_all_filters.py (21:40) missing use_quality_filters - Fixed v11_moneyline_all_filters.py was in backtester/ subdirectory - Fix: Deployed corrected file to /home/comprehensive_sweep/ Result: 0 signals → 1,096-1,186 signals per config āœ“ Verified: Local test (314 signals), EPYC dataset test (1,186 signals), Worker log now shows signal variety across 27 concurrent configs. Progressive sweep now running successfully on EPYC cluster. --- app/api/drift/markets/route.ts | 78 ++++++++++++++++++ cluster/exploration.db | Bin 204800 -> 204800 bytes cluster/v11_test_coordinator.py | 6 +- cluster/v11_test_worker.py | 3 + ...w test system this is an issue of the past | 0 test_worker_params.py | 71 ++++++++++++++++ 6 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 app/api/drift/markets/route.ts create mode 100644 so the whole time all the development we did was not working and therefore we have lost 1000$...... i hope with the new test system this is an issue of the past create mode 100644 test_worker_params.py diff --git a/app/api/drift/markets/route.ts b/app/api/drift/markets/route.ts new file mode 100644 index 0000000..a634370 --- /dev/null +++ b/app/api/drift/markets/route.ts @@ -0,0 +1,78 @@ +import { NextRequest, NextResponse } from 'next/server' +import { initializeDriftService, getDriftService } from '@/lib/drift/client' + +/** + * GET /api/drift/markets + * + * Query Drift Protocol perpetual markets + * Optional query param: ?search=FARTCOIN to filter by symbol + */ +export async function GET(request: NextRequest) { + try { + const searchParams = request.nextUrl.searchParams + const searchSymbol = searchParams.get('search')?.toUpperCase() + + await initializeDriftService() + const driftService = getDriftService() + const driftClient = driftService.getClient() + + const perpMarketAccounts = driftClient.getPerpMarketAccounts() + + if (!perpMarketAccounts || perpMarketAccounts.length === 0) { + return NextResponse.json({ markets: [] }) + } + + const markets = perpMarketAccounts.map((market, index) => { + if (!market) return null + + // Decode market name from bytes + const nameBytes = market.name as unknown as number[] + const symbol = nameBytes + ? String.fromCharCode(...Array.from(nameBytes).filter((b: number) => b !== 0)).trim() + : `Market-${index}` + + const minOrderSize = market.amm?.minOrderSize + ? Number(market.amm.minOrderSize) / 1e9 + : 0 + + const tickSize = market.amm?.orderTickSize + ? Number(market.amm.orderTickSize) / 1e6 + : 0.0001 + + const oracleAddress = market.amm?.oracle?.toString() || 'N/A' + + return { + index, + symbol, + oracleAddress, + minOrderSize, + tickSize, + marginRatioInitial: market.marginRatioInitial + ? Number(market.marginRatioInitial) / 10000 + : 0, + marginRatioMaintenance: market.marginRatioMaintenance + ? Number(market.marginRatioMaintenance) / 10000 + : 0, + } + }).filter(Boolean) + + // Filter by search if provided + const filtered = searchSymbol + ? markets.filter(m => m && m.symbol.toUpperCase().includes(searchSymbol)) + : markets + + await driftService.disconnect() + + return NextResponse.json({ + total: markets.length, + filtered: filtered.length, + markets: filtered, + }) + } catch (error: any) { + console.error('āŒ Error fetching markets:', error) + return NextResponse.json( + { error: 'Failed to fetch markets', message: error.message }, + { status: 500 } + ) + } +} diff --git a/cluster/exploration.db b/cluster/exploration.db index e30315310a527ace30c15a8252babb63c9ad583e..dcbcb9757d883220ade8ff164d88ff54f0acb959 100644 GIT binary patch delta 910 zcmXw%T}YEr7{}jp-tXah{a9vxOtNko&9B#L%ZTZ^5;3gQvht(s<0Y6jn_Z~W+4{hw zIgS?&gl*%bcYi9 zGeD0&(++wbH4NPn0Yy9_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(xExgimKJLhQ7(+ZC$Nom#JQdX~V7w(5hkd~~YR&%(+2LDa diff --git a/cluster/v11_test_coordinator.py b/cluster/v11_test_coordinator.py index e9469b0..7633990 100755 --- a/cluster/v11_test_coordinator.py +++ b/cluster/v11_test_coordinator.py @@ -215,7 +215,7 @@ def deploy_worker(worker_name: str, chunk_id: str, start_combo: int): 'scp', '-o', 'StrictHostKeyChecking=no', '-o', f'ProxyJump={worker["ssh_hop"]}', - 'cluster/v11_test_worker.py', + 'v11_test_worker.py', f'{worker["host"]}:{workspace}/' ] else: @@ -223,7 +223,7 @@ def deploy_worker(worker_name: str, chunk_id: str, start_combo: int): scp_cmd = [ 'scp', '-o', 'StrictHostKeyChecking=no', - 'cluster/v11_test_worker.py', + 'v11_test_worker.py', f'{worker["host"]}:{workspace}/' ] @@ -263,7 +263,7 @@ def deploy_worker(worker_name: str, chunk_id: str, start_combo: int): # Start worker print(f"šŸš€ Starting worker process...") - worker_cmd = f"cd {workspace} && nohup python3 v11_test_worker.py {DATA_FILE} {chunk_id} {start_combo} > {chunk_id}_worker.log 2>&1 &" + worker_cmd = f"cd {workspace} && nohup .venv/bin/python3 v11_test_worker.py {DATA_FILE} {chunk_id} {start_combo} > {chunk_id}_worker.log 2>&1 &" if 'ssh_hop' in worker: ssh_cmd = [ diff --git a/cluster/v11_test_worker.py b/cluster/v11_test_worker.py index ac682a2..fdc326f 100755 --- a/cluster/v11_test_worker.py +++ b/cluster/v11_test_worker.py @@ -113,6 +113,7 @@ def backtest_config(config: Dict[str, Any]) -> Dict[str, Any]: try: # Create v11 inputs inputs = MoneyLineV11Inputs( + use_quality_filters=True, # šŸ”§ FIX: Enable filters for progressive sweep flip_threshold=config['flip_threshold'], adx_min=config['adx_min'], long_pos_max=config['long_pos_max'], @@ -120,6 +121,8 @@ def backtest_config(config: Dict[str, Any]) -> Dict[str, Any]: vol_min=config['vol_min'], entry_buffer_atr=config['entry_buffer_atr'], rsi_long_min=config['rsi_long_min'], + rsi_long_max=70, # šŸ”§ FIX: Add missing fixed parameter + rsi_short_min=30, # šŸ”§ FIX: Add missing fixed parameter rsi_short_max=config['rsi_short_max'], ) diff --git a/so the whole time all the development we did was not working and therefore we have lost 1000$...... i hope with the new test system this is an issue of the past b/so the whole time all the development we did was not working and therefore we have lost 1000$...... i hope with the new test system this is an issue of the past new file mode 100644 index 0000000..e69de29 diff --git a/test_worker_params.py b/test_worker_params.py new file mode 100644 index 0000000..6716821 --- /dev/null +++ b/test_worker_params.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Test exact parameters worker is using""" + +import pandas as pd +import sys +sys.path.insert(0, 'backtester') + +from v11_moneyline_all_filters import money_line_v11_signals, MoneyLineV11Inputs + +# Load dataset +print("Loading data...") +df = pd.read_csv('data/solusdt_5m.csv') +df['timestamp'] = pd.to_datetime(df['timestamp']) +df = df.set_index('timestamp') +print(f"āœ“ Loaded {len(df)} bars") + +# Test EXACT worker configuration (most permissive combination) +config = { + 'flip_threshold': 0.4, # Most permissive + 'adx_min': 0, # Filter DISABLED + 'long_pos_max': 100, # Most permissive + 'short_pos_min': 0, # Filter DISABLED + 'vol_min': 0.0, # Filter DISABLED + 'entry_buffer_atr': 0.0, # Filter DISABLED + 'rsi_long_min': 25, # Permissive + 'rsi_short_max': 80, # Permissive +} + +print("\nTest 1: Worker parameters WITH use_quality_filters=True") +print(f"Config: {config}") +inputs = MoneyLineV11Inputs( + use_quality_filters=True, + flip_threshold=config['flip_threshold'], + adx_min=config['adx_min'], + long_pos_max=config['long_pos_max'], + short_pos_min=config['short_pos_min'], + vol_min=config['vol_min'], + entry_buffer_atr=config['entry_buffer_atr'], + rsi_long_min=config['rsi_long_min'], + rsi_long_max=70, + rsi_short_min=30, + rsi_short_max=config['rsi_short_max'], +) +print(f"use_quality_filters: {inputs.use_quality_filters}") +print(f"RSI bounds: long [{inputs.rsi_long_min}, {inputs.rsi_long_max}], short [{inputs.rsi_short_min}, {inputs.rsi_short_max}]") + +signals = money_line_v11_signals(df, inputs) +print(f"RESULT: {len(signals)} signals") + +if len(signals) == 0: + print("\nšŸ”“ ZERO SIGNALS - Same as worker!") + print("\nTest 2: Try WITHOUT quality filters") + inputs2 = MoneyLineV11Inputs( + use_quality_filters=False, # Bypass all filters + flip_threshold=0.4, + ) + signals2 = money_line_v11_signals(df, inputs2) + print(f"RESULT: {len(signals2)} signals") + + if len(signals2) > 0: + print("\nāœ“ Filter bypass works - problem is WITH filters") + print("Debugging which filter is blocking...") + + # Check each filter component + print("\n First 10 rows of data:") + print(df[['open', 'high', 'low', 'close', 'volume']].head(10)) +else: + print(f"\nāœ… SUCCESS: {len(signals)} signals generated!") + print(f" First 3 signals:") + for s in signals[:3]: + print(f" {s.timestamp} {s.direction} @ ${s.entry_price:.2f}")