insidesherpa / JPMC-tech-task-1

56 stars 352 forks source link

KeyError #147

Closed JKeerthi-21 closed 4 years ago

JKeerthi-21 commented 4 years ago

KeyError

JKeerthi-21 commented 4 years ago

Can someone please help me with this...

AJTopisano commented 4 years ago

@JKeerthi-21 you havent put anything in your dictionary..its empty.. it should look like this if name == "main": for _ in iter(range(N)): quotes = json.loads(urllib.request.urlopen(QUERY.format(random.random())).read()) prices = {}
for quote in quotes: stock, bid_price, ask_price, price = getDataPoint(quote) prices[stock] = price print ("Quoted %s at (bid:%s, ask:%s, price:%s)" % (stock, bid_price, ask_price, price))

print("Ratio %s" % getRatio(prices["ABC"], prices["DEF"]) )  
JKeerthi-21 commented 4 years ago

Okay, thank you...