
"""Display stock quotes on LCD"""

from ystockquote import get_price, get_change
from lcd import lcd_string, tn

symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE',
           'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK', 'RTN']

while(True):
    for s in symbols:
        try:
            ticker_string = s + ' ' + get_price(s) + ' ' + get_change(s) + ' '
        except KeyboardInterrupt:
            break
        lcd_string(ticker_string, tn)


"""Display stock quotes on LCD"""

import ystockquote as y
from lcd import lcd_string, tn

symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE',
           'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK',
           'RTN']

def compact_quote(symbol):
    symbol = 'SYK'
    a = y.get_all(symbol)

    L52 = int(round(float(a['fifty_two_week_low']), 0))
    P = round(float(a['price']), 1)
    C = a['change']
    H52 = int(round(float(a['fifty_two_week_high']), 0))
    PE = round(float(a['price_earnings_ratio']), 1)
    Cp = int(round(float(C) / float(P) * 100))

    return '{} {} {}% [{} {}] PE {}'.format(symbol, P, Cp, L52, H52, PE)

while(True):
    try:
        for s in symbols:
            lcd_string(compact_quote(s), tn)
    except KeyboardInterrupt:
        break

Move compact_quote() to main LCD ticker file.
Move compact_quote() to main LCD ticker file.

  
  """Display stock quotes on LCD"""
  
- from ystockquote import get_price, get_change
+ import ystockquote as y
  from lcd import lcd_string, tn
  
  symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE',
-            'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK', 'RTN']
+            'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK',
+            'RTN']
+ 
+ def compact_quote(symbol):
+     symbol = 'SYK'
+     a = y.get_all(symbol)
+ 
+     L52 = int(round(float(a['fifty_two_week_low']), 0))
+     P = round(float(a['price']), 1)
+     C = a['change']
+     H52 = int(round(float(a['fifty_two_week_high']), 0))
+     PE = round(float(a['price_earnings_ratio']), 1)
+     Cp = int(round(float(C) / float(P) * 100))
+ 
+     return '{} {} {}% [{} {}] PE {}'.format(symbol, P, Cp, L52, H52, PE)
  
  while(True):
+     try:
-     for s in symbols:
+         for s in symbols:
+             lcd_string(compact_quote(s), tn)
-         try:
-             ticker_string = s + ' ' + get_price(s) + ' ' + get_change(s) + ' '
-         except KeyboardInterrupt:
+     except KeyboardInterrupt:
-             break
+         break
-         lcd_string(ticker_string, tn)
  
Move compact_quote() to main LCD ticker file.
## Code Before:

"""Display stock quotes on LCD"""

from ystockquote import get_price, get_change
from lcd import lcd_string, tn

symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE',
           'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK', 'RTN']

while(True):
    for s in symbols:
        try:
            ticker_string = s + ' ' + get_price(s) + ' ' + get_change(s) + ' '
        except KeyboardInterrupt:
            break
        lcd_string(ticker_string, tn)

## Instruction:
Move compact_quote() to main LCD ticker file.
## Code After:

"""Display stock quotes on LCD"""

import ystockquote as y
from lcd import lcd_string, tn

symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE',
           'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK',
           'RTN']

def compact_quote(symbol):
    symbol = 'SYK'
    a = y.get_all(symbol)

    L52 = int(round(float(a['fifty_two_week_low']), 0))
    P = round(float(a['price']), 1)
    C = a['change']
    H52 = int(round(float(a['fifty_two_week_high']), 0))
    PE = round(float(a['price_earnings_ratio']), 1)
    Cp = int(round(float(C) / float(P) * 100))

    return '{} {} {}% [{} {}] PE {}'.format(symbol, P, Cp, L52, H52, PE)

while(True):
    try:
        for s in symbols:
            lcd_string(compact_quote(s), tn)
    except KeyboardInterrupt:
        break
