Esempio n. 1
0
    def __init__(self, tick, finances=None, fin_others=None, mkt_data=None):
        """ Instantiates using inp_parameters (from inp_params.py) and fcf.
        fcf is a dict containing non-terminal and terminal cashflows"""

        # If dataset if not loaded already, load the dataset
        if finances == None:

            print("Dataset not loaded, loading the dataset...")

            # Set path for data
            base_path = '../data/'
            sheets_path = 'combined_simplified/combined_all_us.csv'
            other_path = 'combined_simplified/others_all_us.csv'
            mkt_path = 'combined_simplified/stock_stats_all_us.csv'

            # setup all data
            finances = fin_stats(base_path + sheets_path)
            fin_others = fin_stats_2(base_path + other_path)
            mkt_data = stock_stats(base_path + mkt_path)

        self.inp_params = get_inp_params(tick, finances, fin_others, mkt_data)
        time_period = 10
        self.n_years = time_period

        self.dp = data_projections(tick, finances, fin_others, mkt_data,
                                   time_period)

        self.stable_cc_default = .085
Esempio n. 2
0
    def __init__(self,
                 fcf,
                 tick,
                 finances=None,
                 fin_others=None,
                 mkt_data=None):
        """ Instantiates using inp_parameters (from inp_params.py) and fcf.
        fcf is a dict containing non-terminal and terminal cashflows"""

        # If dataset if not loaded already, load the dataset
        if finances == None:

            print("Dataset not loaded, loading the dataset...")

            # Set path for data
            base_path = '../data/'
            sheets_path = 'combined_simplified/combined_all_us.csv'
            other_path = 'combined_simplified/others_all_us.csv'
            mkt_path = 'combined_simplified/stock_stats_all_us.csv'

            # setup all data
            finances = fin_stats(base_path + sheets_path)
            fin_others = fin_stats_2(base_path + other_path)
            mkt_data = stock_stats(base_path + mkt_path)

        self.inp_params = get_inp_params(tick, finances, fin_others, mkt_data)
        self.fcf = fcf
        self.n_years = int(self.fcf['non_terminal'].shape[0])
Esempio n. 3
0
    def __init__(self,c_df):
        # c_list is the company list
        self.c_df = c_df
        self.base_path = '../data/combined_simplified/'
        # Set up paths for data source
        self.fin_data1 = self.base_path + 'combined_all_us.csv'
        self.fin_data2 = self.base_path + 'others_all_us.csv'
        self.mrkt_data = self.base_path + 'stock_stats_all_us.csv'

        # Instantiate the all dataframe
        self.finances = fin_stats(self.fin_data1)
        self.other_fin = fin_stats_2(self.fin_data2)
        self.mrkt = stock_stats(self.mrkt_data)
Esempio n. 4
0
    # Save the dict in pickle format
    with open('trend_card_' + str(n_years) + '.pkl', 'wb') as handle:
        pickle.dump(trend_card, handle, protocol=pickle.HIGHEST_PROTOCOL)

if __name__ == '__main__':

    # Set path for data
    base_path = '../data/'
    sheets_path = 'combined_simplified/combined_all_us.csv'
    other_path = 'combined_simplified/others_all_us.csv'
    mkt_path = 'combined_simplified/stock_stats_all_us.csv'

    # setup all data
    finances = fin_stats(base_path + sheets_path)
    fin_others = fin_stats_2(base_path + other_path)
    mkt_data = stock_stats(base_path + mkt_path)

    # Equity list
    equity_list_path = '../equity_list/all_us_list.csv'
    equity_list = pd.read_csv(equity_list_path)

    # Initialize the dictionaries
    time_s_card = {}
    trend_card = {}

    # Last n years data
    n_years = 15

    # Build the trend dataset
    build_trend_data(trend_card)