当前位置: 首页>>代码示例>>Python>>正文


Python TicksUtile.convertTime方法代码示例

本文整理汇总了Python中TicksUtile.convertTime方法的典型用法代码示例。如果您正苦于以下问题:Python TicksUtile.convertTime方法的具体用法?Python TicksUtile.convertTime怎么用?Python TicksUtile.convertTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TicksUtile的用法示例。


在下文中一共展示了TicksUtile.convertTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: chopMonthToDays

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import convertTime [as 别名]
def chopMonthToDays(bararray,sym,dur,secs):  ### what does this do?
    lines = bararray
    print secs
    preve = 0
    prevfname = 0
    ubars =[]
    uubars =[]
    diffprev = 1
    daylist =[]
    for l in lines:
        if len(l) > 2:
            timestring = l[1]
            date = timestring[0:11]
            daylist.append(date)
    daylistu = rpu_rp.uniq(daylist)
    for day in daylistu:
        daysarray=[]
        for l in bararray:
            if day in l[1] :
                timestring = l[1]
                try:
                    e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
                except:
                    e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
                diffcur = e - preve
                preve = e
##                print diffcur,timestring
                if diffcur == int(secs):
                    daysarray.append(l)
##                    print l
        print day, sym,dur, len(daysarray)
        fileoutname = DataDown + day +'.' + sym +'.' + dur+'.cleaned.csv' 
        rpu_rp.WriteArrayToCsvfile(fileoutname, daysarray)
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:35,代码来源:CreateBarDbase.py

示例2: run_oneloop

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import convertTime [as 别名]
def run_oneloop(dur,now,sym,date):
    now_epoch = int(time.mktime(time.strptime(now, spaceYtime_format)))
##    print '##### ',now, dur, sym,' ####### '
##    Createlines.create_HAs([sym],date)
    print 'got to clines'
    Createlines.make_both_states([sym],date)
    ##########
    perc = .70
    maxlines = 5
    difflimit = 700
    taglist = ['buy','sell','allxx']
    for tag in taglist:    
        b = showlines(sym,dur,tag)
        print '#############'
        print '>>>>>> ',tag.upper(), 'WINDOW',dur,sym, ' <<<'
        lenha = len(b)
        c=0
        climitlines = int(lenha * perc)
        climit = max((lenha-maxlines),climitlines)
        bar_time = '  2016-02-21 13:16:30'
        for lha in b:
            c+=1
            if tag != 'allxx':
                if len(lha.split('|')) > 2:
                    bar_time = (lha.split('|')[3]).replace(' 201','201')  
                bar_time_epoch =  TicksUtile.convertTime(bar_time,'dashspace','timetoepoch')       
                tdiff =  now_epoch - bar_time_epoch
            else:
                    bar_time_epoch =  TicksUtile.convertTime(bar_time,'dashspace','timetoepoch')          
                    tdiff =  0# now_epoch - bar_time_epoch                
            if c > climit and tdiff < difflimit :
                print lha,'>>> ',tdiff #,difflimit
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:34,代码来源:RunLines+-+Copy.py

示例3: verify_bars

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import convertTime [as 别名]
def verify_bars(barfile):
    fileoutname = 'barsout.csv'
    lines = rpu_rp.CsvToLines(barfile)
    print barfile, 'needs verify'
    dur = barfile.split('.')[2]
    sym = barfile.split('.')[1]
    print dur
    durinseconds = int(secdict[dur])
    print dur, durinseconds
    preve = 0
    prevfname = 0
    ubars =[]
    uubars =[]
    diffprev = 1
    for l in lines:
        if len(l) > 2:
            timestring = l[1]
            e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
            diffcur = e - preve
##            print diffcur
            if diffcur != durinseconds:
                print sym,dur,diffcur, durinseconds,l
                ubars.append(l)
            else:
                pass
            preve = e
            prevline = l
            diffprev = diffcur
    rpu_rp.WriteArrayToCsvfile(fileoutname, ubars)
##    for b in ubars:
##        print b
    return ubars
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:34,代码来源:CreateBarDbase.py

示例4: check_bars

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import convertTime [as 别名]
def check_bars(bararray):  ### what does this do?
    lines = bararray
    preve = 0
    prevfname = 0
    ubars =[]
    uubars =[]
    diffprev = 1
    for l in lines:
        if len(l) > 2:
            timestring = l[1]
            e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
            diffcur = e - preve
##            fname = int(l[7])
            fname = str(l[7])
##            fnamediff = fname - prevfname
            # analyze this bars diff and the previous...
            if diffcur == 0 :
                print l
                '''and diffprev == 0:
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:21,代码来源:CreateBarDbase.py

示例5: get_dload_barsWbu

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import convertTime [as 别名]
def get_dload_barsWbu(start_path,dur,barfileout,sym):
    import TicksUtile   
    total_size = 0
    alllines =[]
    alltimes =[]
    fileoutname = barfileout
    for dirpath, dirnames, filenames in os.walk(start_path):
##        print dirpath
        subdirsize = 0
        for f in filenames:
##            if 'ES.'+dur+'.ddload' in f :
            if '.'+sym+'.'+dur+'.ddload' in f  :
                fp = os.path.join(dirpath, f)
                total_size += os.path.getsize(fp)
##############                print  fp,'working'
                lines = rpu_rp.CsvToLines(fp)
                for l in lines:
                    newl =[]
                    if len(l) > 2:
                        timestring = l[1]
                        e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
##                        fsourcedate = f.replace('.ES.'+dur+'.ddload.csv','')
                        fsourcedate = f.split('.')[0]
                        fsourcesym = f.split('.')[1]
                        fsourcedur = f.split('.')[2]
                        l.append(fsourcedate)
                        l.append(fsourcesym)
                        l.append(fsourcedur)
                        newl.append(l[8])
                        newl.append(l[9])

                        newl.append(l[1])
                        newl.append(l[7])

                        newl.append(l[2])
                        newl.append(l[3])
                        newl.append(l[4])
                        newl.append(l[5])
                        newl.append(l[6])
                        alllines.append(newl)
    from operator import itemgetter, attrgetter, methodcaller
    sortedall = sorted(alllines,key=itemgetter(0,1,2,3),reverse=True)
    usort = rpu_rp.uniqnosort(sortedall)
    prevdur = time = ''
    cleans =[]
    for y in usort:
##        print y
        dur = y[2]
        time = y[3]
        if dur == prevdur and time == prevtime:
##            print y
##            print prevy,'prev'
            pass
        else:
            cleans.append(y)
        prevdur = dur
        prevtime = time
        prevy = y
##    rpu_rp.WriteArrayToCsvfile(fileoutname+'news', cleans)
    newalls=[]
    for n in cleans:
##        print n
        newn =[]
        sym = n[0]
        dur = n[1]
        time = n[2]
        openp = n[4]
        hip = n[5]
        lowp = n[6]
        closep = n[7]
        volu = n[8]
        newn.append(sym)
        newn.append(time)
        newn.append(openp)
        newn.append(hip)
        newn.append(lowp)
        newn.append(closep)
        newn.append(volu)
        newalls.append(newn)
    sortednewalls = sorted(newalls,key=itemgetter(0),reverse=False)
    sortednewallsu = rpu_rp.uniq(sortednewalls)

    sortednewallsuClean = []
    preve = 0
    for l in sortednewallsu:
        timestring = l[1]
        try:
            e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
        except:
            print timestring,' did not work, needs old format'
            e = TicksUtile.convertTime(timestring,'dashspace','timetoepoch')
        diffcur = e - preve
        preve = e
        if diffcur >= int(secs) or '22:30:00'  in timestring:
            sortednewallsuClean.append(l)
        else:
##            print diffcur,timestring,dur,'did not pass test'
            pass
    lenfull = len(sortednewallsuClean)
    third1 = int(round(lenfull/3))
#.........这里部分代码省略.........
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:103,代码来源:CreateBarDbase.py


注:本文中的TicksUtile.convertTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。