<s> __author__ = '<STR_LIT>' <EOL> class Account ( object ) : <EOL> def __init__ ( self ) : <EOL> self . _packets = { } <EOL> self . child_accounts = [ ] <EOL> def __getitem__ ( self , ref ) : <EOL> return self . _packets [ ref ] <EOL> def append_request ( self , ref , acct_packet , port_packet ) : <EOL> self . _packets [ ref ] = { '<STR_LIT>' : acct_packet , '<STR_LIT>' : port_packet } <EOL> class AccountPacket ( object ) : <EOL> def __init__ ( self , acct_num , requested = None ) : <EOL> self . acct_num = acct_num <EOL> self . messages = [ ] <EOL> self . add_message ( '<STR_LIT>' ) <EOL> def add_message ( self , msg ) : <EOL> self . messages . append ( msg ) <EOL> class AccountMessage ( object ) : <EOL> def __init__ ( self , key , value , currency ) : <EOL> self . key = key <EOL> self . value = value <EOL> self . currency = currency <EOL> def __repr__ ( self ) : <EOL> self . msg = ( self . key , self . value , self . currency ) <EOL> return str ( self . msg ) <EOL> class PortfolioPacket ( object ) : <EOL> def __init__ ( self , acct_num , requested = None ) : <EOL> self . acct_num = acct_num <EOL> self . messages = [ ] <EOL> self . add_message ( '<STR_LIT>' ) <EOL> def add_message ( self , msg ) : <EOL> self . messages . append ( msg ) <EOL> class PortfolioMessage ( object ) : <EOL> def __init__ ( self , contract , position , marketPrice , marketValue , averageCost , unrealizedPNL , realizedPNL , accountName ) : <EOL> self . contract = contract <EOL> self . position_size = position <EOL> self . market_price = marketPrice <EOL> self . market_value = marketValue <EOL> self . avg_cost = averageCost <EOL> self . unrealized_pnl = unrealizedPNL <EOL> self . realized_pnl = realizedPNL <EOL> self . account_name = accountName <EOL> def __repr__ ( self ) : <EOL> self . msg = { '<STR_LIT>' : self . contract , <EOL> '<STR_LIT>' : self . position_size , <EOL> '<STR_LIT>' : self . market_price , <EOL> '<STR_LIT>' : self . market_value , <EOL> '<STR_LIT>' : self . avg_cost , <EOL> '<STR_LIT>' : self . unrealized_pnl , <EOL> '<STR_LIT>' : self . realized_pnl , <EOL> '<STR_LIT>' : self . account_name } <EOL> return str ( self . msg ) </s>
