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


Python TicksUtile.recenttick方法代码示例

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


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

示例1: get_vola

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def get_vola():
    reqID =33
    ##contract = ibutiles.create_ticksym(99,sym)
    genericTicks =''
    snapshot = True
    sym = 'SPY'
    contract = contractdict[sym]
    tws_conn.reqMktData(reqID,contract,genericTicks,snapshot)
    #########################################
    symid = 0
    for sym in symbol_list:
        print sym
        underlying = symdict[sym]
        if underlying == 'SPY':
            underPricenew = TicksUtile.recenttick(underlying,'dload')
            optionpricenew = TicksUtile.recenttick(sym,'dload')
            optionprice = 5.00
            underPrice = 200.0
            print underPricenew, optionpricenew
            print typedict[sym]
            ATMstrike = round(underPrice,-2)
            print 'atm', ATMstrike
            if typedict[sym] == 'OPT':
                symid+=1
                contract  = contractdict[sym]
                tws_conn.calculateImpliedVolatility(reqID,contract,optionprice,underPrice)
                reqID +=1        
                sleep(1)
                tws_conn.cancelCalculateImpliedVolatility(reqID)
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:31,代码来源:LiveTickerVola.py

示例2: get_vola

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def get_vola(symbol_list_opts):
    reqID =111
    symid = 0
    for sym in symbol_list_opts:
        if sym != 'SPY':
            print sym
            underlying = symdict[sym]
            if underlying == 'SPY':
                underPricenew =  float(TicksUtile.recenttick(underlying,'1min'))
                optionpricenew = float(TicksUtile.recenttick(sym,'both'))
                optionprice = underPricenew # 5.00
                underPrice = underPricenew #200.0
                
                ticktype = ticktypedict[sym]
                
                ATMstrike = round(underPrice,0)
                
                if 'SPYF' in sym:
                    print sym, underPrice, optionprice, typedict[sym], 'atm', ATMstrike
                    symid+=1
##                    contract  = contractdict[sym]
                    ATMspyoption = ibutiles.create_option_contract(sym,ATMstrike)
##                    tws_conn.reqRealTimeBars(reqID,ATMspyoption,'',ticktype,0)
##                    print rpu_rp.CsvToLines(replyfname)
##                    reqID +=1 
                    tws_conn.calculateImpliedVolatility(reqID,ATMspyoption,optionprice,underPrice)
                    reqID +=1        
                    sleep(1)
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:30,代码来源:VolaCalculate.py

示例3: show_spots

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def show_spots(sym,date,limit,spotfile):
    curprice = float(TicksUtile.recenttick(sym,'recent'))
    spotlines= rpu_rp.CsvToLines(spotfile)
    print 'RangeLineFader is  ',limit,' Handles on ',sym, ' Future'
    for l in spotlines:
        spotp = float(l[0])
        if len(l) > 1 :
##            print l
            spotid = l[1]
            pass
        else:
            spotid=''
        distance = abs(spotp-curprice)
        if (spotp-curprice) > 0:
            underover = 'under'
        else:
            underover = 'over'
        if distance < limit:
##            print curprice-spotp,spotp,curprice,sym,'spot prices',limit
            if underover == 'under':
                print ('SELL at %8.2f %s| %s | %4.2f | %8.2f  ...is this pass #1 or #2?' % (spotp,spotid,sym,distance,curprice))
##                print 'ready to SELL at ',spotp, 'how manypasses?',curprice,sym,distance
            else:
##                print 'ready TO BUY at ',spotp, 'how manypasses?',curprice,sym,distance
                print ('BUY  at %8.2f %s| %s | %4.2f | %8.2f  ...is this pass #1 or #2?' % (spotp,spotid,sym,distance,curprice))
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:27,代码来源:CreateSmain+-+Copy.py

示例4: show_spots

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def show_spots(sym,date,limit):
    curprice = float(TicksUtile.recenttick(sym,'recent'))
    spotfile = libarea + 'spotlines.' + sym+ '.csv'
    spotlines= rpu_rp.CsvToLines(spotfile)
    print limit, ' is limit'
    for l in spotlines:
        spotp = float(l[0])
        distance = abs(spotp-curprice)
        if (spotp-curprice) > 0:
            underover = 'under'
        else:
            underover = 'over'
        if distance < limit:
##            print curprice-spotp,spotp,curprice,sym,'spot prices',limit
            if underover == 'under':
                print 'ready to SELL at ',spotp, 'how manypasses?',curprice,sym,distance
            else:
                print 'ready TO BUY at ',spotp, 'how manypasses?',curprice,sym,distance
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:20,代码来源:RP_CreateSPX.py

示例5: show_spots

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def show_spots(sym,date,limit,spotfile):
    curprice = float(TicksUtile.recenttick(sym,'recent'))
    spotlines= rpu_rp.CsvToLines(spotfile)
    for l in spotlines:
        spotp = float(l[0])
        if len(l) > 1 :
##            print l
            spotid = l[1]
            pass
        else:
            spotid=''
        distance = abs(spotp-curprice)
        if (spotp-curprice) > 0:
            underover = 'under'
        else:
            underover = 'over'
        if distance < limit:
            if underover == 'under':
                sflag = 'SELL'
            else:
                sflag = 'BUY'
            print ('>>%4s at %8.2f %s|%s |%4.2f |%8.2f > pass#? range=%d' % (sflag,spotp,spotid,sym,distance,curprice,limit))
开发者ID:reprior123,项目名称:WEBPY,代码行数:24,代码来源:RunInds.py

示例6: make_bars_just_5sec

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
  #####################
    if btmode != 'BACKTEST':
        make_bars_just_5sec(today,startmode,symbol_list)
        barlist = barlist_Recent
        make_bars_no_5sec(today,startmode,symbol_list,barlist)
        startmode = 'bartobar'
        barlist = barlist_78
        make_bars_no_5sec(today,startmode,symbol_list,barlist)
        barlist = barlist_Recent
        indlist = indlist_part
        make_states(today,symbol_list,barlist,indlist)  #def make_states(date,symbol_list,barlist,indlist):
    ############################  end of bar creation, now run rules....
##    symbol_list = ['ES']
    for sym in symbol_list:
##        print sym
        curprice = float(TicksUtile.recenttick(sym,'recent')) * float((dboostdict[sym]))
        if btmode == 'BACKTEST':
            lbarnum =0
            while lbarnum < btestlimit:
##                print lbarnum,sym
                lbarnum +=1
                currentstates = create_previous_state_array(sym,lbarnum)[0]
                timeloop = create_previous_state_array(sym,lbarnum)[1]
                print timeloop
##                for b in currentstates:
##                    print b
                rulesetoutput = run_rulesets(sym,currentstates,now,curprice)
##                print rulesetoutput
                for r in rulesetoutput:
                    if r[1] != 'nomatch':
                        print r
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:RP_CreateSPX.py

示例7:

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
##################
global timedate_format, nextorderID, date, today,recentlimit, time_format
from time import sleep, strftime, localtime
import  rpu_rp, rpInd, ibutiles, TicksUtile, RP_Snapshot, glob, csv, subprocess, datetime, shutil, time, BarUtiles
from time import sleep, strftime, localtime
import RulesEngine
from datetime import datetime
import ctypes
################
date =  today #'20160219' #yesterday # today  ######## <<<<<<<

style = ''
symlist = ['ES','FDAX']
##symlist = ['ES']#,'FDAX']
for sym in symlist:
    print sym,'========'
    bla =  TicksUtile.recenttick(sym,'recent')
    print bla,' is latest tick'
    flist = [sym+'.RTticks.csv',sym+'.5mins.both.csv']
    for f in flist:
        print f,'===='
        tickfile5 = DataDown + date +'.'+f
        l = rpu_rp.CsvToLines(tickfile5)
        lastlines = rpu_rp.tail_array_to_array(l,5)
        for e in lastlines:
            print e[0],e[1]
##print lastlines

raw_input('close...')

开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:31,代码来源:CheckTickers.py.py

示例8: get_latest_tick

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
def get_latest_tick(sym):
    lasttick = TicksUtile.recenttick(sym,'mode')
    return lasttick
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:5,代码来源:RP_SendSCALES+noattaches.py

示例9: float

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
            sym = lastsig[0]
            profsig = float(lastsig[12])
            tsizesig = float(lastsig[13])
            showdecimal = int(showdecimaldict[sym])
            tside = lastsig[1]
##            profsig = int(lastsig[10])
##            stopsig = profsig * 4
##            stopsig = int(lastsig[11])
##                tsize = (int(tsizedict[sym])* sizemult
            tfactor = float(0.5)
            tsize = int(max(1,(int(tsizedict[sym]) * tfactor))) * sizemult
##            tsize = int(max(1,(int(tsizedict[sym]) * tfactor))) * sizemult
            ttype = 'LIM'
            print 'get latest price'
            print sym
            pricenow = float(TicksUtile.recenttick(sym,'mode'))
##            (get_latest_tick(sym))
            tickvalue = float(tickvaluedict[sym]) 
            ##################################
            print symcontrdict
            if online == 'online':
                symcontract = symcontrdict[sym]
                pass
            else:
                symcontract = 'bla'
            ##################################
######                create_contract(sym,strike,expiry)
            ########################
            profmult = 0.5
            stpmult = 3  ###   <<<<<<<<<
            treverseside = 'SELL'
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:RP_SendSCALES+noattaches.py

示例10: run_indicators

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
############################################
loopmax = 505
loop =0
while loop < loopmax:
    Createlines.create_HAs([sym])
    run_indicators()
    now = datetime.strftime(datetime.now(),spaceYtime_format)
    dur = '5mins'
##    run_oneloop(dur,now,sym)
##    dur = '1min'
##    run_oneloop(dur,now,sym)
    
    factor = 1
    limitlines = 5.0
    if sym == 'FDAX':
        limitlines = 15.0
    curprice = float(TicksUtile.recenttick(sym,'recent'))
    print '###### LINEFADES #### ',curprice ,sym
##    spotfiles = ['spotlines.' + sym,'ES.daily.spotlines2','spotlinesDaily.ES','spotlinesRoundies.' +sym]
    spotfiles = ['spotlines.' + sym,'spotlinesDaily.ES','spotlinesRoundies.' +sym]
    for sp in spotfiles:
        spotfile = libarea + sp +'.csv'           
##        show_spots(sym,date,limitlines,spotfile)
    loop+=1
    sleep(15)
'''
['ES', ' 2016-02-19 22:05:00', '1913.75', '1914.5', '1913.75', '1914.0',
'8603.0', 'full', '300', '0.25', '0.5', '0.0', 'grnNnotailNshortbar']
['ES', ' 2016-02-19 22:30:00', '1914.25', '1914.25', '1913.75', '1914.0', '471.0', 'full', '960', '-0.25', '0.0', '-0.25', 'redNnotailNshortbar']
'''
开发者ID:reprior123,项目名称:WEBPY,代码行数:32,代码来源:RunInds.py

示例11: run_oneloop

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
            #######   
############################################
loopmax = 505
loop =0
while loop < loopmax:
    sym = 'FDAX'
##    sym = 'ES'
    now = datetime.strftime(datetime.now(),spaceYtime_format)
    dur = '5mins'
    run_oneloop(dur,now,sym)
##    dur = '1min'
##    run_oneloop(dur,now,sym)
    factor = 1
    limitlines = 5.0
    
    daxcurprice = float(TicksUtile.recenttick('FDAX','recent'))
    escurprice = float(TicksUtile.recenttick('ES','recent'))
    sym = 'ES'
    print '###### LINEFADE #### ',escurprice ,sym
    spotfile = libarea + 'spotlines.' + sym+ '.csv'
    show_spots(sym,date,limitlines,spotfile)
##    print 'dailies'
##    spotfile = libarea +'ES.daily.spotlines2.csv'
##    show_spots(sym,date,limitlines,spotfile)
    
##    spotfile = libarea +'spotlinesDaily.ES.csv'
##    show_spots(sym,date,limitlines,spotfile)   
    spfile = libarea + 'spotlinesRoundies.' +sym+'.csv'
    show_spots(sym,date,limitlines,spfile)   
##    sym = 'FDAX'
##    limitlines = 15.0
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:HAruletesterFDAX.py

示例12: float

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
        for indline in indlistnew:
            lineval = rpInd.ShowLastBarofInd('ES','1day',indline)[1]
            print lineval,indline
            rpu_rp.WriteArrayToCsvfile(libarea +'ES.daily.spotlines2.csv', [['1','']])            
            rpu_rp.WriteArrayToCsvfileAppend(libarea +'ES.daily.spotlines2.csv', [[lineval,indline]])

##        ask which statesarea lable to use by glob.glob(states area labels...choose one or default to main
##                =================
    ### here ends the first loop tasks ###
            ##################
            ###############
            ##########
    factor = 1
    
    
    daxcurprice = float(TicksUtile.recenttick('FDAX','recent'))
    escurprice = float(TicksUtile.recenttick('ES','recent'))
    sym = 'ES'
    limitlines = 5.0
    print '###### LINEFADES #### ',curprice ,sym
    spotfiles = ['Full.','WBDaily.','Roundies.','AutoPivot.']
    for tag in spotfiles:
        spotfile = libarea + 'Spots' +tag + sym+'.txt'           
        show_spots(sym,date,limitlines,spotfile)    
    sym = 'FDAX'
    limitlines = 15.0

    print '###### LINEFADES #### ',curprice ,sym
    spotfiles = ['Full.','WBDaily.','Roundies.','AutoPivot.']
    for tag in spotfiles:
        spotfile = libarea + 'Spots' +tag + sym+'.txt'           
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:CreateSmain.py

示例13: locals

# 需要导入模块: import TicksUtile [as 别名]
# 或者: from TicksUtile import recenttick [as 别名]
##    print var
    locals()[var] = nd[var]
####################
import  glob, csv, datetime, shutil, subprocess, time
import rpu_rp, rpInd, ibutiles, TicksUtile
############################################
strikelist =['x']
expirylist =['x']
barlist = ['1min']
symlist = ['SPY']
barlist = barlist1min
rpu_rp.WriteArrayToCsvfile('symlist.csv',[symlist])
rpu_rp.WriteArrayToCsvfile('barlist.csv',[barlist])
execfile('HistoricalDataDloadFLEX.py')
##########
strikein = round(float(TicksUtile.recenttick('SPY','both')),0)
print strikein
################
symlist = ['SPYF1'] #symbol_list_opts
strikelist = [strikein]
expirylist = ['20151218']
rpu_rp.WriteArrayToCsvfile('symlist.csv',[symlist])
rpu_rp.WriteArrayToCsvfile('barlist.csv',[barlist])
rpu_rp.WriteArrayToCsvfile('strikelist.csv',[strikelist])
rpu_rp.WriteArrayToCsvfile('expirylist.csv',[expirylist])
execfile('HistoricalDataDloadFLEX.py')
#########
symlist = ['SPYF2'] #symbol_list_opts
expirylist = ['20151120']
rpu_rp.WriteArrayToCsvfile('symlist.csv',[symlist])
rpu_rp.WriteArrayToCsvfile('expirylist.csv',[expirylist])
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:33,代码来源:RunDload.py


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