# Populate the strings and log object lp = logPath + stock + ".log" db = debugPath + stock + ".debug" bp = barChartPath + stock + ".bc" pp = pricesPath + stock + ".pr" tp = testPath + stock + ".tt" pathsChart[stock] = { "logPath": lp, "debugPath": db, "barChartPath": bp, "pricesPath": pp, "testPath": tp } lg[stock] = lpl.Log(debug, verbose, pathsChart[stock]['logPath'], pathsChart[stock]['debugPath'], offLine, testMode) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize algorithm, barcharts objects ba = {} tr = {} lm = {} a = {} pr = {} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Setup connection to the exchange service if service == "bitstamp": cn = lpl.ConnectBitStamp(service, currency, alt)
logPath = clOptions.profileTradeDataPath.replace("profiles", "logs") debugPath = clOptions.profileTradeDataPath.replace("profiles", "debug") barChartPath = clOptions.profileTradeDataPath.replace("profiles", "bc") pricesPath = clOptions.profileTradeDataPath.replace("profiles", "prices") testPath = clOptions.profileTradeDataPath.replace("profiles", "test") logPath = logPath.replace(".json", stock + ".log") debugPath = debugPath.replace(".json", stock + ".debug") barChartPath = barChartPath.replace(".json", stock + ".bc") pricesPath = pricesPath.replace(".json", stock + ".pr") testPath = testPath.replace(".json", stock + ".tt") if service == "eTrade": symbol = stock lg = lpl.Log(debug, verbose, logPath, debugPath, offLine, testMode) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Setup connection to the exchange service if service == "bitstamp": cn = lpl.ConnectBitStamp(service, currency, alt) cn.connectPublic() elif service == "bitfinex": cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock cn = lpl.ConnectEtrade(c, stock, debug, verbose, marketDataType, sandBox, offLine) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resume = 1 preMarketAnalysis = 0 if masterMode: timeBar = 1 d["timeBar"] = "1" if stocksFile != "" and not onlyUpdateDailyStocks: stocks = getAutoStocks(stocksFile, round(maxNumStocksToTrade * stocksFileMultiplier, 2)) elif preMarketAnalysis: logPath = clOptions.profileTradeDataPath.replace("profiles", "logs") # Instantiate the needed objects l = lpl.Log(0, 0, logPath, "/tmp/oo", 0) pr = lpl.Premarket(minuteChartPath, minuteChartExt, dailyChartPath, dailyChartExt, dailyGapExt, bestAlgosPath, bestAlgosExt) tg = lpl.Target(c, d, l) dc = lpl.Dailychart() daysBestStocks = [] if useDaysBest: daysBestStocks = getAutoStocks(useDaysBest, numStocksToProcessInPremarket) print (" stocks after getauto" + str(daysBestStocks)) print (" stocks len after getauto " + str(len(daysBestStocks))) algoData, stocks = analyzeStocks(pf, pr, tg, dc, "pre", useLiveDailyData, stocks, onlyUpdateDailyStocks, numDaysTestData, daysBestStocks) if onlyUpdateDailyStocks: exit (0)
else: logPath = logPath.replace(".json", stock + ".ls") debugPath = debugPath.replace(".json", stock + ".ds") barChartPath = barChartPath.replace(".json", stock + ".bc") print("barChartPath " + barChartPath) pricesPath = pricesPath.replace(".json", stock + ".pr") testPath = testPath.replace(".json", stock + ".tt") print("barChartPath " + barChartPath) if service == "eTrade": symbol = stock lg = lpl.Log(debug, verbose, logPath, debugPath, offLine) #import trade_interface as ti #ti = lpl.TradeInterface({'consumer_key': self.consumer_key, 'consumer_secret' = self.consumerSecret}) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Setup connection to the exchange service stockArr = [] if service == "bitstamp": cn = lpl.ConnectBitStamp(service, currency, alt) cn.connectPublic() elif service == "bitfinex": cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock
logPath = clOptions.profileTradeDataPath.replace("profiles", "logs") debugPath = clOptions.profileTradeDataPath.replace("profiles", "debug") barChartPath = clOptions.profileTradeDataPath.replace("profiles", "bc") pricesPath = clOptions.profileTradeDataPath.replace("profiles", "prices") testPath = clOptions.profileTradeDataPath.replace("profiles", "test") logPath = logPath.replace(".json", stock + ".log") debugPath = debugPath.replace(".json", stock + ".debug") barChartPath = barChartPath.replace(".json", stock + ".bc") pricesPath = pricesPath.replace(".json", stock + ".pr") testPath = testPath.replace(".json", stock + ".tt") if service == "eTrade": symbol = stock lg = lpl.Log(debug, verbose, logPath, slave) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Setup connection to the exchange service stockArr = [] if service == "bitstamp": cn = lpl.ConnectBitStamp(service, currency, alt) cn.connectPublic() elif service == "bitfinex": cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock stockArr.append(stock) cn = lpl.ConnectEtrade(c, stockArr, debug, verbose, marketDataType, sandBox, slave)