本文整理汇总了Python中TicksUtile.create_bars_from_bars方法的典型用法代码示例。如果您正苦于以下问题:Python TicksUtile.create_bars_from_bars方法的具体用法?Python TicksUtile.create_bars_from_bars怎么用?Python TicksUtile.create_bars_from_bars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TicksUtile
的用法示例。
在下文中一共展示了TicksUtile.create_bars_from_bars方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createOneMerge
# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import create_bars_from_bars [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)
示例2: raw_input
# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import create_bars_from_bars [as 别名]
## raw_input('ddd')
## os.system('grep " 16:1" ' + f + ' | head -5 >> newtempf ')
## os.system('grep " 16:2" ' + f + ' | head -5 >> newtempf ')
bararrayin = rpu_rp.CsvToLines('allticks')
laterticks = rpu_rp.CsvToLines('laterticks')
for l in bararrayin:
pass
## print l
print '====='
filemode ='test'
startmode = 'no merge'
durinseconds = 300
dur = '5 mins'
today = 'bla'
arrayout = TicksUtile.create_bars_from_bars(bararrayin,today,sym,dur,durinseconds,startmode,filemode)
## os.system('grep pos tempf | grep slopedn | tail -15 > newtempf ')
## for item in sorted(arrayout):
## print arrayout
for item in arrayout:
## print item
if '16:05:' in str(item):
low = float(item[4])
high = item[3]
date = item[1]
sym = item[0]
## print date,sym, high, low
print 'xxxxx'
# which happended first...violate the high or the low?
示例3: sleep
# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import create_bars_from_bars [as 别名]
controlflag = False
print 'got the order to exit program....!!! <<<'
loopmax = 1
###############
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'