Advertisement
182days

Investment Sentry v1

Mar 3rd, 2019
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. from pandas_datareader.data import get_quote_yahoo
  2.  
  3. increasethreshold = 20
  4. ticker = 'DEB.L'
  5. purprice = 3.2
  6. #liveprice = 1.1
  7. liveprice = get_quote_yahoo(ticker)['price']
  8. print ("Purchase price: ", purprice)
  9. print (liveprice)
  10. if float(purprice) > float(liveprice):
  11.     print ("Negative investment, sleeping...")
  12. else:
  13.     print ("Positive investment, analysing...")
  14.     diff = float(liveprice) - float(purprice)
  15.     print ("Price increase of:", round(diff, 2))
  16.     percentincrease = ((float(diff) / float(purprice) * 100))
  17.     print ("Stock increase of:", round(percentincrease, 2,), "%")
  18.     if (percentincrease) > (increasethreshold):
  19.         print ("Stock", ticker, "has increased past", increasethreshold, "time to sell")
  20.     else:
  21.         print ("Stock", ticker, "has risen but not above", increasethreshold, "hang onto the stock")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement