stockdaq.symbol

Library for handling stock symbols.

Functions

get_symbol_list(path[, omit])

Read a file of symbols list and return a list of symbols

make_symbol_list(input_path, output_path[, …])

Make a list of stock symbols from the nasdaq companylist.csv file.

stockdaq.symbol.get_symbol_list(path, omit=['^', '.'])

Read a file of symbols list and return a list of symbols

Parameters
  • path (str) – Path to the list of symbols. The file should contain newline separated strings of symbols.

  • omit (list of str, optional) – If the stock symbol contains characters in this list, it will be ignored. For example, “AL^A” will be ignored. Defaults to [“^”, “.”].

Returns

symbol_list – The list of stock symbols.

Return type

list of str

stockdaq.symbol.make_symbol_list(input_path, output_path, overwrite=True, omit=['^', '.'], has_header=True, symbol_index=0)

Make a list of stock symbols from the nasdaq companylist.csv file.

Parameters
  • input_path (str) – The path of the companylist.csv file.

  • output_path (str) – The output path.

  • overwrite (boolean, optional) – If the output path exists, overwrite. Defaults to True.

  • omit (list of str, optional) – If the stock symbol contains characters in this list, it will be ignored. For example, “AL^A” will be ignored. Defaults to [“^”, “.”].

  • has_header (boolean, optional) – If the csv file has header indicating the column of symbols.

  • symbol_index (int, optional) – The column of the symbols, if the header doesn’t indicate.