rename fix and build fixes

This commit is contained in:
Dobromir Popov
2025-10-18 16:46:23 +03:00
parent a520ed7e39
commit 3d91cb0e8f
7 changed files with 100 additions and 69 deletions

60
.vscode/launch.json vendored
View File

@@ -1,7 +1,6 @@
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
<<<<<<< HEAD
{ {
"name": "📊 Dashboard (Real-time + Training)", "name": "📊 Dashboard (Real-time + Training)",
"type": "python", "type": "python",
@@ -20,15 +19,10 @@
}, },
"preLaunchTask": "Kill Stale Processes" "preLaunchTask": "Kill Stale Processes"
}, },
=======
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
{ {
"name": "🔬 Backtest Training (30 days)", "name": "🔬 Backtest Training (30 days)",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
<<<<<<< HEAD
"program": "main_backtest.py", "program": "main_backtest.py",
"args": [ "args": [
"--start", "--start",
@@ -57,14 +51,10 @@
"--symbol", "--symbol",
"ETH/USDT" "ETH/USDT"
], ],
=======
"program": "run_clean_dashboard.py",
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
"console": "integratedTerminal", "console": "integratedTerminal",
"justMyCode": false, "justMyCode": false,
"env": { "env": {
"PYTHONUNBUFFERED": "1", "PYTHONUNBUFFERED": "1",
<<<<<<< HEAD
"CUDA_VISIBLE_DEVICES": "0" "CUDA_VISIBLE_DEVICES": "0"
} }
}, },
@@ -89,12 +79,6 @@
"PYTHONUNBUFFERED": "1" "PYTHONUNBUFFERED": "1"
} }
}, },
=======
"ENABLE_REALTIME_CHARTS": "1"
}
},
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
{ {
"name": "🏗️ Python Debugger: Current File", "name": "🏗️ Python Debugger: Current File",
"type": "debugpy", "type": "debugpy",
@@ -106,6 +90,21 @@
"PYTHONUNBUFFERED": "1" "PYTHONUNBUFFERED": "1"
} }
}, },
{
"name": "📝 ANNOTATE Manual Trade Annotation UI",
"type": "python",
"request": "launch",
"program": "ANNOTATE/web/app.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONUNBUFFERED": "1",
"FLASK_ENV": "development",
"FLASK_DEBUG": "1"
},
"cwd": "${workspaceFolder}",
"preLaunchTask": "Kill Stale Processes"
},
{ {
"name": "📈 COB Data Provider Dashboard", "name": "📈 COB Data Provider Dashboard",
"type": "python", "type": "python",
@@ -120,7 +119,6 @@
}, },
"preLaunchTask": "Kill Stale Processes" "preLaunchTask": "Kill Stale Processes"
}, },
<<<<<<< HEAD
{ {
"name": "🔥 Real-time RL COB Trader", "name": "🔥 Real-time RL COB Trader",
"type": "python", "type": "python",
@@ -153,9 +151,6 @@
}, },
"preLaunchTask": "Kill Stale Processes" "preLaunchTask": "Kill Stale Processes"
}, },
=======
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
{ {
"name": "🧪 Run Tests", "name": "🧪 Run Tests",
"type": "python", "type": "python",
@@ -204,11 +199,6 @@
"order": 3 "order": 3
} }
} }
<<<<<<< HEAD
=======
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
], ],
"compounds": [ "compounds": [
{ {
@@ -225,36 +215,22 @@
} }
}, },
{ {
<<<<<<< HEAD
"name": "🔥 COB Trading System", "name": "🔥 COB Trading System",
"configurations": [ "configurations": [
"📈 COB Data Provider Dashboard", "📈 COB Data Provider Dashboard",
"🔥 Real-time RL COB Trader" "🔥 Real-time RL COB Trader"
=======
"name": "💹 Live Trading System (Dashboard + Monitor)",
"configurations": [
"💹 Live Scalping Dashboard (500x Leverage)",
"🌙 Overnight Training Monitor (504M Model)"
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
], ],
"stopAll": true, "stopAll": true,
"presentation": { "presentation": {
"hidden": false, "hidden": false,
<<<<<<< HEAD
"group": "COB", "group": "COB",
"order": 2 "order": 2
} }
}
=======
"group": "Trading",
"order": 2
}
}, },
{ {
"name": "🌐 COBY Multi-Exchange System (Full Stack)", "name": "🌐 COBY Multi-Exchange System (Full Stack)",
"configurations": [ "configurations": [
"🌐 COBY Multi-Exchange Data Aggregation" "🔧 COBY Development Mode (Auto-reload) - main"
], ],
"stopAll": true, "stopAll": true,
"presentation": { "presentation": {
@@ -266,7 +242,7 @@
{ {
"name": "🔧 COBY Development Environment", "name": "🔧 COBY Development Environment",
"configurations": [ "configurations": [
"🔧 COBY Development Mode (Auto-reload)" "🔧 COBY Development Mode (Auto-reload) - main"
], ],
"stopAll": true, "stopAll": true,
"presentation": { "presentation": {
@@ -275,7 +251,5 @@
"order": 7 "order": 7
} }
} }
>>>>>>> d49a473ed6f4aef55bfdd47d6370e53582be6b7b
] ]
} }

View File

@@ -44,12 +44,12 @@ ANNOTATE/
pip install dash plotly pandas numpy pip install dash plotly pandas numpy
# Run the application # Run the application
python TESTCASES/web/app.py python ANNOTATE/web/app.py
``` ```
## Usage ## Usage
1. **Start the application**: Run `python TESTCASES/web/app.py` 1. **Start the application**: Run `python ANNOTATE/web/app.py`
2. **Open browser**: Navigate to `http://localhost:8051` 2. **Open browser**: Navigate to `http://localhost:8051`
3. **Select symbol and timeframe**: Choose trading pair and timeframes to display 3. **Select symbol and timeframe**: Choose trading pair and timeframes to display
4. **Navigate to time period**: Use date picker or scroll to find market conditions 4. **Navigate to time period**: Use date picker or scroll to find market conditions
@@ -74,10 +74,10 @@ This sub-project is designed to be self-contained but can be integrated with the
```python ```python
# Import annotation manager in main system # Import annotation manager in main system
from TESTCASES.core.annotation_manager import AnnotationManager from ANNOTATE.core.annotation_manager import AnnotationManager
# Import training simulator # Import training simulator
from TESTCASES.core.training_simulator import TrainingSimulator from ANNOTATE.core.training_simulator import TrainingSimulator
# Use generated test cases in training # Use generated test cases in training
test_cases = annotation_manager.get_test_cases() test_cases = annotation_manager.get_test_cases()

View File

@@ -1,5 +1,5 @@
""" """
TESTCASES Core Module ANNOTATE Core Module
Core business logic for the Manual Trade Annotation UI Core business logic for the Manual Trade Annotation UI
""" """

View File

@@ -39,7 +39,7 @@ class TradeAnnotation:
class AnnotationManager: class AnnotationManager:
"""Manages trade annotations and test case generation""" """Manages trade annotations and test case generation"""
def __init__(self, storage_path: str = "TESTCASES/data/annotations"): def __init__(self, storage_path: str = "ANNOTATE/data/annotations"):
"""Initialize annotation manager""" """Initialize annotation manager"""
self.storage_path = Path(storage_path) self.storage_path = Path(storage_path)
self.storage_path.mkdir(parents=True, exist_ok=True) self.storage_path.mkdir(parents=True, exist_ok=True)

View File

@@ -54,7 +54,7 @@ class TrainingSimulator:
self.training_sessions = {} self.training_sessions = {}
# Storage for training results # Storage for training results
self.results_dir = Path("TESTCASES/data/training_results") self.results_dir = Path("ANNOTATE/data/training_results")
self.results_dir.mkdir(parents=True, exist_ok=True) self.results_dir.mkdir(parents=True, exist_ok=True)
logger.info("TrainingSimulator initialized") logger.info("TrainingSimulator initialized")

Binary file not shown.

View File

@@ -31,9 +31,9 @@ except ImportError as e:
TradingOrchestrator = None TradingOrchestrator = None
get_config = lambda: {} get_config = lambda: {}
# Import TESTCASES modules # Import ANNOTATE modules
testcases_dir = Path(__file__).parent.parent annotate_dir = Path(__file__).parent.parent
sys.path.insert(0, str(testcases_dir)) sys.path.insert(0, str(annotate_dir))
try: try:
from core.annotation_manager import AnnotationManager from core.annotation_manager import AnnotationManager
@@ -45,7 +45,7 @@ except ImportError:
# Load annotation_manager # Load annotation_manager
ann_spec = importlib.util.spec_from_file_location( ann_spec = importlib.util.spec_from_file_location(
"annotation_manager", "annotation_manager",
testcases_dir / "core" / "annotation_manager.py" annotate_dir / "core" / "annotation_manager.py"
) )
ann_module = importlib.util.module_from_spec(ann_spec) ann_module = importlib.util.module_from_spec(ann_spec)
ann_spec.loader.exec_module(ann_module) ann_spec.loader.exec_module(ann_module)
@@ -54,7 +54,7 @@ except ImportError:
# Load training_simulator # Load training_simulator
train_spec = importlib.util.spec_from_file_location( train_spec = importlib.util.spec_from_file_location(
"training_simulator", "training_simulator",
testcases_dir / "core" / "training_simulator.py" annotate_dir / "core" / "training_simulator.py"
) )
train_module = importlib.util.module_from_spec(train_spec) train_module = importlib.util.module_from_spec(train_spec)
train_spec.loader.exec_module(train_module) train_spec.loader.exec_module(train_module)
@@ -82,7 +82,7 @@ class AnnotationDashboard:
static_folder='static' static_folder='static'
) )
# Initialize Dash app # Initialize Dash app (optional component)
self.app = Dash( self.app = Dash(
__name__, __name__,
server=self.server, server=self.server,
@@ -93,13 +93,23 @@ class AnnotationDashboard:
] ]
) )
# Set a simple Dash layout to avoid NoLayoutException
self.app.layout = html.Div([
html.H1("ANNOTATE Dashboard", className="text-center mb-4"),
html.Div([
html.P("This is the Dash component of the ANNOTATE system."),
html.P("The main interface is available at the Flask routes."),
html.A("Go to Main Interface", href="/", className="btn btn-primary")
], className="container")
])
# Initialize core components # Initialize core components
self.data_provider = DataProvider() if DataProvider else None self.data_provider = DataProvider() if DataProvider else None
self.orchestrator = TradingOrchestrator( self.orchestrator = TradingOrchestrator(
data_provider=self.data_provider data_provider=self.data_provider
) if TradingOrchestrator and self.data_provider else None ) if TradingOrchestrator and self.data_provider else None
# Initialize TESTCASES components # Initialize ANNOTATE components
self.annotation_manager = AnnotationManager() self.annotation_manager = AnnotationManager()
self.training_simulator = TrainingSimulator(self.orchestrator) if self.orchestrator else None self.training_simulator = TrainingSimulator(self.orchestrator) if self.orchestrator else None
@@ -114,18 +124,65 @@ class AnnotationDashboard:
@self.server.route('/') @self.server.route('/')
def index(): def index():
"""Main dashboard page""" """Main dashboard page"""
# Get current annotations try:
annotations = self.annotation_manager.get_annotations() # Get current annotations
annotations = self.annotation_manager.get_annotations()
# Prepare template data
template_data = { # Prepare template data
'current_symbol': 'ETH/USDT', template_data = {
'timeframes': ['1s', '1m', '1h', '1d'], 'current_symbol': 'ETH/USDT',
'annotations': [ann.__dict__ if hasattr(ann, '__dict__') else ann 'timeframes': ['1s', '1m', '1h', '1d'],
for ann in annotations] 'annotations': [ann.__dict__ if hasattr(ann, '__dict__') else ann
} for ann in annotations]
}
return render_template('annotation_dashboard.html', **template_data)
return render_template('annotation_dashboard.html', **template_data)
except Exception as e:
logger.error(f"Error rendering main page: {e}")
# Fallback simple HTML page
return f"""
<html>
<head>
<title>ANNOTATE - Manual Trade Annotation UI</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">📝 ANNOTATE - Manual Trade Annotation UI</h1>
<div class="alert alert-info">
<h4>System Status</h4>
<p>✅ Annotation Manager: Active</p>
<p>⚠️ Data Provider: {'Available' if self.data_provider else 'Not Available (Standalone Mode)'}</p>
<p>⚠️ Trading Orchestrator: {'Available' if self.orchestrator else 'Not Available (Standalone Mode)'}</p>
</div>
<div class="row">
<div class="col-md-6">
<h3>Available Features</h3>
<ul>
<li>Manual trade annotation</li>
<li>Test case generation</li>
<li>Annotation export</li>
<li>Training simulation</li>
</ul>
</div>
<div class="col-md-6">
<h3>API Endpoints</h3>
<ul>
<li><code>POST /api/chart-data</code> - Get chart data</li>
<li><code>POST /api/save-annotation</code> - Save annotation</li>
<li><code>POST /api/delete-annotation</code> - Delete annotation</li>
<li><code>POST /api/generate-test-case</code> - Generate test case</li>
<li><code>POST /api/export-annotations</code> - Export annotations</li>
</ul>
</div>
</div>
<div class="text-center mt-4">
<a href="/dash/" class="btn btn-primary">Go to Dash Interface</a>
</div>
</div>
</body>
</html>
"""
@self.server.route('/api/chart-data', methods=['POST']) @self.server.route('/api/chart-data', methods=['POST'])
def get_chart_data(): def get_chart_data():