Example #1
0
def runVoter(prices):
	log.debug('beginning rsi voter ...')
	
	starttime = time.time() 
	pool = VoterPool(5, prices)
	
	#calcTickets(pool, 12, 26, 9)
	#calcTickets(pool, 'SMA', 3, 'EMA', 4)
	#calcTickets(pool, 'MA', 7, 'SMA', 13)
	#pool.showVoters()
	#return
	
	for i in range(5, 50):
		calcTickets(pool, prices, i)
		
	pool.showVoters()
Example #2
0
def runVoter(prices):
    log.debug('beginning rsi voter ...')

    starttime = time.time()
    pool = VoterPool(5, prices)

    #calcTickets(pool, 12, 26, 9)
    #calcTickets(pool, 'SMA', 3, 'EMA', 4)
    #calcTickets(pool, 'MA', 7, 'SMA', 13)
    #pool.showVoters()
    #return

    for i in range(5, 50):
        calcTickets(pool, prices, i)

    pool.showVoters()
Example #3
0
def runVoter(in_prices):
	global mas, emas, smas, lwmas, prices
	log.debug('beginning ma voter ...')
	
	prices = in_prices
	ps = [p['close'] for p in prices]
	
	malength = 101
	mas = [0] * malength
	emas = [0] * malength
	smas = [0] * malength
	lwmas = [0] * malength
	for period in range(2, malength):
		if period % 30 == 0: print period
		mas[period] = ma.calc_ma(ps, period)
		emas[period] = ma.calc_ema(ps, period)
		smas[period] = ma.calc_sma(ps, period)
		lwmas[period] = ma.calc_lwma(ps, period)
	
	
	log.debug('running ma voter ...')
	starttime = time.time() 
	matypes = ['MA', 'EMA', 'SMA', 'LWMA']
	
	pool = VoterPool(1, prices)
	#calcTickets(pool, 'SMA', 95, 'LWMA', 240)
	#calcTickets(pool, 'SMA', 3, 'EMA', 4)
	#calcTickets(pool, 'MA', 7, 'SMA', 13)
	#pool.showVoters()
	#return
	
	
	farr = range(5, 30)[::3]
	sarr = range(10, 100)[::5]
	
	for ft, f in [(matype, period) for matype in matypes for period in farr]:
		elapsed = long(time.time() - starttime)
		log.debug('== ' + str(elapsed) + ',' + ft + '_' + str(f) + ' ==')
		for st, s in [(matype, period) for matype in matypes for period in sarr]:
			if s < f: continue
			calcTickets(pool, ft, f, st, s)
	
	pool.showVoters()
Example #4
0
def runVoter(in_prices):
    global mas, emas, smas, lwmas, prices
    log.debug('beginning ma voter ...')

    prices = in_prices
    ps = [p['close'] for p in prices]

    malength = 101
    mas = [0] * malength
    emas = [0] * malength
    smas = [0] * malength
    lwmas = [0] * malength
    for period in range(2, malength):
        if period % 30 == 0: print period
        mas[period] = ma.calc_ma(ps, period)
        emas[period] = ma.calc_ema(ps, period)
        smas[period] = ma.calc_sma(ps, period)
        lwmas[period] = ma.calc_lwma(ps, period)

    log.debug('running ma voter ...')
    starttime = time.time()
    matypes = ['MA', 'EMA', 'SMA', 'LWMA']

    pool = VoterPool(1, prices)
    #calcTickets(pool, 'SMA', 95, 'LWMA', 240)
    #calcTickets(pool, 'SMA', 3, 'EMA', 4)
    #calcTickets(pool, 'MA', 7, 'SMA', 13)
    #pool.showVoters()
    #return

    farr = range(5, 30)[::3]
    sarr = range(10, 100)[::5]

    for ft, f in [(matype, period) for matype in matypes for period in farr]:
        elapsed = long(time.time() - starttime)
        log.debug('== ' + str(elapsed) + ',' + ft + '_' + str(f) + ' ==')
        for st, s in [(matype, period) for matype in matypes
                      for period in sarr]:
            if s < f: continue
            calcTickets(pool, ft, f, st, s)

    pool.showVoters()
Example #5
0
def runVoter(in_prices):
	global mas, emas, smas, lwmas, prices
	log.debug('beginning ma voter ...')
	
	prices = in_prices
	ps = [p['close'] for p in prices]
	
	mas = [0] * 61
	emas = [0] * 61
	smas = [0] * 61
	lwmas = [0] * 61
	for period in range(2, 61):
		mas[period] = ma.calc_ma(ps, period)
		emas[period] = ma.calc_ema(ps, period)
		smas[period] = ma.calc_sma(ps, period)
		lwmas[period] = ma.calc_lwma(ps, period)
	
	
	log.debug('running ma voter ...')
	starttime = time.time() 
	matypes = ['MA', 'EMA', 'SMA', 'LWMA']
	
	pool = VoterPool(2, prices)
	#calcTickets(pool, 'MA', 7, 'EMA', 18)
	#calcTickets(pool, 'SMA', 3, 'EMA', 4)
	#calcTickets(pool, 'MA', 7, 'SMA', 13)
	#pool.showVoters()
	#return
	
	
	farr = range(2, 10)
	sarr = range(4, 60)
	
	for ft, f in [(matype, period) for matype in matypes for period in farr]:
		elapsed = long(time.time() - starttime)
		#log.debug('== ' + str(elapsed) + ',' + ft + '_' + str(f) + ' ==')
		for st, s in [(matype, period) for matype in matypes for period in sarr]:
			if s < f: continue
			calcTickets(pool, ft, f, st, s)
	
	pool.showVoters()
Example #6
0
def runVoter(in_prices):
    global mas, emas, smas, lwmas, prices
    log.debug('beginning ma voter ...')

    prices = in_prices
    ps = [p['close'] for p in prices]

    mas = [0] * 61
    emas = [0] * 61
    smas = [0] * 61
    lwmas = [0] * 61
    for period in range(2, 61):
        mas[period] = ma.calc_ma(ps, period)
        emas[period] = ma.calc_ema(ps, period)
        smas[period] = ma.calc_sma(ps, period)
        lwmas[period] = ma.calc_lwma(ps, period)

    log.debug('running ma voter ...')
    starttime = time.time()
    matypes = ['MA', 'EMA', 'SMA', 'LWMA']

    pool = VoterPool(2, prices)
    #calcTickets(pool, 'MA', 7, 'EMA', 18)
    #calcTickets(pool, 'SMA', 3, 'EMA', 4)
    #calcTickets(pool, 'MA', 7, 'SMA', 13)
    #pool.showVoters()
    #return

    farr = range(2, 10)
    sarr = range(4, 60)

    for ft, f in [(matype, period) for matype in matypes for period in farr]:
        elapsed = long(time.time() - starttime)
        #log.debug('== ' + str(elapsed) + ',' + ft + '_' + str(f) + ' ==')
        for st, s in [(matype, period) for matype in matypes
                      for period in sarr]:
            if s < f: continue
            calcTickets(pool, ft, f, st, s)

    pool.showVoters()
Example #7
0
def runVoter(prices):
	log.debug('beginning macd voter ...')
	
	log.debug('running ma voter ...')
	starttime = time.time() 
	pool = VoterPool(5, prices)
	
	
	#calcTickets(pool, 12, 26, 9)
	#calcTickets(pool, 'SMA', 3, 'EMA', 4)
	#calcTickets(pool, 'MA', 7, 'SMA', 13)
	#pool.showVoters()
	#return
	
	for i in range(2, 30):
		for j in range(5, 60):
			if i > j: continue
			elapsed = long(time.time() - starttime)
			log.debug('== ' + str(elapsed) + ',' + str(i) + '_' + str(j) + ' ==')
			for k in range(2, 30):
				calcTickets(pool, prices, i, j, k)
	
	pool.showVoters()