<s> """<STR_LIT>""" <EOL> """<STR_LIT>""" <EOL> import math <EOL> class StockOption ( object ) : <EOL> def __init__ ( self , S0 , K , r , T , N , params ) : <EOL> self . S0 = S0 <EOL> self . K = K <EOL> self . r = r <EOL> self . T = T <EOL> self . N = max ( <NUM_LIT:1> , N ) <EOL> self . STs = None <EOL> """<STR_LIT>""" <EOL> self . pu = params . get ( "<STR_LIT>" , <NUM_LIT:0> ) <EOL> self . pd = params . get ( "<STR_LIT>" , <NUM_LIT:0> ) <EOL> self . div = params . get ( "<STR_LIT>" , <NUM_LIT:0> ) <EOL> self . sigma = params . get ( "<STR_LIT>" , <NUM_LIT:0> ) <EOL> self . is_call = params . get ( "<STR_LIT>" , True ) <EOL> self . is_european = params . get ( "<STR_LIT>" , True ) <EOL> """<STR_LIT>""" <EOL> self . dt = T / float ( N ) <EOL> self . df = math . exp ( <EOL> - ( r - self . div ) * self . dt ) </s>
