Jan-17-2019, 06:26 PM
(This post was last modified: Jan-17-2019, 06:27 PM by digitalassetjunkie.)
mv = {} def woohoo(): for i in json_data['result']: if i['MarketName'] not in mv: mv[i['MarketName']] = i['Volume'] else: try: DifferenceInVolume = i['Volume'] / mv[i['MarketName']] except ZeroDivisionError: DifferenceInVolume = 0 if DifferenceInVolume >= 1.01: print(i['MarketName'])My objective is to pull data from an API every ?/seconds and add it to a dictionary. I'm then trying to compare that dictionary with the previous scraped dictionary (n-1). This is what I have at the moment and it's only scraping one ['MarketName'] and ['Volume'] at a time rather than the entire list of ['MarketName'] and ['Volume'] in each run through the function.
I hope this makes sense. Any guidance would be much appreciated!