コード例 #1
0
ファイル: bot.py プロジェクト: weilza/DigitalTrader
def historicalDirection():
    """
	Prevent: Scenario where sells at local minimum & then price immediately starts going up
	By: If price from one minute ago is lower than price from 5 minutes ago, do not trade.
	This function returns 'DOWN' if this is the case.
	"""
    if not USE_HISTORICAL_DIRECTION:
        return 'OFF'
    p = [float(d['close']) for d in bin.klines(currency, '1m')[-6:-1]]
    direction = sgn(p[-1] - p[-5] - 0.00000002)
    return direction
コード例 #2
0
ファイル: bot.py プロジェクト: zhangarejiu/DigitalTrader
def getDirection():
	p = [float(d['close']) for d in bin.klines(currency, '1m')[-5:-1]]
	direction = sgn(p[-1]-p[-2])
	direction2 = sgn(p[-2]-p[-3])
	if direction == direction2:
		return direction
	elif (direction == 'UP' and direction2 == 'FLAT') or (direction2 == 'UP' and direction == 'FLAT'):
		return 'UP'
	elif (direction == 'DOWN' and direction == 'FLAT') or (direction2 == 'DOWN' and direction == 'FLAT'):
		return 'DOWN'
	else:
		return 'FLAT'
コード例 #3
0
ファイル: bot.py プロジェクト: weilza/DigitalTrader
def instantPriceDirection():
    instantPrice = float(getPrice(currency))
    p = [float(d['close']) for d in bin.klines(currency, '1m')[-6:-1]]
    oneMinuteAgoClosingPrice = p[-1]
    direction = sgn(instantPrice - oneMinuteAgoClosingPrice + 0.00000002)
    return direction
コード例 #4
0
ファイル: bot.py プロジェクト: weilza/DigitalTrader
def sellAtLocalMaximum():
    p = [float(d['close']) for d in bin.klines(currency, '1m')[-35:-3]]
    currentP, pastH = getPrice(currency), deci(max(p))
    return float(currentP) - 0.00000003 > float(pastH), currentP, pastH