3 Star 5 Fork 4

小白股市历险记/Flask

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.py 26.40 KB
一键复制 编辑 原始数据 按行查看 历史
studyNowHa 提交于 2023-01-21 00:29 . 1.连扳高度统计
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
# -*- coding: utf-8 -*-
"""
@author: david
@software: PyCharm
@file: main.py
@time: 2021/11/18 17:01
@desc:
"""
import _thread
import json
import os
import re
import time
import pandas as pd
from flask import Flask, render_template, request, url_for
from werkzeug.utils import redirect, secure_filename
from data.cls import get_dapan
from data.eastmoney import get_min_line_data_eastmoney, get_all_stock, get_yesterday_zt_pool, get_history_date_eastmoney
from data.getdata import get_now_limit, get_history_limit, get_history_continue_to_harden, get_trend, get_today_trend, \
get_last_date, get_history_date, get_history_trend, get_jihejingjia_limit, oneStocksHistory, wencai_search, \
get_daily_limit_performance, get_daily_limit_performance2, limit_broke, get_history_broke, market_volume, \
twoBoardStocksYesterday, threePlate, fourPlate, threeBoardStocksYesterday, fivePlate, fourBoardStocksYesterday, \
fourBoardStocksYesterdayHistory, threeBoardStocksYesterdayHistory, twoBoardStocksYesterdayHistory, \
fourStocksYesterdayHistory, threeStocksYesterdayHistory, twoStocksYesterdayHistory, oneStocksYesterdayHistory, \
oneBoardStocksYesterdayHistory, limit_broke_history
from data.easyquotation_data import get_stock_data
from data.jrj import statisticsMinutes, statisticsLastMinutes
from data.sina import get_min_line_data
from data.wencai.wencai import wencai_search_ths
from openpyxl_excel import read_excel, update_excel_history, read_excel_only
app = Flask(__name__)
# 首页
@app.route('/') # 接口地址
def _index():
# 接口本身
return render_template('main.html', name=__name__)
# 首页
@app.route('/index') # 接口地址
def index():
# 接口本身
return render_template('综合版面.html', name=__name__)
@app.route('/bubble-gradient') # 接口地址
def bubble_gradient():
# 接口本身
return render_template('bubble-gradient.html', name=__name__)
@app.route('/line-stack') # 接口地址
def line_stack():
# 接口本身
return render_template('line-stack.html', name=__name__)
@app.route('/line-race') # 接口地址
def line_race():
# 接口本身
return render_template('line-race.html', name=__name__)
@app.route('/zhangting') # 接口地址
def zhangting():
# 接口本身
return render_template('zhangting.html', name=__name__)
@app.route('/昨日连板') # 接口地址
def yesterday_limit2():
# 接口本身
return render_template('昨日连板.html', name=__name__)
@app.route('/昨日连板叠加图') # 接口地址
def yesterday_limit2_diejia():
# 接口本身
return render_template('昨日连板叠加图.html', name=__name__)
@app.route('/分时线') # 接口地址
def trend():
# 接口本身
return render_template('分时线.html', name=__name__)
@app.route('/kaipanla') # 接口地址
def kaipanla():
# 接口本身
return render_template('开盘啦-首页.html', name=__name__)
@app.route('/复盘') # 接口地址
def fupan():
# 接口本身
return render_template('复盘.html', name=__name__)
@app.route('/fupan_history') # 接口地址
def fupan_history():
# 接口本身
return render_template('fupan_history.html', name=__name__)
@app.route('/集合竞价') # 接口地址
def jihejingjia():
# 接口本身
return render_template('集合竞价.html', name=__name__)
@app.route('/涨停板') # 接口地址
def limit():
if request.method == 'POST':
pass
return render_template('涨停板.html', name=__name__)
@app.route('/涨停表现散点图') # 接口地址
def _yesterday_zt_pool():
return render_template('涨停表现散点图.html', name=__name__)
# 接收前端的ajax请求
@app.route('/get_yesterday_zt_pool', methods=['POST'])
def _get_yesterday_zt_pool():
"""昨日涨停股票池"""
if request.method == 'POST':
data = []
_data = request.form['data']
_data = get_yesterday_zt_pool(_data)['data']['pool']
for _d in _data:
if _d['zdp']>11:
data.append([_d['ylbc']+(_d['zdp']*0.05), _d['zdp'], _d['amount'], _d['n']])
else:
data.append([_d['ylbc'] + (_d['zdp'] * 0.1), _d['zdp'], _d['amount'], _d['n']])
return {'data': data}
# /test路由 接收前端的ajax请求
@app.route('/test', methods=['POST'])
def my_echart():
# # 连接数据库
# conn = pymysql.connect(host='127.0.0.1', user='root', password='', db='test')
# cur = conn.cursor()
# sql = 'SELECT t.id,t.tdsvalue FROM tvalues t'
# cur.execute(sql)
# u = cur.fetchall()
#
# # 转换成JSON数据格式
# jsonData = {}
# xdays = []
# yvalues = []
#
# for data in u:
# # xdays.append(str(data[0]))
# xdays.append(data[0])
# yvalues.append(data[1])
# print(xdays)
# print(yvalues)
#
# jsonData['xdays'] = xdays
# jsonData['yvalues'] = yvalues
# # json.dumps()用于将dict类型的数据转成str,因为如果直接将dict类型的数据写入json会发生报错,因此将数据写入时需要用到该函数。
# j = json.dumps(jsonData)
#
# cur.close()
# conn.close()
#
# # 在浏览器上渲染my_template.html模板(为了查看输出的数据)
result = get_now_limit()
# print(result)
return result
@app.route('/get_now_limit', methods=['POST'])
def _get_now_limit():
result = get_now_limit()
# print(result)
return {'date': result}
# /history路由 接收前端的ajax请求
@app.route('/history', methods=['POST'])
def history():
if request.method == 'POST':
date = request.form['date']
# print(date)
result = get_history_limit(date)
# print(result)
return result
# 获取历史炸板的股票池
@app.route('/get_history_broke', methods=['POST'])
def _get_history_broke():
if request.method == 'POST':
date = request.form['date']
result = get_history_broke(date)
return result
# 获取昨日连板的股票池
@app.route('/yesterday_limit2', methods=['POST'])
def data_yesterday_limit2():
result = get_history_continue_to_harden()
# print(result)
return result
# 获取昨日连板的股票池
@app.route('/limit2_sort', methods=['POST', 'GET'])
def limit2_sort():
if request.method == 'POST':
result = read_excel_only('excel\\连板接力.xlsx')
return {'data': result}
return render_template('连板接力.html', h1='上传文件')
# 接收前端的ajax请求
@app.route('/trend', methods=['POST'])
def data_trend():
"""获取分时线"""
if request.method == 'POST':
code = request.form['date']
# print(code)
result = get_trend(code)
# print(result)
return result
# 接收前端的ajax请求
@app.route('/stock_trend', methods=['POST'])
def stock_trend():
"""获取分时线"""
if request.method == 'POST':
code = request.form['data']
# print(code)
result = get_trend(code)
# print(result)
return result
# 接收前端的ajax请求
@app.route('/tline', methods=['POST', 'GET'])
def data_t_line():
"""获取今日分时线"""
if request.method == 'POST':
code = request.form['date']
# print(code)
result = get_today_trend(code)
# print(result)
return result
# 接收前端的ajax请求
@app.route('/kline', methods=['POST'])
def data_k_line():
"""获取K线"""
if request.method == 'POST':
code = request.form['date']
# print(code)
result = get_today_trend(code)
# print(result)
return result
# 接收前端的ajax请求
@app.route('/get_min_line_data_sina', methods=['POST'])
def _get_min_line_data_sina():
"""获取股票的分钟数据"""
if request.method == 'POST':
data = request.form['data']
m_data = get_min_line_data(data)['result']['data']
return {'data': m_data}
data_m = [] # 时间
date_p = [] # 涨幅
for data in m_data:
data_m.append(data['m'])
date_p.append(data['p'])
return {'m': data_m, 'p': date_p}
# 接收前端的ajax请求
@app.route('/get_min_line_data_eastmoney', methods=['POST'])
def _get_min_line_data_eastmoney():
"""获取股票的分钟数据"""
if request.method == 'POST':
data = request.form['data']
m_data = get_min_line_data_eastmoney(data)['data']
data_m = [] # 时间
date_p = [] # 涨幅
for data in m_data['trends']:
data_m.append(re.search('([0-9][0-9]:[0-9][0-9])', data).group(0))
p = 100 * ((float(re.findall('([0-9]+\.[0-9]+)', data)[1]) - m_data['preClose']) / m_data['preClose'])
date_p.append(round(p, 2))
return {'m': data_m, 'p': date_p}
# 接收前端的ajax请求
@app.route('/get_multiple_min_line_data_eastmoney', methods=['POST'])
def _get_multiple_min_line_data_eastmoney():
"""获取股票的分钟数据"""
if request.method == 'POST':
data = request.form.getlist('data[]')
days = request.form['days']
list_data = []
for d in data:
m_data = get_min_line_data_eastmoney(d,days)['data']
data_m = [] # 时间
date_p = [] # 涨幅
for _d in m_data['trends']:
data_m.append(re.search('([0-9][0-9]:[0-9][0-9])', _d).group(0))
p = 100 * ((float(re.findall('([0-9]+\.[0-9]+)', _d)[1]) - m_data['preClose']) / m_data['preClose'])
date_p.append(round(p, 2))
list_data.append({'m': data_m, 'p': date_p, 'name': m_data['name']})
return {'data': list_data}
@app.route('/get_all_stock_eastmoney', methods=['POST'])
def _get_all_stock_eastmoney():
"""获取股票的分钟数据"""
if request.method == 'POST':
data = []
_data = get_all_stock()['data']['diff']
for _d in _data:
# 筛选股票 涨幅绝对值大于3%,成交额大于1亿
if _d['f6'] != "-" and _d['f3'] != "-":
if float(_d['f6']) > 100000000 and abs(float(_d['f3'])) > 3:
data.append([_d['f2'], _d['f3'], _d['f6'], _d['f14']])
return {"data": data}
@app.route('/fupan_call_back', methods=['POST']) # 接口地址
def fupan_call_back():
"""返回Excel数据"""
if request.method == 'POST':
# print('fupan_call_back')
date = request.form['date']
# print(date)
ret = read_excel('excel\\' + date + '.xlsx')
ret = {'data': ret}
# print('ret:', ret)
return ret
@app.route('/codes_rise', methods=['POST']) # 接口地址
def codes_rise():
"""查询股票数据返回"""
if request.method == 'POST':
data = str(request.get_data(), encoding='utf-8') # 解码为string
data = json.loads(data)
data = data['data']
# print(data)
result = get_stock_data(data)
# print(result)
return result
@app.route('/last_date', methods=['POST']) # 接口地址
def last_date():
"""上个交易日日期"""
if request.method == 'POST':
# result = get_last_date()
result = get_history_date()[0]
today = time.strftime("%Y-%m-%d", time.localtime()) # 当前日期
if today == result:
result = get_history_date()[1]
# print('上个交易日日期', result)
return {'date': result}
@app.route('/now_date', methods=['POST']) # 接口地址
def now_date():
"""现在日期"""
if request.method == 'POST':
result = get_last_date()
# result = get_date()[0]
# print('现在日期', result)
return {'date': result}
@app.route('/history_date', methods=['POST']) # 接口地址
def history_date():
"""最近几个交易日日期"""
if request.method == 'POST':
# data = request.form['data']
result = get_history_date_eastmoney()
return {'date': result}
@app.route('/px_change_rate', methods=['POST']) # 接口地址
def px_change_rate():
"""历史涨幅"""
if request.method == 'POST':
data = str(request.get_data(), encoding='utf-8') # 解码为string
data = json.loads(data)
# data = data['data']
# print(data)
his_data = get_history_trend(data['code'], data['date'])
if his_data is not None:
if his_data.__contains__('px_change_rate'):
px_change_rate = his_data['px_change_rate']
# print(px_change_rate)
return {'data': px_change_rate}
@app.route('/get_jihejingjia_limit', methods=['POST']) # 接口地址
def _get_jihejingjia_limit():
"""集合竞价"""
if request.method == 'POST':
result = get_jihejingjia_limit()
# result = get_date()[0]
# print(result)
return {'date': result}
@app.route('/上传文件', methods=['POST', 'GET'])
def upload():
if request.method == 'POST':
files = request.files.getlist('file')
base_path = os.path.dirname(__file__) # 当前文件所在路径
for file in files:
filename = secure_filename(file.filename)
upload_path = os.path.join(base_path, 'excel', filename) # 注意:没有的文件夹一定要先创建,不然会提示没有该路径
file.save(upload_path)
# return redirect(url_for('upload'))
return render_template('上传文件.html', h1='上传成功')
return render_template('上传文件.html', h1='上传文件')
@app.route('/更新excel', methods=['POST', 'GET'])
def update_excel():
if request.method == 'POST':
list = request.form
for r in list.items():
_thread.start_new_thread(update_excel_history, (r[1],))
return '更新成功'
return render_template('更新excel.html')
@app.route('/返回excel列表', methods=['POST', 'GET'])
def return_excel_list():
if request.method == 'POST':
path = os.walk('./excel')
excel_list = []
for m_path, dir, filelist in path:
for filename in filelist:
excel_list.append(os.path.join(m_path, filename))
return {'data': excel_list}
@app.route('/search', methods=['POST', 'GET'])
def search():
if request.method == 'POST':
list = request.form['keyword']
df = wencai_search(list)
# return render_template('查询.html', test=ret)
return render_template('查询.html', column_names=df.columns.values, row_data=df.values.tolist(),
link_column="Patient ID", zip=zip)
return render_template('查询.html', name=__name__)
@app.route('/wencai', methods=['POST', 'GET'])
def _wencai():
if request.method == 'POST':
data = request.form['data']
df = wencai_search_ths(data)
str_json = df.to_json(orient='split', force_ascii=False)
json_data = json.loads(str_json)
return {'data': json_data}
@app.route('/searchWencai', methods=['POST', 'GET'])
def searchWencai():
if request.method == 'POST':
data = request.form['data']
exist = request.form.to_dict().get('exist', True)
if exist == 'true':
exist = False
if data is not None:
# print(data)
count = 6
while count > 0:
count = count - 1
df = wencai_search(data, exist)
if df is not None:
break
str_json = df.to_json(orient='split', force_ascii=False)
json_data = json.loads(str_json)
return {'data': json_data}
@app.route('/statistics', methods=['POST', 'GET']) # 数据统计
def statistics():
if request.method == 'POST':
data = request.form['data']
if data is not None:
# print(data)
count = 6
while count > 0:
count = count - 1
df = wencai_search(data)
if df is not None:
break
str_json = df.to_json(orient='split', force_ascii=False)
json_data = json.loads(str_json)
return {'data': json_data}
# if df is not None:
# # df = pd.DataFrame((ret['code'], ret['股票简称'], ret['最新涨跌幅']))
# code = df.pop('股票代码')
# df.insert(0, '股票代码', code)
# code = df.pop('股票简称')
# df.insert(1, '股票简称', code)
# code = df.pop('最新涨跌幅')
# df.insert(2, '最新涨跌幅', code)
# str_json = df.to_json(orient='split', force_ascii=False)
# json_data = json.loads(str_json)
# return {'data': json_data}
return render_template('数据统计.html', name=__name__)
# 最高连板统计
@app.route('/highest_connection_board_statistics', methods=['POST', 'GET']) # 数据统计
def highest_connection_board_statistics():
if request.method == 'POST':
data = request.form['data']
if data is not None:
# print(data)
df = wencai_search(data)
if df is not None:
str_json = df.to_json(orient='split', force_ascii=False)
json_data = json.loads(str_json)
return {'data': json_data}
return render_template('最高连板统计.html', name=__name__)
# 获取涨停表现
@app.route('/get_daily_limit_performance', methods=['POST', 'GET']) # 数据统计
def _get_daily_limit_performance():
if request.method == 'POST':
data = request.form['data']
data = get_daily_limit_performance(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 昨日涨停开盘买入统计
@app.route('/last_day_limit_count', methods=['POST', 'GET']) # 数据统计
def _last_day_limit_count():
return render_template('昨日涨停开盘买入统计.html', name=__name__)
# 获取涨停表现
@app.route('/get_daily_limit_performance2', methods=['POST', 'GET']) # 数据统计
def _get_daily_limit_performance2():
if request.method == 'POST':
data = request.form['data']
data = get_daily_limit_performance2(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史涨停的昨日1板个股
@app.route('/oneStocksHistory', methods=['POST', 'GET']) # 数据统计
def _oneStocksHistory():
if request.method == 'POST':
date = request.form['data']
data = oneStocksHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史涨停的昨日1板个股
@app.route('/oneStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _oneStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = oneStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史未涨停的昨日1板个股
@app.route('/oneBoardStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _oneBoardStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = oneBoardStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 未涨停的昨日二板个股
@app.route('/twoBoardStocksYesterday', methods=['POST', 'GET']) # 数据统计
def _twoBoardStocksYesterday():
if request.method == 'POST':
data = twoBoardStocksYesterday()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史未涨停的昨日二板个股
@app.route('/twoBoardStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _twoBoardStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = twoBoardStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史涨停的昨日二板个股
@app.route('/twoStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _twoStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = twoStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 三连板
@app.route('/threePlate', methods=['POST', 'GET']) # 数据统计
def _threePlate():
if request.method == 'POST':
data = threePlate()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 四连板
@app.route('/fourPlate', methods=['POST', 'GET']) # 数据统计
def _fourPlate():
if request.method == 'POST':
data = fourPlate()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 未涨停的昨日三板个股
@app.route('/threeBoardStocksYesterday', methods=['POST', 'GET']) # 数据统计
def _threeBoardStocksYesterday():
if request.method == 'POST':
data = threeBoardStocksYesterday()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史涨停的昨日三板个股
@app.route('/threeStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _threeStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = threeStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史未涨停的昨日三板个股
@app.route('/threeBoardStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _threeBoardStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = threeBoardStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 四连板
@app.route('/fivePlate', methods=['POST', 'GET']) # 数据统计
def _fivePlate():
if request.method == 'POST':
data = fivePlate()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 未涨停的昨日四板及以上个股
@app.route('/fourBoardStocksYesterday', methods=['POST', 'GET']) # 数据统计
def _fourBoardStocksYesterday():
if request.method == 'POST':
data = fourBoardStocksYesterday()
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史未涨停的昨日四板及以上个股
@app.route('/fourBoardStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _fourBoardStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = fourBoardStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 历史涨停的昨日四板及以上个股
@app.route('/fourStocksYesterdayHistory', methods=['POST', 'GET']) # 数据统计
def _fourStocksYesterdayHistory():
if request.method == 'POST':
date = request.form['data']
data = fourStocksYesterdayHistory(date)
print(data)
return {'data': data[0]}
return render_template('涨停表现.html', name=__name__)
# 炸板股
@app.route('/limit_broke', methods=['POST', 'GET']) # 数据统计
def _limit_broke():
if request.method == 'POST':
data = limit_broke()
return {'data': data}
return render_template('涨停表现.html', name=__name__)
# 炸板股
@app.route('/limit_broke_history', methods=['POST', 'GET']) # 数据统计
def _limit_broke_history():
if request.method == 'POST':
date = request.form['data']
data = limit_broke_history(date)
return {'data': data}
return render_template('涨停表现.html', name=__name__)
# 财联社大盘数据
@app.route('/cls', methods=['POST', 'GET']) # 数据统计
def _cls():
if request.method == 'POST':
data = request.form['data']
count = 6
while count > 0:
count = count - 1
dates = get_history_date(dates=data)
if dates is not None:
break
time.sleep(1)
data = pd.DataFrame()
for date in dates:
_data = pd.DataFrame(get_dapan(date)['data'])
data = data.append(_data)
str_json = data.to_json(orient='split', force_ascii=False)
json_data = json.loads(str_json)
str_json = data.symbol_name.value_counts().to_json(orient='split', force_ascii=False)
counts = json.loads(str_json)
return {'data': json_data, 'counts': counts}
# 市场量能
@app.route('/market_volume', methods=['POST', 'GET']) # 数据统计
def _market_volume():
if request.method == 'POST':
data = market_volume()
return {'data': data}
# 涨跌停1分钟数据统计
@app.route('/statisticsMinutes', methods=['POST', 'GET']) # 数据统计
def _statisticsMinutes():
if request.method == 'POST':
data = statisticsMinutes()
return {'data': data}
# 上个交易日涨跌停1分钟数据统计
@app.route('/statisticsLastMinutes', methods=['POST', 'GET']) # 数据统计
def _statisticsLastMinutes():
if request.method == 'POST':
data = request.form['data']
data = statisticsLastMinutes('./data/dataJRJ/' + data + '.js')
return {'data': data}
# 上个交易日涨跌停1分钟数据统计
@app.route('/get_history_date', methods=['POST', 'GET']) # 数据统计
def _get_history_date():
if request.method == 'POST':
# data = request.form['data']
data = get_history_date_eastmoney()
return {'data': data}
# 登录页
@app.route('/login') # 接口地址
def login():
# 接口本身
return 'login sucess'
@app.route('/test1') # 接口地址
def test1():
# 接口本身
return render_template('查询.html', name=__name__)
@app.route('/涨停复盘') # 接口地址
def testLimit():
# 接口本身
return render_template('涨停复盘.html', name=__name__)
@app.route('/kpl') # 接口地址
def kpl():
# 接口本身
return render_template('开盘啦-中国医药.html', name=__name__)
@app.route('/gdp') # 接口地址
def gdp():
# 接口本身
return render_template('高度票统计显示.html', name=__name__)
# web 服务器
if __name__ == '__main__':
app.debug = True # 设置调试模式,生产模式的时候要关掉debug
app.run(host="0.0.0.0", port=5000)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/ceshijiqi/flask-for-stock.git
git@gitee.com:ceshijiqi/flask-for-stock.git
ceshijiqi
flask-for-stock
Flask
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385