# import sys import random # sys.path.insert(0, '../') from traderbot import TraderBot #riskFactor represents how risky the bot is in general #it affects both how much money it's willing to wager, and how long it'll wait #before giving up riskFactor = 0.65 #fraction of original price riskFactorMultiplier = 3 robot = TraderBot() stockArray = robot.getSymbols() startingPrice = -1 while (True): #checks if portfolio is empty portfolio = robot.getPortfolio() currentlyOwnedStock = "" stockQuantity = -1 empty = True for stock in stockArray: if portfolio[stock] != 0: empty=False currentlyOwnedStock = stock stockQuantity=portfolio[stock]
#sells it at a random price # import sys import random # sys.path.insert(0, '../') from traderbot import TraderBot #riskFactor represents how risky the bot is in general #it affects both how much money it's willing to wager, and how long it'll wait #before giving up riskFactor = 0.99 #fraction of original price riskFactorMultiplier = 3 robot = TraderBot() stockArray = robot.getSymbols() startingPrice = -1 while (True): #checks if portfolio is empty portfolio = robot.getPortfolio() currentlyOwnedStock = "" stockQuantity = -1 empty = True for stock in stockArray: if portfolio[stock] != 0: empty = False currentlyOwnedStock = stock stockQuantity = portfolio[stock]