code: def portfolio_from_orders(orders, funds=1e5, price_type='close'):
      
      portfolio = orders.copy()
      prices = price_dataframe(orders.columns, start=orders.index[0], end=orders.index[-1],
                               price_type=price_type, cleaner=clean_dataframe)
      portfolio["$CASH"] = funds - (orders * prices).sum(axis=1).cumsum()
      portfolio["total_value"] = portfolio["$CASH"] + (orders.cumsum() * prices).sum(axis=1)
      return portfolio
docs: Create a DataFrame of portfolio holdings (#'s' of shares for the symbols and dates)
  
      Appends the "$CASH" symbol to the porfolio and initializes it to `funds` indicated.
      Appends the symbol "total_value" to store the total value of cash + stocks at each timestamp.
  
      The symbol holdings are found by multipling each element of the orders matrix by the 
      price matrix for those symbols and then computing a cumulative sum of those purchases.
      
          portfolio["$CASH"] = funds - (orders * prices).sum(axis=1).cumsum()
          portfolio["total_value"] = portfolio["$CASH"] + (orders.cumsum() * prices).sum(axis=1)