-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
60 lines (47 loc) · 1.88 KB
/
main.py
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
import tkinter as tk
from tkinter import ttk, messagebox
from gui.sachiel_ai import SachielAITab
from gui.settings_tab import SettingsTab
from config_manager import config_manager
class MainApp:
def __init__(self):
self.root = tk.Tk()
self.root.title("AI Trading Bot")
self.root.geometry("1200x800")
# Verify credentials on startup
if not config_manager.api_key or not config_manager.secret_key:
messagebox.showwarning(
"Configuration Required",
"Please configure Alpaca API credentials in the Settings tab before trading."
)
self._setup_notebook()
self._create_menu()
def _setup_notebook(self):
"""Create tabbed interface"""
self.notebook = ttk.Notebook(self.root)
# AI Trading Tab
self.ai_tab = SachielAITab(self.notebook)
self.notebook.add(self.ai_tab, text="AI Trading")
# Settings Tab
self.settings_tab = SettingsTab(self.notebook)
self.notebook.add(self.settings_tab, text="Settings")
self.notebook.pack(expand=True, fill="both")
def _create_menu(self):
"""Create main menu bar"""
menu_bar = tk.Menu(self.root)
# File Menu
file_menu = tk.Menu(menu_bar, tearoff=0)
file_menu.add_command(label="Exit", command=self.root.quit)
menu_bar.add_cascade(label="File", menu=file_menu)
# Help Menu
help_menu = tk.Menu(menu_bar, tearoff=0)
help_menu.add_command(label="Documentation")
help_menu.add_command(label="About")
menu_bar.add_cascade(label="Help", menu=help_menu)
self.root.config(menu=menu_bar)
def run(self):
"""Start the application"""
self.root.mainloop()
if __name__ == "__main__":
app = MainApp()
app.run()