Ejemplo n.º 1
0
 def __init__(self, symbol, type, start=None, end=None):
     self.symbol = symbol
     self.type = type
     self.start = start
     self.end = end
     self.tool = YahooOptions(symbol)
     self.optionData = None
Ejemplo n.º 2
0
def Options(symbol, data_source=None, session=None):
    if data_source is None:
        warnings.warn("Options(symbol) is deprecated, use Options(symbol,"
                      " data_source) instead", FutureWarning, stacklevel=2)
        data_source = "yahoo"
    if data_source == "yahoo":
        return YahooOptions(symbol, session=session)
    else:
        raise NotImplementedError("currently only yahoo supported")
Ejemplo n.º 3
0
def Options(symbol, data_source=None, session=None):
    if data_source is None:
        warnings.warn("Options(symbol) is deprecated, use Options(symbol,"
                      " data_source) instead", FutureWarning, stacklevel=2)
        data_source = "yahoo"
    if data_source == "yahoo":
        raise ImmediateDeprecationError(DEP_ERROR_MSG.format('Yahoo Options'))
        return YahooOptions(symbol, session=session)
    elif data_source == "google":
        raise ImmediateDeprecationError(DEP_ERROR_MSG.format('Google Options'))
        return GoogleOptions(symbol, session=session)
    else:
        raise NotImplementedError("currently only yahoo and google supported")
Ejemplo n.º 4
0
    def __get_data(self, year, month, day, tickers, strike):
        """ this is a private function

            this function gives the price of one call knowing its year, month,day and strike

           the dataframe manipulated is multiindex ( jutification of using ( get_level_values(0)=strike)

           it returns the cheapest call price at (year-month-day)
           """
        # this function the price of one call knowing its year, month,day and strike
        # the dataframe manipulated is multiindex ( jutification of using ( get_level_values(0)=strike)

        C_frame = YahooOptions(tickers).get_call_data(year=year, month=month)

        C_frame = self.__select_min_call(df_call_market=C_frame,
                                         k=strike,
                                         a=year,
                                         m=month,
                                         j=day)

        " to construct Dataframe, we fill the  empty value with zero"
        if not C_frame.size > 0:
            C_frame = np.append(C_frame, 0)
        return (C_frame)
Ejemplo n.º 5
0
#%%
import pandas_datareader.data as web 
import datetime
# %%
start = datetime.datetime(2015,1,1)
end = datetime.datetime(2017,1,1)
facebook = web.DataReader('FB','yahoo',start,end) #Probe con google y no me deja, me da error
# %%
facebook.head() #el close value puede tomar stock split por el api
# %%
#option reader
#No me funciona, pero lo hice abajo
'''
from pandas_datareader.data import Options
fb_options = Options('FB','yahoo')
options_df = fb_options.get_options_data(expiry=fb_options.expiry_dates[0])
'''
# %%
from pandas_datareader.yahoo.options import Options as YahooOptions
underlying_symbol = 'FB'
options_obj = YahooOptions(underlying_symbol)
options_frame_live = options_obj.get_options_data()
# %%
options_frame_live
# %%
Ejemplo n.º 6
0
    def vizualize_calls(self, yearr, montth, tickerr):

        "the function will help the costumers look at offers available in the market"

        return (YahooOptions(tickerr).get_call_data(year=yearr, month=montth))