-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_webapp.py
More file actions
59 lines (48 loc) · 1.84 KB
/
run_webapp.py
File metadata and controls
59 lines (48 loc) · 1.84 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
#!/usr/bin/env python3
"""
Run the Options Analysis Web Application
Simple script to start the Flask web app with proper error handling.
"""
import os
import sys
import argparse
from app import app
def main():
# Parse command line arguments
parser = argparse.ArgumentParser(description='Run Options Analysis Web Application')
parser.add_argument('--port', type=int, default=5001, help='Port to run the server on (default: 5001)')
parser.add_argument('--host', default='0.0.0.0', help='Host to bind to (default: 0.0.0.0)')
args = parser.parse_args()
print("🚀 Starting Options Analysis Web Application")
print("=" * 50)
# Check if data directory exists
if not os.path.exists('data'):
os.makedirs('data')
print("✅ Created data directory")
# Check for .env file
if os.path.exists('.env'):
print("✅ Found .env file")
else:
print("⚠️ No .env file found - running in offline mode")
print(f"\n🌐 Web application will be available at:")
print(f" http://localhost:{args.port}")
print(f" http://127.0.0.1:{args.port}")
print(f"\n📋 Features available:")
print(f" • Live SPY/SPX options analysis")
print(f" • Real-time price fetching (if API key configured)")
print(f" • IV calculator")
print(f" • Price scenario analysis")
print(f" • Greeks comparison")
print(f" • Save/export results")
print(f"\n🔧 To stop the server: Press Ctrl+C")
print("=" * 50)
try:
# Run the Flask app
app.run(debug=True, host=args.host, port=args.port)
except KeyboardInterrupt:
print(f"\n\n👋 Web application stopped by user")
except Exception as e:
print(f"\n❌ Error starting web application: {e}")
sys.exit(1)
if __name__ == '__main__':
main()