Exemplo n.º 1
0
    def __init__(self, investor, investing_file=None, settings_dir=None, logger=False, verbose=False):
        """
        file: A JSON file will the settings to use. Setting this parameter will prevent
              saving settings to the cache file.
        settings_dir: The directory that will be used to save the user and investment settings files
        """
        self.investing = copy.deepcopy(self.default_investing)
        self.is_dirty = False
        self.investor = investor
        self.settings_dir = settings_dir

        # Create logger if none was passed in
        if not logger:
            self.logger = util.create_logger(verbose)
        else:
            self.logger = logger

        # Create the settings directory, if it doesn't exist
        if investing_file is None and self.settings_dir is not None and not os.path.exists(self.settings_dir):
            os.mkdir(self.settings_dir)

        self.get_user_settings()
        self.load_investment_settings_file();

        # Default email to the last profile used
        if 'last_profile' in self.investing_json and self.investing_json['last_profile'] != 'none':
            self.auth['email'] = self.investing_json['last_profile']
    def __init__(self, investor, investing_file=None, settings_dir=None, logger=False, verbose=False):
        """
        file: A JSON file will the settings to use. Setting this parameter will prevent
              saving settings to the cache file.
        settings_dir: The directory that will be used to save the user and investment settings files
        """
        self.investing = self.get_default_investing_settings()
        self.is_dirty = False
        self.investor = investor
        self.settings_dir = settings_dir

        # Create logger if none was passed in
        if not logger:
            self.logger = util.create_logger(verbose)
        else:
            self.logger = logger

        # Create the settings directory, if it doesn't exist
        if investing_file is None and self.settings_dir is not None and not os.path.exists(self.settings_dir):
            os.mkdir(self.settings_dir)

        self.get_user_settings()
        self.load_investment_settings_file();

        # Default email to the last profile used
        if 'last_profile' in self.investing_json and self.investing_json['last_profile'] != 'none':
            self.auth['email'] = self.investing_json['last_profile']
Exemplo n.º 3
0
    def __init__(self, verbose=False):
        """
        Create an AutoInvestor instance
         - Set verbose to True if you want to see debugging logs
        """
        self.verbose = verbose
        self.logger = util.create_logger(verbose)
        self.app_dir = util.get_app_directory()
        self.lc = LendingClub()

        # Set logger on lc
        if self.verbose:
            self.lc.set_logger(self.logger)

        # Create settings object
        self.settings = Settings(investor=self, settings_dir=self.app_dir, logger=self.logger, verbose=self.verbose)

        self.settings.investor = self  # create a link back to this instance
Exemplo n.º 4
0
    def __init__(self, verbose=False):
        """
        Create an AutoInvestor instance
         - Set verbose to True if you want to see debugging logs
        """
        self.verbose = verbose
        self.logger = util.create_logger(verbose)
        self.app_dir = util.get_app_directory()
        self.lc = LendingClub()

        # Set logger on lc
        if self.verbose:
            self.lc.set_logger(self.logger)

        # Create settings object
        self.settings = Settings(investor=self, settings_dir=self.app_dir, logger=self.logger, verbose=self.verbose)

        self.settings.investor = self  # create a link back to this instance
Exemplo n.º 5
0
    def __init__(self, investor, investing_file=None, settings_dir=None, logger=False, verbose=False):
        """
        file: A JSON file will the settings to use. Setting this parameter will prevent
              saving settings to the cache file.
        settings_dir: The directory that will be used to save the user and investment settings files
        """
        self.is_dirty = False
        self.investor = investor
        self.settings_dir = settings_dir

        # Create logger if none was passed in
        if not logger:
            self.logger = util.create_logger(verbose)
        else:
            self.logger = logger

        # Create the settings directory, if it doesn't exist
        if investing_file is None and self.settings_dir is not None and not os.path.exists(self.settings_dir):
            os.mkdir(self.settings_dir)

        self.get_user_settings()
        self.load_investment_settings_file(investing_file)