zoukankan      html  css  js  c++  java
  • 股票信息查询

    序号,代码,名称,最新价,涨跌幅,涨跌额,成交量(手),成交额,振幅,最高,最低,今开,昨收,量比,换手率,市盈率,市净率
    1,300780,N德恩,16.68,44.04%,5.1,403,67.2万,24.01%,16.68,13.9,13.9,11.58,-,0.11%,46.73,2.62
    2,2676,顺威股份,3.69,10.15%,0.34,15.23万,5516万,9.55%,3.69,3.37,3.37,3.35,1.16,2.11%,-,2.58
    3,601619,嘉泽新能,4.91,10.09%,0.45,16.55万,8006万,8.52%,4.91,4.53,4.54,4.46,1.82,3.28%,52.26,3.64
    4,2310,东方园林,5.57,10.08%,0.51,52.66万,2.81亿,9.88%,5.57,5.07,5.08,5.06,1.62,3.23%,-,1.2
    5,2261,拓维信息,6.45,10.07%,0.59,82.2万,5.1亿,9.73%,6.45,5.88,5.93,5.86,1.53,9.28%,150.4,2.85
    6,2696,百洋股份,7.23,10.05%,0.66,38.33万,2.7亿,6.54%,7.23,6.8,7,6.57,5.11,17.97%,97.39,1.31
    7,300366,创意信息,11.06,10.05%,1.01,40.74万,4.39亿,11.74%,11.06,9.88,9.93,10.05,0.7,13.22%,53.3,2.45
    8,603266,天龙股份,13.92,10.04%,1.27,7866,1095万,0.00%,13.92,13.92,13.92,12.65,0.15,1.61%,60.63,3.26
    9,2828,贝肯能源,14.25,10.04%,1.3,17.83万,2.52亿,4.71%,14.25,13.64,13.8,12.95,3.45,18.03%,-,3.08
    10,2725,跃岭股份,12.6,10.04%,1.15,19.37万,2.39亿,6.11%,12.6,11.9,11.9,11.45,0.88,10.97%,35.44,3.39
    11,300262,巴安水务,7.78,10.04%,0.71,16.43万,1.26亿,10.04%,7.78,7.07,7.07,7.07,3.64,3.60%,48.95,2.24
    12,2866,传艺科技,13.81,10.04%,1.26,13.59万,1.83亿,9.72%,13.81,12.59,12.61,12.55,2.63,16.86%,33.37,3.43
    13,300095,华伍股份,7.02,10.03%,0.64,45.69万,3.18亿,8.46%,7.02,6.48,7.02,6.38,7.4,16.59%,35.75,2.29
    14,970,中科三环,12.95,10.03%,1.18,139.1万,17.7亿,11.47%,12.95,11.6,11.68,11.77,2.04,13.06%,77.99,3.06
    15,603693,江苏新能,13.71,10.03%,1.25,4.08万,5545万,4.90%,13.71,13.1,13.1,12.46,0.92,3.46%,37.43,1.88
    16,603727,博迈科,18.65,10.03%,1.7,5万,9315万,1.53%,18.65,18.39,18.65,16.95,2.4,5.27%,291.24,1.84
    17,586,汇源通信,14.59,10.03%,1.33,6.6万,9626万,0.00%,14.59,14.59,14.59,13.26,0.4,3.41%,-,12.1
    18,603697,有友食品,22.73,10.02%,2.07,34.93万,7.68亿,8.23%,22.73,21.03,21.17,20.66,1.4,43.94%,38.1,4.66
    19,300777,中简科技,24.92,10.02%,2.27,5952,1483万,0.00%,24.92,24.92,24.92,22.65,3.45,1.49%,102.24,11.49
    20,300330,华虹计通,13.07,10.02%,1.19,21.23万,2.66亿,13.72%,13.07,11.44,11.6,11.88,1.3,12.66%,6810.83,5.96
    21,300245,天玑科技,11.53,10.02%,1.05,26.86万,3.05亿,9.64%,11.53,10.52,10.52,10.48,1.06,10.35%,127.47,2.57
    22,603628,清源股份,9.11,10.02%,0.83,1.88万,1697万,8.70%,9.11,8.39,8.4,8.28,1.34,2.12%,550.88,2.62
    23,603956,威派格,22.52,10.01%,2.05,18.33万,4.01亿,10.60%,22.52,20.35,20.35,20.47,2.16,43.02%,-,9.82
    24,2428,云南锗业,8.46,10.01%,0.77,69.28万,5.65亿,10.92%,8.46,7.62,7.7,7.69,2.49,10.75%,1546.43,3.71
    25,2953,日丰股份,38.35,10.01%,3.49,2.12万,8131万,0.00%,38.35,38.35,38.35,34.86,0.1,4.93%,84.75,7.56
    26,300391,康跃科技,7.8,10.01%,0.71,3.9万,3027万,10.01%,7.8,7.09,7.09,7.09,0.75,1.94%,27.35,1.89
    27,300526,中潜股份,16.04,10.01%,1.46,5.81万,9195万,6.45%,16.04,15.1,15.18,14.58,2.35,9.68%,390.46,5.01
    28,603079,圣达生物,30.01,10.01%,2.73,1.42万,4085万,9.93%,30.01,27.3,27.3,27.28,1.99,3.88%,59.54,4.24
    29,300779,惠城环保,38.15,10.01%,3.47,1105,421.5万,0.00%,38.15,38.15,38.15,34.68,1.1,0.44%,56.09,5.93
    30,603396,金辰股份,32.42,10.01%,2.95,3.49万,1.1亿,8.25%,32.42,29.99,29.99,29.47,2.23,11.04%,25.89,2.68
    31,603701,德宏股份,20.44,10.01%,1.86,10.17万,2.06亿,6.84%,20.44,19.17,19.77,18.58,1.08,7.12%,46.98,4.18
    32,300775,三角防务,18.25,10.01%,1.66,1688,308万,0.00%,18.25,18.25,18.25,16.59,2.05,0.34%,41.27,5.38
    33,2902,铭普光磁,32.64,10.01%,2.97,15.83万,4.96亿,11.76%,32.64,29.15,30,29.67,2.61,21.90%,122.19,4.28
    34,300722,新余国科,25.39,10.01%,2.31,2.47万,6024万,10.36%,25.39,23,23.2,23.08,1.98,8.84%,120.91,7.37
    35,300746,汉嘉设计,18.35,10.01%,1.67,5.99万,1.09亿,5.04%,18.35,17.51,17.51,16.68,1.65,8.44%,69.51,4.24
    36,300748,金力永磁,59.7,10.01%,5.43,11.02万,6.38亿,6.98%,59.7,55.91,56.88,54.27,0.9,26.49%,234.09,23.54
    37,300767,震安科技,41.13,10.00%,3.74,6.22万,2.49亿,10.32%,41.13,37.27,37.48,37.39,3.86,31.11%,43.32,3.68
    38,603045,福达合金,32,10.00%,2.91,17.06万,5.31亿,9.87%,32,29.13,29.13,29.09,1.39,25.17%,52.74,4.02
    39,2952,亚世光电,58.98,10.00%,5.36,4.18万,2.41亿,7.42%,58.98,55,55.91,53.62,3.04,27.44%,53.09,5.51
    40,603327,福蓉科技,21.56,10.00%,1.96,3586,773.1万,0.00%,21.56,21.56,21.56,19.6,2.81,0.70%,31.97,8.05




    # coding:utf-8
    #1.打开文件,加载内容,把内容转换成dict
    #2.while循环
    f = open(file='stock_data.txt',mode='r',encoding='utf-8')
    stock_data = {}
    query_columns = ['最新价','涨跌幅','换手率']
    columns = f.readline().strip().split(',')
    for line in f:
    line = line.strip().split(',')
    stock_data[line[2]] = line
    f.close()
    while True:
    count = 0
    cmd = input('输入>>:').strip('%')
    if len(cmd) == 0:
    continue
    print(columns)
    for s_name in stock_data:
    if cmd in s_name: #模拟匹配
    print(stock_data[s_name])
    count += 1
    #输入,最新价、涨跌幅、换手率:换手率>20
    #要确保用户输入的要查的列是可允许的。
    #只支持 > and <
    if '>' in cmd:
    q_name,q_val = cmd.split('>')#换手率>20 拆分后 q_name=‘换手率’,q_val=‘20'
    q_name = q_name.strip()
    q_val = float(q_val)
    if q_name in query_columns: #代表 这是支持的可进行查询的列
    q_name_index = columns.index(q_name) #去到这一列对应的下标
    for s_name,s_vals in stock_data.items(): #items()可以同时拿到s_name,s_vals这两个值
    #不知道用户输入的是['最新价','涨跌幅','换手率']中的哪个值
    #解决方案是,拿到q_name去到文件第一行的列名利,去找对应的猎德下标。拿到这个下标后,再循环去到每行取取对应的值
    if float(s_vals[q_name_index].strip('%')) > q_val:
    print(stock_data[s_name])
    count += 1
    elif '<' in cmd:
    q_name, q_val = cmd.split('<') # 换手率<20 拆分后 q_name=‘换手率’,q_val=‘20
    q_name = q_name.strip()
    q_val = float(q_val)
    if q_name in query_columns: # 代表 这是支持的可进行查询的列
    q_name_index = columns.index(q_name) # 去到这一列对应的下标
    for s_name,s_vals in stock_data.items(): # items()可以同时拿到s_name,s_vals这两个值
    # 不知道用户输入的是['最新价','涨跌幅','换手率']中的哪个值
    # 解决方案是,拿到q_name去到文件第一行的列名利,去找对应的猎德下标。拿到这个下标后,再循环去到每行取取对应的值
    if float(s_vals[q_name_index].strip('%')) < q_val:
    print(stock_data[s_name])
    count += 1
    print('匹配%s条数据' % count)




    # coding:utf-8
    f = open(file='stock_data.txt',mode='r',encoding='utf-8')
    stock_data = {}
    query_columns = ['最新价','涨跌幅','换手率'] #query 查询 column 行
    columns = f.readline().strip().split(',')
    for line in f:
    line = line.strip().split(',')
    stock_data[line[2]] = line
    f.close()
    while True:
    count = 0
    user_input = input('输入>>:')
    print(columns)
    if len(user_input) == 0:
    continue
    for q_name in stock_data:
    if user_input in q_name:
    print(stock_data[q_name])
    count += 1
    if '>' in user_input:
    q_name,q_val = user_input.split('>')
    q_name = q_name.strip()
    q_val = float(q_val)
    if q_name in query_columns:
    q_name_index = columns.index(q_name)
    for s_name,s_vals in stock_data.items():
    if float(s_vals[q_name_index].strip('%')) > q_val:
    print(stock_data[s_name])
    count += 1
    elif '<' in user_input:
    q_name, q_val = user_input.split('<')
    q_name = q_name.strip()
    q_val = float(q_val)
    if q_name in query_columns:
    q_name_index = columns.index(q_name)
    for s_name,s_vals in stock_data.items():
    if float(s_vals[q_name_index].strip('%')) < q_val:
    print(stock_data[s_name])
    count += 1
    print('匹配到%s条数据' % count)
     
  • 相关阅读:
    EasyUI dialog
    winform 收集
    ASP.NET文件下载,直接向客户端输出文件(转)
    反射收集
    Sql Server 2008 R2 备份数据库报错
    慎用Ext.QuickTip和Ext.QuickTips(转)
    使用正则Regex来移除网页的ViewState(转)
    mysql 实现远程链接(转)
    MySqlBackup.NET,C# mysql备份数据库
    Firefox下站长统计代码不起作用
  • 原文地址:https://www.cnblogs.com/wzq1997/p/13058263.html
Copyright © 2011-2022 走看看