<s> """<STR_LIT>""" <EOL> from fms . utils . exceptions import MissingParameter , NotAnInteger <EOL> class Agent : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , params , offset = <NUM_LIT:0> ) : <EOL> params = params [ '<STR_LIT>' ] [ offset ] <EOL> for key in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> if not key in params : <EOL> raise MissingParameter , key <EOL> for key in params : <EOL> self . __dict__ [ key ] = params [ key ] <EOL> self . money = float ( self . money ) <EOL> if '<STR_LIT:.>' in str ( self . stocks ) : <EOL> raise NotAnInteger , self . stocks <EOL> self . stocks = int ( self . stocks ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % id ( self ) <EOL> def state ( self ) : <EOL> return "<STR_LIT>" % ( id ( self ) , <EOL> self . money , self . stocks ) <EOL> def speak ( self ) : <EOL> """<STR_LIT>""" <EOL> order = self . act ( ) <EOL> order [ '<STR_LIT>' ] = order . get ( '<STR_LIT>' , self ) <EOL> return order <EOL> def act ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def record ( self , direction , price , quantity ) : <EOL> """<STR_LIT>""" <EOL> if direction : <EOL> self . stocks -= quantity <EOL> self . money += quantity * price <EOL> else : <EOL> self . stocks += quantity <EOL> self . money -= quantity * price </s>
