예제 #1
0
def runVoter(in_prices):
    global prices, areas, l
    prices = in_prices
    directs, slopes, stds, areas = pool.calc_variants(prices)
    l = len(prices)
    ps = [p['close'] for p in prices]

    mafront, maOps = getMaOps(ps)
    doTrade('MA', mafront, maOps)
    return

    macdfront, macdOps = getMacdOps(prices)
    doTrade('MACD', macdfront, macdOps)
    return

    front = max(mafront, macdfront)
    ops = [0] * l
    for i in range(l):
        if maOps[i] + macdOps[i] >= 2:
            ops[i] = 1
        elif maOps[i] + macdOps[i] <= -2:
            ops[i] = -1

    doTrade('MA', front, ops)
    return
예제 #2
0
파일: l2voter.py 프로젝트: 547872495/pymisc
def runVoter(in_prices):
	global prices, areas, l
	prices = in_prices
	directs, slopes, stds, areas = pool.calc_variants(prices)
	l = len(prices)
	ps = [p['close'] for p in prices]
	
	mafront, maOps = getMaOps(ps)
	doTrade('MA', mafront, maOps)
	return
	
	macdfront, macdOps = getMacdOps(prices)
	doTrade('MACD', macdfront, macdOps)
	return
	
	front = max(mafront, macdfront)
	ops = [0] * l
	for i in range(l):
		if maOps[i] + macdOps[i] >= 2:
			ops[i] = 1
		elif maOps[i] + macdOps[i] <= -2:
			ops[i] = -1
			
	doTrade('MA', front, ops)
	return
예제 #3
0
def runVoter(in_prices):
	global prices, areas, l
	prices = in_prices
	directs, slopes, stds, areas = pool.calc_variants(prices)
	l = len(prices)
	ps = [p['close'] for p in prices]
	
	mafront, maOps = getMaOps(ps)
	doTrade('MA', mafront, maOps)
	return
예제 #4
0
파일: vote.py 프로젝트: ongbe/pymisc
def drawStat(prices):

    l = len(prices)
    directs, slopes, stds, areas = pool.calc_variants(prices)

    dts = [p['dt'] for p in prices]
    ps = [p['close'] for p in prices]
    fig = plt.figure()
    ax1 = fig.add_subplot(211)
    ax1.plot_date(dts, areas, 'r-')
    ax1.set_ylim(-1, 4)
    #ax1.plot_date(dts, stds, 'r-')

    ax2 = fig.add_subplot(212)
    ax2.plot_date(dts, ps, 'b-')

    plt.show()
예제 #5
0
파일: vote.py 프로젝트: 547872495/pymisc
def drawStat(prices):
	
	l = len(prices)
	directs, slopes, stds, areas = pool.calc_variants(prices)
		
	dts = [p['dt'] for p in prices]
	ps = [p['close'] for p in prices]
	fig = plt.figure()
	ax1 = fig.add_subplot(211)
	ax1.plot_date(dts, areas, 'r-')
	ax1.set_ylim(-1, 4)
	#ax1.plot_date(dts, stds, 'r-')
	
	ax2 = fig.add_subplot(212)
	ax2.plot_date(dts, ps, 'b-')
	
	plt.show()