else:
                        print eval(cmd)
            elif st == 'g' or st == 'go':
                status = True
                for code in top_dif[:10].index:
                    code = re.findall('(\d+)', code)
                    if len(code) > 0:
                        code = code[0]
                        kind = sl.get_multiday_ave_compare_silent(code)
            elif st == 'clear' or st == 'c':
                top_all = pd.DataFrame()
                status = False
            elif st == 'w' or st == 'a':
                codew = (top_dif.index).tolist()
                if st == 'a':
                    cct.write_to_blocknew(block_path, codew[:10])
                    # sl.write_to_blocknew(all_diffpath, codew)
                else:
                    cct.write_to_blocknew(block_path, codew[:10], False)
                    # sl.write_to_blocknew(all_diffpath, codew, False)
                print "wri ok:%s" % block_path

                # time.sleep(2)
            else:
                sys.exit(0)
        except (IOError, EOFError, Exception) as e:
            print "Error", e

            traceback.print_exc()
            # raw_input("Except")
                            '999999', dl=int(duration_date))
                        # print duration_date
                        ct.PowerCountdl = duration_date
                    set_duration_console(du_date)
                    time_s = time.time()
                    status = False
                    top_all = pd.DataFrame()
                    lastpTDX_DF = pd.DataFrame()

            elif st.startswith('w') or st.startswith('a'):
                args = cct.writeArgmain().parse_args(st.split())
                codew = stf.WriteCountFilter(top_temp,
                                             duration=duration_date,
                                             writecount=args.dl)
                if args.code == 'a':
                    cct.write_to_blocknew(block_path, codew)
                    # sl.write_to_blocknew(all_diffpath, codew)
                else:
                    cct.write_to_blocknew(block_path, codew, False)
                    # sl.write_to_blocknew(all_diffpath, codew, False)
                print "wri ok:%s" % block_path
                cct.sleeprandom(ct.duration_sleep_time / 2)
            elif st.startswith('sh'):
                while 1:
                    input = cct.cct_raw_input("code:")
                    if len(input) >= 6:
                        args = parser.parse_args(input.split())
                        if len(str(args.code)) == 6:
                            # print args.code
                            if args.code in top_temp.index.values:
                                lhg.get_linear_model_histogram(
Example #3
0
        gold_f = pd.DataFrame(code_l)
        down_f = pd.DataFrame(code_d)
        print("timeSearch:%s" % (time.time() - time_s))
        print("gold:%s %s :%s" % (mk, len(gold_f), gold_f.iloc[:1, 0:2]))
        print("down:%s %s :%s" % (mk, len(down_f), down_f.iloc[:1, 0:2]))
        return gold_f, down_f

    # result = cct.to_mp_run(get_market_status, ['sh', 'sz'])
    # df = pd.DataFrame()
    # for x in result:
    #     df = df.append(x)
    # print len(df)
    # df.iloc[:, 0:2].to_csv('stock-Line-%s.csv'%today, encoding='utf8')
    type = 'l'
    start = '2016-01-18'
    # start = None
    market = 'sh'
    df_u, df_d = get_market_status(market, type, start)
    if not type == 'l':
        if len(df_u) > 0:
            print("Type: %s wri gold:%s %s" % (type, len(df_u.index.tolist()), block_path))
            df_u.iloc[:, 0:2].to_csv(
                'stock-Line-%s.csv' % today, encoding='utf8')
            cct.write_to_blocknew(block_path, df_u.index.tolist(), False)
    else:
        if len(df_u) > 0:
            print("Type: %s wri down:%s %s" % (type, len(df_d.index.tolist()), block_path_d))
            df_d.iloc[:, 0:2].to_csv(
                'stock-Line-down-%s.csv' % today, encoding='utf8')
            cct.write_to_blocknew(block_path_d, df_d.index.tolist(), False)
                    filter = dl[3]
                else:
                    dt = ""
                if len(str(dt)) > 0:
                    if len(str(dt)) < 8:
                        duration_date = tdd.get_duration_price_date("999999", dl=dt, ptype=ptype)
                    else:
                        duration_date = dt
                    top_all = pd.DataFrame()
                    time_s = time.time()
                    status = False
                    lastpTDX_DF = ""
            elif st == "w" or st == "a":
                codew = (top_dd.index).tolist()
                if st == "a":
                    cct.write_to_blocknew(block_path, codew)
                    # sl.write_to_blocknew(all_diffpath, codew)
                else:
                    cct.write_to_blocknew(block_path, codew, False)
                    # sl.write_to_blocknew(all_diffpath, codew, False)
                print "wri ok:%s" % block_path

                # time.sleep(2)
            else:
                sys.exit(0)
        except (IOError, EOFError, Exception) as e:
            print "Error", e
            traceback.print_exc()

"""
{symbol:"sz000001",code:"000001",name:"平安银行",trade:"0.00",pricechange:"0.000",changepercent:"0.000",buy:"12.36",sell:"12.36",settlement:"12.34",open:"0.00",high:"0.00",low:"0",volume:0,amount:0,ticktime:"09:17:55",per:7.133,pb:1.124,mktcap:17656906.355526,nmc:14566203.350486,turnoverratio:0},
Example #5
0
                    code_l.append(df.loc[code, :])
            elif df.loc[code, 'trade'] != 0 and lenday > 200:
                df.loc[code, 'diff'] = abs(diff)
                code_d.append(df.loc[code, :])
        gold_f = pd.DataFrame(code_l).sort_values(by=['diff'], ascending=[0])
        down_f = pd.DataFrame(code_d).sort_values(by=['diff'], ascending=[0])
        print("timeSearch:%s" % (time.time() - time_s))
        print("gold:%s %s :%s" % (mk, len(gold_f), gold_f.iloc[:1, 0:2]))
        print("down:%s %s :%s" % (mk, len(down_f), down_f.iloc[:1, 0:2]))
        return gold_f, down_f
    # result = cct.to_mp_run(get_market_status, ['sh', 'sz'])
    # df = pd.DataFrame()
    # for x in result:
    #     df = df.append(x)
    # print len(df)
    # df.iloc[:, 0:2].to_csv('stock-Line-%s.csv'%today, encoding='utf8')
    type = 'l'
    df_u, df_d = get_market_status('cyb', type)
    if not type == 'l':
        if len(df_u) > 0:
            print("wri gold:%s %s" % (len(df_u.index.tolist()), block_path))
            df_u.iloc[:, 0:2].to_csv(
                'stock-Line-%s.csv' % today, encoding='utf8')
            cct.write_to_blocknew(block_path, df_u.index.tolist(), False)
    else:
        if len(df_u) > 0:
            print("wri down:%s %s" % (len(df_d.index.tolist()), block_path_d))
            df_d.iloc[:, 0:2].to_csv(
                'stock-Line-down-%s.csv' % today, encoding='utf8')
            cct.write_to_blocknew(block_path_d, df_d.index.tolist(), False)