Skip to content

Commit

Permalink
fixes the design of the program.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeluisrocha committed Jul 19, 2016
1 parent e80fad4 commit 5970503
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions quotes-real-time.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from googlefinance import getQuotes
from datetime import datetime as dt

quotes = ['AAPL', 'GOOG', 'MSFT', 'TSLA'] ## Here are the quotes desired.
prices = [0,0,0,0] ## Intializes the prices list.
prevtime = [dt.utcnow().minute, dt.utcnow().second, dt.utcnow().microsecond] ## Our comparitor
for i in range(20):
time = [dt.utcnow().minute, dt.utcnow().second, dt.utcnow().microsecond] ## 'Present' time
if time[2] > prevtime[2] or time[1] > prevtime[1]: ## Compares our time
q = getQuotes(quotes)
for j in range(len(q)):
prices[j] = q[j]['LastTradePrice']
print(prices)
prevtime = time
def get_quotes(quotes):
prices = [0,0,0,0,0] ## Intializes the prices list.
prevtime = [dt.utcnow().minute, dt.utcnow().second, dt.utcnow().microsecond] ## Our comparitor
for i in range(20):
time = [dt.utcnow().minute, dt.utcnow().second, dt.utcnow().microsecond] ## 'Present' time
if time[2] > prevtime[2] or time[1] > prevtime[1]: ## Compares our time
q = getQuotes(quotes)
for j in range(len(q)):
prices[j] = q[j]['LastTradePrice']
print(prices)
prevtime = time

if __name__ == "__main__":
quotes = ['AAPL', 'GOOG', 'MSFT', 'TSLA', 'GOOG'] ## Here are the quotes desired.
get_quotes(quotes)

0 comments on commit 5970503

Please sign in to comment.