Ejemplo n.º 1
0
	def __init__(self, dbHandle, name=None, ticker=None, insertIfNot=False):
		'''
		CONSIDER:
					Make periodicity a required field for insertion? (NO.)
		'''
		self._hndl_DB = dbHandle
		self._hndl_Time = None
		self.stored_series = None
		self._metadataCache = {}
		self._seriesID = lib_DBInst.retrieve_DataSeriesID(	self._hndl_DB.conn, 
															self._hndl_DB.cursor,
															name=name,
															ticker=ticker,
															insertIfNot=insertIfNot)
		assert self._seriesID is not None # Did we catch something?
		if name is None: name = self.__load_metadata('txt_data_name')
		self._name = name
		if ticker is None: ticker = self.__load_metadata('txt_data_ticker')
		self._ticker = ticker
Ejemplo n.º 2
0
    def __add_pred_data_tickers(self):
        """
		TODO:
					Change how pred_data_ids are stored.
		"""
        self._pred_data_tickers = retrieve_DataSeries_Filtered(
            self.hndl_DB.cursor,
            column=TICKER,
            minDate=self._pred_data_min_date,
            maxDate=self._pred_data_max_date,
            periodicity=self._pred_data_periodicity,
            categorical=self._pred_data_is_categorical,
        )
        self._pred_data_ids = [
            retrieve_DataSeriesID(self.hndl_DB.conn, self.hndl_DB.cursor, ticker=t) for t in self._pred_data_tickers
        ]  # Inefficient way to retrieve this...
        if not self.resp_can_predict:
            for t in self.resp_data_tickers:
                self.__remove_pred_data_ticker(t)
Ejemplo n.º 3
0
 def fset(self, value):
     self._resp_data_tickers = value
     self._resp_data_ids = [
         retrieve_DataSeriesID(self.hndl_DB.conn, self.hndl_DB.cursor, ticker=t) for t in self._resp_data_tickers
     ]
Ejemplo n.º 4
0
def checkDBCreatorInsertion(conn, cursor):
	ID = lib_DBInstructions.retrieve_DataSeriesID(conn, cursor, dataName='test', dataTicker='test', insertIfNot=False)
	assert ID == None
	ID = lib_DBInstructions.retrieve_DataSeriesID(conn, cursor, dataName='test', dataTicker='test', insertIfNot=True)
	assert ID == 1