示例#1
0
def showStock():
    """
	displays the stock tool, and the stock analysis
	
	Returns
	-----
	none
	Exceptions
	-----------
	KeyError: Raised when an invalid stock ticker is entered
	
	"""
    print("Please enter a stock Ticker")
    currStock = input()
    currentstock = Stock(currStock, 0, 0, 0)
    currentstock.getInfo()
    stockFile = open("stockinfo.txt", "r")
    stockLines = stockFile.readlines()
    messagebox.showinfo("Stock Info", stockLines)
    stockFile.close()
示例#2
0
from bill import Bill
from stock import Stock
from alpha_vantage.timeseries import TimeSeries
from alpha_vantage.techindicators import TechIndicators
from pprint import pprint

f2 = open("STOCKLIST.txt", "r")
stocks = f2.read().splitlines()
stockindex = [Stock(stocks[i], 0, 0, 0) for i in range(0, stocks.len())]

billOne = Bill("Student Loan", 250, 0.1, 10000)
billOne.showSchedule()
billOne.increasePayment(500)
billOne.showSchedule()
StockOne = Stock("GOOG", 0, 0, 0)
StockOne.getInfo()


def recommend(criteria):

    if (criteria == 1):
        print("finding stocks with highest value")
        for i in range(0, stocks.len()):
            stockindex[i].getInfo()
        stocksByValue = sorted(stocks, key=lambda x: x.value, reverse=True)
        print("The stocks with the best value are:" + stocksByValue[0].name +
              stocksByValue[1].name + stocksByValue[2].name)

    if (criteria == 2):
        print("finding stocks with best trend")
        for i in range(0, stocks.len()):