Beispiel #1
0
                                                                   dl=args.dl)
                        # print "%s op:%s ra:%s days:%s  start:%s" % (args.code, op, str(ra), str(days[0]), st)
                        print "op:%s ra:%s days:%s  start:%s" % (op, str(ra), str(days[0]), st)


            elif len(str(args.code)) == 6:
                if args.start is not None and len(args.start) <= 4:
                    args.dl = int(args.start)
                    args.start = None
                start = cct.day8_to_day10(args.start)
                end = cct.day8_to_day10(args.end)
                df = None
                if args.line == 'y' and args.mpl == 'y':
                    code = args.code
                    args.filter = 'n'
                    df=lht.get_linear_model_histogramDouble(code, dtype=args.dtype, start=start, end=end,filter=args.filter, dl=args.dl)
                    # args: code, ptype='low', dtype='d', start=None, end=None, vtype='f', filter='n', df=None,dl=None
                    

                    # t1 = MyThread(lht.get_linear_model_histogramDouble, args=(code,'low', args.dtype, start, end,'f',args.filter,None, args.dl))
                    # t1.start()
                    # t1.join()
                    # df = t1.get_result()
                    # candlestick_powercompute(code,start, end)

                    # op, ra, st, days = pct.get_linear_model_status(code,df=df, start=start, end=end, filter=args.filter)
                    # print "%s op:%s ra:%s  start:%s" % (code, op, ra, st)
                    # print "op:%s ra:%s  start:%s" % (op, ra, st)


                    args.filter = 'y'
             # 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(args.code, start=top_temp.loc[args.code, 'date'],
                                                        end=args.end, vtype=args.vtype,
                                                        filter=args.filter)
             elif input.startswith('q'):
                 break
             else:
                 pass
     elif st.startswith('q') or st.startswith('e'):
         print "exit:%s" % (st)
         sys.exit(0)
     else:
         print "input error:%s" % (st)
 except (IOError, EOFError, Exception) as e:
     print "Error", e
     import traceback
     traceback.print_exc()
     cct.sleeprandom(ct.duration_sleep_time / 2)
Beispiel #3
0
                codew = stf.WriteCountFilter(top_temp, writecount=args.dl)
                if args.code == 'a':
                    cct.write_to_blocknew(block_path, codew)
                    # cct.write_to_blocknew(all_diffpath, codew)
                else:
                    cct.write_to_blocknew(block_path, codew, False)
                    # cct.write_to_blocknew(all_diffpath, codew, False)
                print "wri ok:%s" % block_path
                cct.sleeprandom(ct.duration_sleep_time / 2)

            elif st.startswith('sh'):
                code = st.split()[1]
                # lhg.get_linear_model_histogram(code, args.ptype, args.dtype, start, end, args.vtype, args.filter)
                lhg.get_linear_model_histogram(code,
                                               start=top_temp.loc[code,
                                                                  'ldate'],
                                               vtype='close',
                                               filter='y')
                # raise KeyboardInterrupt()
                while 1:
                    st = cct.cct_raw_input("code:")
                    if len(str(st)) == 6:
                        code = st
                        lhg.get_linear_model_histogram(
                            code,
                            start=top_temp.loc[code, 'ldate'],
                            vtype='close',
                            filter='y')
                    elif st.lower() == 'q':
                        break
                    else: