Esempio n. 1
0
def initialize():
    data = str(run("Excelsior", "C0d3c0n2016", "SECURITIES")). split()
    del data[0]
    print data
    i = 0
    while i < len(data) - 1:
        worth.write(data[i] + ", ")
        dividend.write(data[i] + ", ")
        volatility.write(data[i] + ", ")
        i = i + 4
    worth.write("\n")
    dividend.write("\n")
    volatility.write("\n")
Esempio n. 2
0
def getMaxDiv():

    divs = str(run("Excelsior", "C0d3c0n2016", "SECURITIES")).split()
    del divs[0]
    names = []
    vals = []
    i = 0
    while i < len(divs) - 2:
        names.append(divs[i])
        vals.append(float(divs[i + 2]))
        i+=4

    i = 0
    while i < len(names):
        i+= 1

    index, value = max(enumerate(vals), key=operator.itemgetter(1))

    return names[index], value
Esempio n. 3
0
def bidAskTicker(ticker):
    orderData = run(name, code, "ORDERS " + ticker);
    # print ticker
    # print orderData
    orderData = orderData.split()[1:]
    # print(orderData)
    bidIndices = [i for i, x in enumerate(orderData) if x == "BID"]
    askIndices = [i for i, x in enumerate(orderData) if x == "ASK"]
    maxBid = -1
    lowestAsk = -1
    if(len(askIndices) > 0):
        lowestAsk = orderData[askIndices[0] + 2]
    if(len(bidIndices) > 0):
        maxBid = orderData[bidIndices[0] + 2]
    for i in range(1, len(bidIndices)):
        newBid = float(orderData[bidIndices[i] + 2])
        if(newBid >= maxBid):
            maxBid = newBid
    for i in range(1, len(askIndices)):
        newAsk = float(orderData[askIndices[i] + 2])
        if(newAsk <= lowestAsk):
            lowestAsk = newAsk
    return (maxBid, lowestAsk)
Esempio n. 4
0
def initialize():
    data = str(run("Excelsior", "C0d3c0n2016", "SECURITIES")). split()
    del data[0]
    print data
    i = 0
    while i < len(data) - 1:
        worth.write(data[i] + ", ")
        dividend.write(data[i] + ", ")
        volatility.write(data[i] + ", ")
        i = i + 4
    worth.write("\n")
    dividend.write("\n")
    volatility.write("\n")


initialize()
while True:
    data = str(run("Excelsior", "C0d3c0n2016", "SECURITIES")). split()
    del data[0]
    i = 0
    while i < len(data) - 1:
        worth.write(data[i + 1] + ", ")
        dividend.write(data[i + 2] + ", ")
        volatility.write(data[i + 3] + ", ")
        i += 4
    worth.write("\n")
    dividend.write("\n")
    volatility.write("\n")

Esempio n. 5
0
import clientpy2
a = 1
status = clientpy2.run("a", "a", "STATUS")
status = status.split()
playerx = status[1]
playery = status[2]
#while a == 1:
clientpy2.run("a", "a", "ACCELERATE 0 0.5")
clientpy2.run("a", "a", "ACCELERATE 3.14 1")
clientpy2.run("a", "a", "ACCELERATE 1.57 0.5")
clientpy2.run("a", "a", "ACCELERATE 4.71 1")
print(playerx + " " + playery)
while a == 1:
    status = clientpy2.run("a", "a", "STATUS")
    status = status.split()
    playerx = status[1]
    playery = status[2]
    clientpy2.run("a", "a", "BOMB " + playerx + " " + playery)
    #print(status[6])
#(playerx)
#print(status)
Esempio n. 6
0
def bidAskTicker(ticker):
    orderData = run(name, code, "ORDERS " + ticker);
    # print ticker
    # print orderData
    orderData = orderData.split()[1:]
    # print(orderData)
    bidIndices = [i for i, x in enumerate(orderData) if x == "BID"]
    askIndices = [i for i, x in enumerate(orderData) if x == "ASK"]
    maxBid = -1
    lowestAsk = -1
    if(len(askIndices) > 0):
        lowestAsk = orderData[askIndices[0] + 2]
    if(len(bidIndices) > 0):
        maxBid = orderData[bidIndices[0] + 2]
    for i in range(1, len(bidIndices)):
        newBid = float(orderData[bidIndices[i] + 2])
        if(newBid >= maxBid):
            maxBid = newBid
    for i in range(1, len(askIndices)):
        newAsk = float(orderData[askIndices[i] + 2])
        if(newAsk <= lowestAsk):
            lowestAsk = newAsk
    return (maxBid, lowestAsk)

print bidAskTicker(getMaxDiv()[0])
while True:
    print bidAskTicker(getMaxDiv()[0])
    print run(name, code, "BID " + getMaxDiv()[0] + " " +
     str(float(bidAskTicker(getMaxDiv()[0])[1]) + .05)  + " " +
     str(float(run(name, code, "MY_CASH").split()[1]) / float(bidAskTicker(getMaxDiv()[0])[1]) ) )
Esempio n. 7
0
	def run(self, command):
		return cp.run("jmv", "mrgoose", command)