Esempio n. 1
0
print "Array Size", size

randomStockIdx = random.randint(0, size - 1)
randomStock = stockArray[randomStockIdx]

print "random stock ticker:", randomStock

price = robot.getPrice(randomStock)

print "stock price:", price

money = robot.getFunds()

maxShares = 100

confirmation = robot.buy(randomStock, maxShares)

if (confirmation == 1):
    print "buy confirmed"
else:
    print "buy failed"
    
portfolio = robot.getPortfolio()

print "Portfolio before selling:"

print portfolio

confirmation = robot.sell(randomStock, maxShares)

if (confirmation == 1):
Esempio n. 2
0
print "Array Size", size

randomStockIdx = random.randint(0, size - 1)
randomStock = stockArray[randomStockIdx]

print "random stock ticker:", randomStock

price = robot.getPrice(randomStock)

print "stock price:", price

money = robot.getFunds()

maxShares = 100

confirmation = robot.buy(randomStock, maxShares)

if (confirmation == 1):
    print "buy confirmed"
else:
    print "buy failed"

portfolio = robot.getPortfolio()

print "Portfolio before selling:"

print portfolio

confirmation = robot.sell(randomStock, maxShares)

if (confirmation == 1):