<s> """<STR_LIT>""" <EOL> """<STR_LIT>""" <EOL> from bond_ytm import bond_ytm <EOL> from bond_price import bond_price <EOL> def bond_mod_duration ( price , par , T , coup , freq , dy = <NUM_LIT> ) : <EOL> ytm = bond_ytm ( price , par , T , coup , freq ) <EOL> ytm_minus = ytm - dy <EOL> price_minus = bond_price ( par , T , ytm_minus , coup , freq ) <EOL> ytm_plus = ytm + dy <EOL> price_plus = bond_price ( par , T , ytm_plus , coup , freq ) <EOL> mduration = ( price_minus - price_plus ) / ( <NUM_LIT> * price * dy ) <EOL> return mduration <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> from bond_mod_duration import bond_mod_duration <EOL> print bond_mod_duration ( <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT> ) </s>
