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
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
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
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