Package QSTK :: Package qstkutil :: Module DataAccess :: Class DataAccess
[hide private]
[frames] | no frames]

Class DataAccess

source code

object --+
         |
        DataAccess


Note: The earliest time for which this works is platform dependent because the python date functionality is platform dependent.

Instance Methods [hide private]
 
__init__(self, sourcein='Norgate')
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
get_data_hardread(self, ts_list, symbol_list, data_item, verbose=False, bIncDelist=False)
Read data into a DataFrame no matter what.
source code
 
get_data(self, ts_list, symbol_list, data_item, verbose=False, bIncDelist=False)
Read data into a DataFrame, but check to see if it is in a cache first.
source code
 
getPathOfFile(self, symbol_name, bDelisted=False)
Since a given pkl file can exist in any of the folders- we need to look for it in each one until we find it. Thats what this function does.
source code
 
get_all_symbols(self)
Returns a list of all the symbols located at any of the paths for this source. @see: {__init__}
source code
 
get_symbols_in_sublist(self, subdir)
Returns all the symbols belonging to that subdir of the data store.
source code
 
get_sublists(self)
Returns a list of all the sublists for a data store.
source code
 
get_data_labels(self)
Returns a list of all the data labels available for this type of data access object.
source code
 
get_info(self)
Returns and prints a string that describes the datastore.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, sourcein='Norgate')
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • sourcestr - Specifies the source of the data. Initializes paths based on source.
Overrides: object.__init__

Note: No data is actually read in the constructor. Only paths for the source are initialized

get_data_hardread(self, ts_list, symbol_list, data_item, verbose=False, bIncDelist=False)

source code 

Read data into a DataFrame no matter what.

Parameters:
  • ts_list - List of timestamps for which the data values are needed. Timestamps must be sorted.
  • symbol_list - The list of symbols for which the data values are needed
  • data_item - The data_item needed. Like open, close, volume etc. May be a list, in which case a list of DataFrame is returned.
  • bIncDelist - If true, delisted securities will be included.

Note: If a symbol is not found then a message is printed. All the values in the column for that stock will be NaN. Execution then continues as usual. No errors are raised at the moment.

get_data(self, ts_list, symbol_list, data_item, verbose=False, bIncDelist=False)

source code 

Read data into a DataFrame, but check to see if it is in a cache first.

Parameters:
  • ts_list - List of timestamps for which the data values are needed. Timestamps must be sorted.
  • symbol_list - The list of symbols for which the data values are needed
  • data_item - The data_item needed. Like open, close, volume etc. May be a list, in which case a list of DataFrame is returned.
  • bIncDelist - If true, delisted securities will be included.

Note: If a symbol is not found then a message is printed. All the values in the column for that stock will be NaN. Execution then continues as usual. No errors are raised at the moment.

getPathOfFile(self, symbol_name, bDelisted=False)

source code 
Returns:
Complete path to the pkl file including the file name and extension

get_all_symbols(self)

source code 

Attention: This will discard all files that are not of type pkl. ie. Only the files with an extension pkl will be reported.

get_symbols_in_sublist(self, subdir)

source code 
Parameters:
  • subdir - Specifies which subdir you want.
Returns:
A list of symbols belonging to that subdir

get_sublists(self)

source code 
Returns:
A list of the valid sublists for the data store.

get_data_labels(self)

source code 
Returns:
A list of label strings.

get_info(self)

source code 
Returns:
A string.