-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_system.py
More file actions
110 lines (90 loc) · 3.23 KB
/
start_system.py
File metadata and controls
110 lines (90 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script de inicialização do sistema organizado
Corrige caminhos automaticamente e inicia o sistema
"""
import os
import sys
from pathlib import Path
# Adicionar pasta core ao path
current_dir = Path(__file__).parent
core_dir = current_dir / "core"
config_dir = current_dir / "config"
sys.path.insert(0, str(core_dir))
sys.path.insert(0, str(current_dir))
# Definir caminhos corretos como variáveis de ambiente
os.environ['CONFIG_PATH'] = str(config_dir)
os.environ['BASE_PATH'] = str(current_dir)
def start_gui():
"""Inicia a interface gráfica"""
try:
# Importar após configurar paths
from core.monitor_gui import MonitorGUIIntegration
print("INICIANDO SISTEMA DE TRADING COM GUI")
print("="*60)
print("📁 Pasta organizada: ✅")
print("⚙️ Configurações: config/")
print("🧠 ML/Análise: ml_analysis/")
print("🔧 Sistema principal: core/")
print("="*60)
# Criar e iniciar integração
integration = MonitorGUIIntegration()
integration.start_with_gui()
except ImportError as e:
print(f"❌ Erro de importação: {e}")
print("💡 Verifique se todos os arquivos estão nas pastas corretas")
except Exception as e:
print(f"❌ Erro: {e}")
def start_cli():
"""Inicia o sistema em linha de comando"""
try:
print("INICIANDO SISTEMA DE TRADING CLI")
print("="*60)
# Importar e executar monitor principal
os.chdir(core_dir)
exec(open('monitor.py').read())
except Exception as e:
print(f"❌ Erro: {e}")
def show_help():
"""Mostra ajuda do sistema"""
print("""
SISTEMA DE TRADING ORGANIZADO
=============================
USO:
python start_system.py gui # Interface gráfica (recomendado)
python start_system.py cli # Linha de comando
python start_system.py help # Esta ajuda
ESTRUTURA ORGANIZADA:
📁 core/ - Sistema principal (monitor.py, GUI, etc.)
📁 config/ - Configurações (credenciais, config ML)
📁 ml_analysis/ - Scripts de análise e ML
📁 tests/ - Testes do sistema
📁 data/ - Dados coletados
📁 lib/ - Bibliotecas e DLLs
📁 docs/ - Documentação
CONFIGURAÇÃO AUTOMÁTICA:
✅ Sistema carrega config/config_ml_amanha.json automaticamente
✅ Credenciais em config/credencial.txt
✅ Thresholds otimizados baseados em dados reais
✅ Trading liberado 24h sem restrição de horário
ANÁLISE ML (OPCIONAL):
python ml_analysis/daily_update_simple.py
""")
def main():
if len(sys.argv) < 2:
print("⚠️ Especifique: gui, cli, ou help")
print("💡 Exemplo: python start_system.py gui")
return
command = sys.argv[1].lower()
if command == 'gui':
start_gui()
elif command == 'cli':
start_cli()
elif command == 'help':
show_help()
else:
print(f"❌ Comando desconhecido: {command}")
print("💡 Use: gui, cli, ou help")
if __name__ == "__main__":
main()