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


Python TicksUtile.merge_bar_files方法代码示例

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


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

示例1: createOneMerge

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import merge_bar_files [as 别名]
def createOneMerge(dur,now,sym,date):
    now_epoch = int(time.mktime(time.strptime(now, spaceYtime_format)))
##    print '##### ', dur, sym,' ####### '
    durinseconds= secdict[dur]
    basisdur = '1min'
    if dur == '1min':
        basisdur ='5secs'
    basisfile = DataDown +date+'.'+sym+'.'+basisdur+'.both.csv' ### this bit not used yet until expand startmode
    basisbars = rpu_rp.CsvToLines(basisfile)
##    print'creating bars'   
    recentbars = TicksUtile.create_bars_from_bars(basisbars,date,sym,dur,durinseconds,'noHA')
##    print 'done creating bars'
    filerecent = DataDown +date+'.'+sym+'.'+dur.replace(' ','')+'.recent' +'.csv'
    rpu_rp.WriteArrayToCsvfile(filerecent,recentbars)
    ## now merge recent and both
    fileddload = filerecent.replace('recent','ddload')
    outfile = filerecent.replace('recent','both')
    cutoffmintime = int(int(durinseconds) - 5)
    if os.path.isfile(filerecent):
        TicksUtile.merge_bar_files(filerecent,fileddload,outfile,cutoffmintime)
    else:
        shutil.copyfile(fileddload,outfile)
##        print 'found no ddload file so did no merge'
        ##########
    basisfile = DataDown +date+'.'+sym+'.'+dur+'.both.csv' ### note the basis dur changed to just dur!!
    basisbars = rpu_rp.CsvToLines(basisfile)
    HAbars = TicksUtile.create_bars_from_bars(basisbars,date,sym,dur,durinseconds,'hamode')
##    print 'done creating HA bars'
    fileHABoth = DataDown +date+'.'+sym+'.'+dur.replace(' ','')+'.bothHA' +'.csv'
    rpu_rp.WriteArrayToCsvfile(fileHABoth,HAbars)
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:32,代码来源:RunLines+-+Copy.py

示例2: sleep

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import merge_bar_files [as 别名]
    ###############
    loop +=1
    sleep(cycledelay)
##    print command,'com setting timedrift..pricedrift',now
    recentsigs =[]
    rpu_rp.WriteArrayToCsvfile(sigarea +today+'.sigs.csv', []) # flush the file to keep all sigs
    for sym in symbol_list:      
        rpu_rp.WriteArrayToCsvfile(sigarea +sym+'.sigs.csv', []) # flush the file to keep all sigs
        ## merge the 5secddload with 5sec recents > 5sec boths
        RTticksFile = DataDown +today+'.'+sym+ '.RTticks.csv'
        RTBarsin = rpu_rp.CsvToLines(RTticksFile)
        RTTickBarsReformatted = TicksUtile.format_RTTicks_to_5secBars(RTBarsin,sym)
        RTBars5Sec = TicksUtile.create_bars_from_bars(RTTickBarsReformatted,today,sym,'5 secs',1) ##RTticks > RTbars[5secRecentBars]
##        print '5sec bars done'
        filetomerge = DataDown +today+'.'+sym+'.'+'5 secs'+'.ddload.csv' #. .. only really need to do this once..test for recent file?
        TicksUtile.merge_bar_files(filetomerge)  #this creates the both file
##        print 'finish tick rewrite'
        ####################################
        for barsize in barlist :#[barlist[0]]:
            timeframe = bardict[barsize]
            durinseconds = secdict[barsize]
            barsizeNtimeframe = timeframe + barsize
            decimalboost = dboostdict[sym]
            dur = barsize
            
            TicksUtile.create_bars_from_bars(RTBars5Sec,today,sym,dur,durinseconds) ## writes recent
            ## merge  the dur ddload with  dur recents > dur boths
            filetomerge = DataDown +today+'.'+sym+'.'+dur+'.ddload.csv'
            TicksUtile.merge_bar_files(filetomerge)  #this creates the both file   
            lines = rpu_rp.CsvToLines( DataDown+ today + '.'+sym+'.' + dur + '.both.csv')          
####################          
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:RPTraderV1.py


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