# Path: Data/QuandlDownloader.py
# class QuandlDownloader():
#     """
#     This class contains the logic for downloading and transforming Quandl data sets. It receives,
#     * A QuandlSetting object as a parameter which determines how to download the data set
#     * The name of a Quandl data set to be downloaded
#     """
# 
#     def __init__(self, quandl_data_set_name, quandl_settings=QuandlSettings(500, 1)):
#         """
#         Initialization method for the Quandl Downloader object
#         :param quandl_data_set_name: this is a string which contains the name of the data set to download
#         :param quandl_settings: this is a setting object
#         """
#         self.fetched = False
#         self.quandl_data_set = np.array
#         self.quandl_settings = quandl_settings
#         self.quandl_data_set_name = quandl_data_set_name
#         self.quandl_dates, self.quandl_data = self.get_quandl_data()
#         pass
# 
#     def get_quandl_data(self):
#         """
#         This method retrieves the quandl data set given the settings specified in the quandl_settings object. For more
#         information about these settings see documentation from the QuandlSettings class
#         """
#         if not self.fetched:
#             self.quandl_data_set = Quandl.get(self.quandl_data_set_name,
#                                               returns="numpy",
#                                               rows=self.quandl_settings.rows,
#                                               sort_order=self.quandl_settings.order,
#                                               collapse=self.quandl_settings.frequency,
#                                               transformation=self.quandl_settings.transformation,)
#             self.quandl_dates = np.arange(1, self.quandl_settings.rows + 1, 1)
#             self.quandl_data = zip(*self.quandl_data_set)[self.quandl_settings.column]
#             self.quandl_data = self.quandl_data[::-1]
#             self.fetched = True
#         return self.quandl_dates, self.quandl_data
# 
# Path: Data/QuandlDownloader.py
# class QuandlSettings():
#     """
#     This class contains settings for the quandl integration package, settings include,
#     """
# 
#     def __init__(self, rows, column, frequency="weekly", transformation="normalize", order="desc"):
#         """
#         This initialization method constructs a new QuandlSettings object
#         :param rows: the number of rows of data to download from Quandl
#         :param column: which column of the downloaded data to extract
#         :param frequency: daily, weekly, monthly, quarterly, yearly
#         :param transformation: normalize, rdiff, etc.
#         :param order: which order to sort into w.r.t date
#         """
#         self.rows = rows
#         self.column = column
#         self.frequency = frequency
#         self.transformation = transformation
#         self.order = order
#         pass
# 
# Path: Visualization/SimplePlotter.py
# def plot_regression_line(regression_analyses):


from LinearRegression import RegressionAnalysis
from LinearRegression import RegressionSettings
from Data.QuandlDownloader import QuandlDownloader
from Data.QuandlDownloader import QuandlSettings
from Visualization import SimplePlotter
__author__ = 'stuartreid'



def investing_example():
    """
    This method creates a set of regression analyses based on fundamental trading (revenues)
    """
    # b: blue, g: green, r: red, c: cyan, m: magenta, y: yellow, k: black, w: white
    statsmodels_args_inv = RegressionSettings(2, False)
    quandl_args_inv = QuandlSettings(5, 1, "yearly")

    regressions_inv = [RegressionAnalysis(QuandlDownloader("DMDRN/GOOG_REV_LAST", quandl_args_inv),
                                          statsmodels_args_inv, 'b'),

# Path: Data/QuandlDownloader.py
# class QuandlDownloader():
#     """
#     This class contains the logic for downloading and transforming Quandl data sets. It receives,
#     * A QuandlSetting object as a parameter which determines how to download the data set
#     * The name of a Quandl data set to be downloaded
#     """
# 
#     def __init__(self, quandl_data_set_name, quandl_settings=QuandlSettings(500, 1)):
#         """
#         Initialization method for the Quandl Downloader object
#         :param quandl_data_set_name: this is a string which contains the name of the data set to download
#         :param quandl_settings: this is a setting object
#         """
#         self.fetched = False
#         self.quandl_data_set = np.array
#         self.quandl_settings = quandl_settings
#         self.quandl_data_set_name = quandl_data_set_name
#         self.quandl_dates, self.quandl_data = self.get_quandl_data()
#         pass
# 
#     def get_quandl_data(self):
#         """
#         This method retrieves the quandl data set given the settings specified in the quandl_settings object. For more
#         information about these settings see documentation from the QuandlSettings class
#         """
#         if not self.fetched:
#             self.quandl_data_set = Quandl.get(self.quandl_data_set_name,
#                                               returns="numpy",
#                                               rows=self.quandl_settings.rows,
#                                               sort_order=self.quandl_settings.order,
#                                               collapse=self.quandl_settings.frequency,
#                                               transformation=self.quandl_settings.transformation,)
#             self.quandl_dates = np.arange(1, self.quandl_settings.rows + 1, 1)
#             self.quandl_data = zip(*self.quandl_data_set)[self.quandl_settings.column]
#             self.quandl_data = self.quandl_data[::-1]
#             self.fetched = True
#         return self.quandl_dates, self.quandl_data
# 
# Path: Data/QuandlDownloader.py
# class QuandlSettings():
#     """
#     This class contains settings for the quandl integration package, settings include,
#     """
# 
#     def __init__(self, rows, column, frequency="weekly", transformation="normalize", order="desc"):
#         """
#         This initialization method constructs a new QuandlSettings object
#         :param rows: the number of rows of data to download from Quandl
#         :param column: which column of the downloaded data to extract
#         :param frequency: daily, weekly, monthly, quarterly, yearly
#         :param transformation: normalize, rdiff, etc.
#         :param order: which order to sort into w.r.t date
#         """
#         self.rows = rows
#         self.column = column
#         self.frequency = frequency
#         self.transformation = transformation
#         self.order = order
#         pass
# 
# Path: Visualization/SimplePlotter.py
# def plot_regression_line(regression_analyses):


# Path: RegressionAnalysis/Examples.py
from LinearRegression import RegressionAnalysis
from LinearRegression import RegressionSettings
from Data.QuandlDownloader import QuandlDownloader
from Data.QuandlDownloader import QuandlSettings
from Visualization import SimplePlotter

__author__ = 'stuartreid'



def investing_example():
    """
    This method creates a set of regression analyses based on fundamental trading (revenues)
    """
    # b: blue, g: green, r: red, c: cyan, m: magenta, y: yellow, k: black, w: white
    statsmodels_args_inv = RegressionSettings(2, False)
    quandl_args_inv = QuandlSettings(5, 1, "yearly")

    regressions_inv = [RegressionAnalysis(QuandlDownloader("DMDRN/GOOG_REV_LAST", quandl_args_inv),
                                          statsmodels_args_inv, 'b'),

                       RegressionAnalysis(QuandlDownloader("DMDRN/YHOO_REV_LAST", quandl_args_inv),