def getLowestOwnedItem(input,key):
    currentMin = {key: float("Inf")}
    minName = ""
    for name in input:
        stock,shares = RecordHistory.hasStock(name)
        if not stock:
            continue
        #print("checking"+name)
        if currentMin[key] > input[name][key]:
            currentMin = input[name]
            minName = name

    return minName