<s> import click <EOL> class Instrument ( object ) : <EOL> def __init__ ( self , from_curr , to_curr , pip = None , max_trade_units = None ) : <EOL> self . from_curr = from_curr <EOL> self . to_curr = to_curr <EOL> self . pip = pip <EOL> self . max_trade_units = max_trade_units <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . from_curr , self . to_curr ) <EOL> def __repr__ ( self ) : <EOL> return self . __str__ ( ) <EOL> def load ( self , broker ) : <EOL> print "<STR_LIT>" . format ( self . __str__ ( ) ) <EOL> ret = broker . get_instrument_detail ( self . __str__ ( ) ) <EOL> if ret and '<STR_LIT>' in ret : <EOL> for meh in ret [ '<STR_LIT>' ] : <EOL> self . pip = meh [ '<STR_LIT>' ] <EOL> self . max_trade_units = meh [ '<STR_LIT>' ] <EOL> return True <EOL> return False <EOL> class InstrumentParamType ( click . ParamType ) : <EOL> name = '<STR_LIT>' <EOL> def convert ( self , value , param , ctx ) : <EOL> try : <EOL> currencies = value . split ( '<STR_LIT:_>' ) <EOL> assert len ( currencies ) == <NUM_LIT:2> <EOL> return Instrument ( currencies [ <NUM_LIT:0> ] , currencies [ <NUM_LIT:1> ] ) <EOL> except ( AssertionError , ValueError ) : <EOL> self . fail ( '<STR_LIT>' . format ( value ) , param , ctx ) </s>
