def count_shares_owned(transactions):
    """
    Sum the totals of buy/sell orders to get a current list of stocks
    owned.
    """
    stocks = {}
    for t in transactions:
        symbol = t.stock.symbol
        stocks.setdefault(symbol, 0)
        stocks[symbol] += t.quantity
        if stocks[symbol] == 0:
            del stocks[symbol]
    return stocks