How to use the finviz.helper_functions.error_handling.InvalidTableType function in finviz

To help you get started, we’ve selected a few finviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mariostoev / finviz / finviz / screener.py View on Github external
tickers = None
        if 't' in splitted_query:
            tickers = splitted_query['t'][0].split(',')

        filters = None
        if 'f' in splitted_query:
            filters = splitted_query['f'][0].split(',')

        table = None
        if 'v' in splitted_query:
            table_numbers_types = {v: k for k, v in TABLE_TYPES.items()}
            table_number_string = splitted_query['v'][0][0:3]
            try:
                table = table_numbers_types[table_number_string]
            except KeyError:
                raise InvalidTableType(splitted_query['v'][0])
        else:
            table = 'Overview'

        custom = None
        if 'c' in splitted_query:
            custom = splitted_query['c'][0].split(',')

        order = ''
        if 'o' in splitted_query:
            order = splitted_query['o'][0]

        signal = ''
        if 's' in splitted_query:
            order = splitted_query['s'][0]

        return cls(tickers, filters, rows, order, signal, table, custom)
github mariostoev / finviz / finviz / screener.py View on Github external
def __check_table(self, input_table):
        """ Checks if the user input for table type is correct. Otherwise, raises an InvalidTableType error. """

        try:
            table = TABLE_TYPES[input_table]
            return table
        except KeyError:
            raise InvalidTableType(input_table)