cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock cn = lpl.ConnectEtrade(c, stocks, debug, verbose, marketDataType, sandBox, offLine) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize algorithm, barcharts objects stocks = stocks.split(",") for stock in stocks: ba[stock] = lpl.Barchart() tr[stock] = lpl.Trends(d, lg[stock], cn, ba[stock], offLine, stock) lm[stock] = lpl.Limits(d, lg[stock], cn, ba[stock], offLine, stock) a[stock] = lpl.Algorithm(d, lg[stock], cn, ba[stock], tr[stock], lm[stock], offLine, stock) pr[stock] = lpl.Price(a[stock], cn, usePricesFromFile, offLine, a[stock].getMarketBeginTime()) print(str(ba)) print(str(a)) lg1 = lg[stocks[0]] a1 = a[stocks[0]] tr1 = tr[stocks[0]] lm1 = lm[stocks[0]] pr1 = pr[stocks[0]] #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize files
# exit (1) # profileData[stock] = loadProfileData(clOptions.profileTradeDataPath) # else: # # Use default list # profileData[stock] = d profileData[stock] = pf.readProfile(clOptions.profileTradeDataPath) #profileData[stock] = loadProfileData(clOptions.profileTradeDataPath) ba[stock] = lpl.Barchart() tr[stock] = lpl.Trends(profileData[stock], lg[stock], cn, ba[stock], offLine, stock) lm[stock] = lpl.Limits(profileData[stock], lg[stock], cn, ba[stock], pf, stock) pr[stock] = lpl.Price(cn, offLine) pa[stock] = lpl.Pattern(profileData[stock], ba[stock], lg[stock]) dc = lpl.Dailychart() dy = lpl.Dynamic(timeBar, dcPath, dc) a[stock] = lpl.Algorithm(profileData[stock], lg[stock], cn, ba[stock], tr[stock], lm[stock], pa[stock], pr[stock], dy, offLine, stock) ut = lpl.Util() th = lpl.Thred(ut, offLine, cwd, wcwd) lg1 = lg[stocks[0]] a1 = a[stocks[0]] tr1 = tr[stocks[0]] lm1 = lm[stocks[0]] pr1 = pr[stocks[0]] pa1 = pa[stocks[0]] #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Set end time if str(cn.getDateMonthDayYear()) in halfDays: lastMinuteOfLiveTrading = int(halfDayEndTime)
cn.connectPublic() elif service == "bitfinex": cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock cn = lpl.ConnectEtrade(c, stock, debug, verbose, marketDataType, sandBox, offLine) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize algorithm, barcharts objects bc = lpl.Barchart() tr = lpl.Trends(d, lg, cn, bc, offLine) lm = lpl.Limits(d, lg, cn, bc, offLine) pa = lpl.Pattern() a = lpl.Algorithm(d, lg, cn, bc, tr, lm, pa, offLine, stock) pr = lpl.Price(a, cn, usePricesFromFile, offLine, a.getMarketBeginTime()) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize files lg.info("Using " + pricesPath + " as prices file") with open(debugPath, "a+", encoding="utf-8") as debugFile: debugFile.write( lg.infoStamp(a.getLiveProfileValues(d, clOptions.profileTradeDataPath))) debugFile.write(lg.header(tm.now(), stock)) lg.info("Using " + debugPath + " as debug file")
cn = lpl.ConnectBitFinex() elif service == "eTrade": symbol = stock stockArr.append(stock) cn = lpl.ConnectEtrade(c, stockArr, debug, verbose, marketDataType, sandBox, slave) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize algorithm, barcharts objects bc = lpl.Barchart() tr = lpl.Trends(d, lg, cn, bc, slave) lm = lpl.Limits(d, lg, cn, bc, slave, symbol) pa = lpl.Pattern(d, bc) pr = lpl.Price(cn, slave) a = lpl.Algorithm(d, lg, cn, bc, tr, lm, pa, pr, slave, stock) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize files lg.info("Using " + pricesPath + " as prices file") with open(debugPath, "a+", encoding="utf-8") as debugFile: debugFile.write( lg.infoStamp(a.getLiveProfileValues(d, clOptions.profileTradeDataPath))) debugFile.write(lg.header(tm.now(), stock)) lg.info("Using " + debugPath + " as debug file") with open(logPath, "a+", encoding="utf-8") as logFile: