Exemplo n.º 1
0
one_week = dt.timedelta(days=7)
start = today - one_week
stock = web.DataReader(ticker, 'yahoo', start) 
print(stock.tail())        # just to see what we have

# take the last close (that's what the -1 does)
atm = stock.ix[-1,'Close']      # the -1 takes the last observation   

#%%

# get option prices for same ticker 
# http://pandas.pydata.org/pandas-docs/stable/remote_data.html#yahoo-finance-options
option = Options(ticker, 'yahoo')
expiry = dt.date(2014, 12, 20)
data_calls = option.get_call_data(expiry=expiry)
data_puts  = option.get_put_data(expiry=expiry)

print(data_calls.tail()) 
print(data_puts.tail()) 

#%%

# plot puts v strike, call v strike
calls_bid = data_calls['Bid']
calls_ask = data_calls['Ask'] 

calls_strikes = data_calls['Strike']
calls_mid = (data_calls['Bid'] + data_calls['Ask'])/2
puts_strikes = data_puts['Strike']
puts_mid = (data_puts['Bid'] + data_puts['Ask'])/2
Exemplo n.º 2
0
def put_data(tickrr, exp_date):
    x = Options(ticker, 'yahoo')
    data = x.get_put_data(expiry=exp_date)
    return data
Exemplo n.º 3
0
one_week = dt.timedelta(days=7)
start = today - one_week
stock = web.DataReader(ticker, 'yahoo', start)
print(stock.tail())  # just to see what we have

# take the last close (that's what the -1 does)
atm = stock.ix[-1, 'Close']  # the -1 takes the last observation

#%%

# get option prices for same ticker
# http://pandas.pydata.org/pandas-docs/stable/remote_data.html#yahoo-finance-options
option = Options(ticker, 'yahoo')
expiry = dt.date(2014, 12, 20)
data_calls = option.get_call_data(expiry=expiry)
data_puts = option.get_put_data(expiry=expiry)

print(data_calls.tail())
print(data_puts.tail())

#%%

# plot puts v strike, call v strike
calls_bid = data_calls['Bid']
calls_ask = data_calls['Ask']

calls_strikes = data_calls['Strike']
calls_mid = (data_calls['Bid'] + data_calls['Ask']) / 2
puts_strikes = data_puts['Strike']
puts_mid = (data_puts['Bid'] + data_puts['Ask']) / 2
def put_data(tickrr,exp_date):
    x = Options(ticker,'yahoo')
    data= x.get_put_data(expiry=exp_date)
    return data