本文整理汇总了Python中TicksUtile.backupTickfiles方法的典型用法代码示例。如果您正苦于以下问题:Python TicksUtile.backupTickfiles方法的具体用法?Python TicksUtile.backupTickfiles怎么用?Python TicksUtile.backupTickfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TicksUtile
的用法示例。
在下文中一共展示了TicksUtile.backupTickfiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dload
# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import backupTickfiles [as 别名]
def dload(symlist,barlist,strikelist,expirylist):
print symlist
global bar, sym
trans_id = 0
strikelist = [1]
expirylist = [1]
for sym in symlist:
print sym
for bar in barlist:
for strike in strikelist:
for expiry in expirylist:
fname = DataDown+ today + '.' + sym + '.' + bar.replace(' ','')+'.ddload.csv'
TicksUtile.backupTickfiles(fname)
##########
duration = bardict[bar]
barspaced = bardictspaced[bar]
contract = ibutiles.create_contract(sym,strike,expiry)
ticktype = ticktypedict[sym]
print bar, sym, duration,ticktype, barspaced, strike, expiry
tws_conn.reqHistoricalData(trans_id, contract, '', duration, barspaced, ticktype, 0, 2)
trans_id = trans_id + 1
sleep(10)
tmp = DataDown+ today + '.' + 'tempdlfile' + '.ddload.csv'
fname = DataDown+ today + '.' + sym + '.' + bar.replace(' ','')+'.ddload.csv'
shutil.copyfile(tmp,fname)
TicksUtile.throw_out_lastbar(fname)
示例2: reply_handler
# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import backupTickfiles [as 别名]
from ib.opt import Connection, message ##??
#############################
global sym, symbol_list, symdict
########################################
symbol_list = symlistTicker
symTickerIddict ={}
contractdict ={}
symid=0
### backup tick files ####
print symbol_list
for sym in symbol_list:
symid+=1
symTickerIddict.update({str(symid) : sym})
for filename in ['.RTticks.csv','.RTMktDepth.csv','.RTtickData.csv']:
fname1 = DataDown+ today + '.' + sym +filename
TicksUtile.backupTickfiles(fname1)
## flush file
rpu_rp.WriteArrayToCsvfile(fname1,[])
##flush tick files where necessary
rpu_rp.WriteArrayToCsvfile(TMP +'replys.RTticks',[])
rpu_rp.WriteArrayToCsvfile(TMP +'replys.RTtickDOMs',[])
#################
onerow =[]
current_time = datetime.now().time()
timenow=current_time.isoformat()
################
def reply_handler(msg):
msgarray = (str(msg)).split()
print msgarray, 'rawmessg'
reqid=(msgarray[1]).split('=')[1].replace(',','')
fieldnum = (msgarray[2]).split('=')[1].replace(',','')