From 248b465f8feb5bd61b481811291fd153e38a7b2e Mon Sep 17 00:00:00 2001
From: DR-lin-eng <52230594+DR-lin-eng@users.noreply.github.com>
Date: Fri, 28 Feb 2025 01:08:58 +0800
Subject: [PATCH] Add files via upload
---
templates/index.html | 139 +++++++++++++++++++++++++++++++++++++++++++
web_app.py | 39 ++++++++++++
2 files changed, 178 insertions(+)
create mode 100644 templates/index.html
create mode 100644 web_app.py
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..6bd1b55
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+ 股票分析系统
+
+
+
+
+
股票分析系统
+
+
+
+
+
单只股票分析
+
+
+
+
+
+
+
+
+
批量股票分析
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web_app.py b/web_app.py
new file mode 100644
index 0000000..0092432
--- /dev/null
+++ b/web_app.py
@@ -0,0 +1,39 @@
+from flask import Flask, request, jsonify, render_template
+from stock_analyzer import StockAnalyzer
+import os
+
+app = Flask(__name__)
+analyzer = StockAnalyzer()
+
+@app.route('/')
+def index():
+ return render_template('index.html')
+
+@app.route('/api/analyze', methods=['POST'])
+def analyze():
+ try:
+ data = request.json
+ stock_code = data.get('stock_code')
+ if not stock_code:
+ return jsonify({'error': '请提供股票代码'}), 400
+
+ result = analyzer.analyze_stock(stock_code)
+ return jsonify(result)
+ except Exception as e:
+ return jsonify({'error': str(e)}), 500
+
+@app.route('/api/batch-analyze', methods=['POST'])
+def batch_analyze():
+ try:
+ data = request.json
+ stock_list = data.get('stock_list', [])
+ if not stock_list:
+ return jsonify({'error': '请提供股票代码列表'}), 400
+
+ results = analyzer.scan_market(stock_list)
+ return jsonify(results)
+ except Exception as e:
+ return jsonify({'error': str(e)}), 500
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0', port=8443)