コード例 #1
0
def futureResults(similarPatterns):
    futureResults = []
    fururePrices = []
    for i in similarPatterns:
        futurePrice = historicData[i[1] + len(currentPattern) + futureDistance]
        futurePrices.append(futurePrice)
        futurePercentage = percentageChange(historicData[i[1] + len(currentPattern)],futurePrice)
        futureResults.append(futurePercentage)
    return futureResults
コード例 #2
0
def futureResults(similarPatterns):
    futureResults = []
    fururePrices = []
    for i in similarPatterns:
        futurePrice = historicData[i[1] + len(currentPattern) + futureDistance]
        futurePrices.append(futurePrice)
        futurePercentage = percentageChange(
            historicData[i[1] + len(currentPattern)], futurePrice)
        futureResults.append(futurePercentage)
    return futureResults
コード例 #3
0
def profitLoss(decision, startIndex, endIndex):
    historicData = settings.historicData
    startPrice = historicData[startIndex]
    endPrice = historicData[endIndex]

    percentChange = percentageChange(startPrice, endPrice)

    if decision == 'HOLD':
        return 0
    if decision == 'BUY':
        return percentChange
    if decision == 'SELL':
        return -percentChange
コード例 #4
0
def futurePercentChanges(similarPatternIndex):

    historicData = settings.historicData
    futureDistance = settings.futureDistance
    patternLength = settings.patternLength
    reqAverageChange = settings.reqAverageChange
    
    futurePercentageChanges = []
    for i in similarPatternIndex:
        currentPrice = historicData[i[0] + patternLength]
        futurePrice = historicData[i[0] + futureDistance + patternLength]
        percentage = percentageChange(currentPrice, futurePrice)
        futurePercentageChanges.append(percentage)

    return futurePercentageChanges