102 lines
3.1 KiB
Python
Executable File
102 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Quick Start Script
|
|
Easy way to run the trading system with common configurations.
|
|
"""
|
|
|
|
import sys
|
|
import subprocess
|
|
|
|
def install_requirements():
|
|
"""Install required packages"""
|
|
print("Installing requirements...")
|
|
try:
|
|
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
|
print("✓ Requirements installed successfully")
|
|
return True
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"✗ Failed to install requirements: {e}")
|
|
return False
|
|
|
|
def run_test():
|
|
"""Run system test"""
|
|
print("Running system test...")
|
|
try:
|
|
result = subprocess.run([sys.executable, "test_system.py"], capture_output=True, text=True)
|
|
print(result.stdout)
|
|
if result.stderr:
|
|
print("Errors:", result.stderr)
|
|
return result.returncode == 0
|
|
except Exception as e:
|
|
print(f"✗ Test failed: {e}")
|
|
return False
|
|
|
|
def run_backtest():
|
|
"""Run backtesting"""
|
|
print("Running backtest...")
|
|
try:
|
|
result = subprocess.run([sys.executable, "main.py", "--mode", "backtest"],
|
|
capture_output=False, text=True)
|
|
return result.returncode == 0
|
|
except Exception as e:
|
|
print(f"✗ Backtest failed: {e}")
|
|
return False
|
|
|
|
def run_live():
|
|
"""Run live trading"""
|
|
print("Starting live trading (Paper Trading)...")
|
|
print("Press Ctrl+C to stop")
|
|
try:
|
|
result = subprocess.run([sys.executable, "main.py", "--mode", "live"],
|
|
capture_output=False, text=True)
|
|
return result.returncode == 0
|
|
except KeyboardInterrupt:
|
|
print("\nLive trading stopped by user")
|
|
return True
|
|
except Exception as e:
|
|
print(f"✗ Live trading failed: {e}")
|
|
return False
|
|
|
|
def main():
|
|
"""Main menu"""
|
|
print("=" * 50)
|
|
print("AUTOMATED TRADING SYSTEM - QUICK START")
|
|
print("=" * 50)
|
|
|
|
while True:
|
|
print("\nSelect an option:")
|
|
print("1. Install requirements")
|
|
print("2. Run system test")
|
|
print("3. Run backtesting")
|
|
print("4. Start live trading (Paper)")
|
|
print("5. Exit")
|
|
|
|
choice = input("\nEnter your choice (1-5): ").strip()
|
|
|
|
if choice == "1":
|
|
install_requirements()
|
|
elif choice == "2":
|
|
run_test()
|
|
elif choice == "3":
|
|
run_backtest()
|
|
elif choice == "4":
|
|
print("\n⚠️ WARNING: This will start live paper trading!")
|
|
print("Make sure you have:")
|
|
print("- Valid Alpaca paper trading API keys")
|
|
print("- Reviewed the configuration settings")
|
|
print("- Tested with backtesting first")
|
|
|
|
confirm = input("\nContinue? (yes/no): ").strip().lower()
|
|
if confirm in ['yes', 'y']:
|
|
run_live()
|
|
else:
|
|
print("Live trading cancelled")
|
|
elif choice == "5":
|
|
print("Goodbye!")
|
|
break
|
|
else:
|
|
print("Invalid choice. Please enter 1-5.")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|