anchor.diff:              Brokers
           ),
   
  -        ticker(Listings)
  +        ticker(Listings, Brokers)
       end.
   
   
   %%-----------------------------------------------------------------------------
   %% Function : broker/0
  -%% Purpose  : Initializes empty data containers and starts broker/2.
  +%% Purpose  : Initializes empty data containers and starts broker/3.
   %%-----------------------------------------------------------------------------
   broker() ->
       Portfolio = dict:new(),
       CashFlow = [],
  -    broker(Portfolio, CashFlow).
  +    {registered_name, ProcName} = erlang:process_info(self(), registered_name),
  +    broker(ProcName, Portfolio, CashFlow).
   
   
   %%-----------------------------------------------------------------------------
  -%% Function : broker/2
  +%% Function : broker/3
   %% Purpose  : Receives current prices and either buys or sells.
   %%-----------------------------------------------------------------------------
  -broker(Portfolio, CashFlow) ->
  -    {registered_name, ProcName} = erlang:process_info(self(), registered_name),
  -    CashBalance = lists:sum(CashFlow),
  -
  +broker(ProcName, Portfolio, CashFlow) ->
       receive
           {ticker, {prices, Prices}} ->
   
  
positive.code: 
  %%-----------------------------------------------------------------------------
  %% Function : ticker/0
  %% Purpose  : Generates a set of listings and starts ticker/1.
  %%-----------------------------------------------------------------------------
  ticker() ->
      % Generate listings
  
negative.code: 
              % Print accumulated values to stdout
              NewPortfolioList = dict:to_list(NewPortfolio),
              CashBalance = lists:sum(CashFlow),
              io:format("~p PORTFOLIO:~p~n", [ProcName, NewPortfolioList]),
              io:format("~p CASH BALANCE:~p~n", [ProcName, CashBalance]),
              io:format("~n"),
  
              % Now do it all over again! :)
              broker(ProcName, NewPortfolio, NewCashFlow);
  
          stop ->
              void;
  
          Other ->
              io:format("WARNING! Unexpected message: ~p~n", [Other]),
              broker(ProcName, Portfolio, CashFlow)
      end.
  
  
  