if result == "Accepted": print "trade accepted" elif result == "Unsuccesful": print "trade declined" elif result == "Pending": print "trade pending" else: print "not a recognizable order state" while True: for ticker in stockArray: portfolio = robot.getPortfolio() if portfolio[ticker] != 0: trueValue = robot.getTrueValue(ticker) price = robot.getPrice(ticker) increment = abs(trueValue - price) / 3 # bid for 10 percent of the total stock @ market value # bid for 4 percent of total stock @ below market value # bid for 3 percent of total stock @ above market value # bid for 2 percent of total stock @ significantly above market value # bid for 1 percent of total stock @ true value if trueValue / price > 1.05: stockToBuy = 0.2 * robot.getSellVolume(ticker) robot.bid((int)(stockToBuy / 2), price, ticker) stockToBuy /= 2 robot.bid((int)(stockToBuy * 0.4), price - increment, ticker) robot.bid((int)(stockToBuy * 0.3), price + increment, ticker) robot.bid((int)(stockToBuy * 0.2), price + 2 * increment, ticker)
price * 0.95, ticker) if result == 'Accepted': print "trade accepted" elif result == 'Unsuccesful': print "trade declined" elif result == 'Pending': print "trade pending" else: print "not a recognizable order state" while True: for ticker in stockArray: portfolio = robot.getPortfolio() if (portfolio[ticker] != 0): trueValue = robot.getTrueValue(ticker) price = robot.getPrice(ticker) increment = abs(trueValue - price) / 3 #bid for 10 percent of the total stock @ market value #bid for 4 percent of total stock @ below market value #bid for 3 percent of total stock @ above market value #bid for 2 percent of total stock @ significantly above market value #bid for 1 percent of total stock @ true value if trueValue / price > 1.05: stockToBuy = 0.2 * robot.getSellVolume(ticker) robot.bid((int)(stockToBuy / 2), price, ticker) stockToBuy /= 2 robot.bid((int)(stockToBuy * 0.4), price - increment, ticker) robot.bid((int)(stockToBuy * 0.3), price + increment, ticker) robot.bid((int)(stockToBuy * 0.2), price + 2 * increment,