コード例 #1
0
	def __download_dataset_singleSeries(self, 	
										Q_DATABASE_CODE=None,
										Q_DATASET_CODE=None,
										Q_COLUMN_NUM=USE_DEFAULT, 
										Q_COLLAPSE_INSTR=USE_DEFAULT, 
										Q_TRANSFORM_INSTR=USE_DEFAULT,
										start_date=USE_DEFAULT):
		'''
		TODOS:
					Only Download data that's necessary (i.e. after latest insert) (checking for updates)
		'''
		# Set Quandl Query Parameters
		log.info('QUANDL: Downloading Quandl data for (Database|Dataset): ({0}|{1})'.format(Q_DATABASE_CODE,Q_DATASET_CODE))
		hndl_Qndl = EMF_QuandlAPI_Handle(Q_DATABASE_CODE, Q_DATASET_CODE)
		# Set Quandl Query Parameters / Column Index
		hndl_Qndl.Instr_Col_Idx = Q_COLUMN_NUM
		# Set Quandl Query Parameters / Collapse
		hndl_Qndl.Instr_Collapse = Q_COLLAPSE_INSTR
		# Set Quandl Query Parameters / Transform
		hndl_Qndl.Instr_Transform = Q_TRANSFORM_INSTR
		# Set Quandl Query Parameters / Start Date
		hndl_Qndl.Instr_Start_Date = start_date
		# Download Quandl Data
		hndl_Qndl.get_data()
		try:
			log.info('QUANDL: Found {0} points from {1} to {2}. Periodicity: {3}'
						.format(hndl_Qndl.Data_Num_Points,
								hndl_Qndl.Data_Earliest_Date,
								hndl_Qndl.Data_Latest_Date,
								hndl_Qndl.Quandl_Periodicity))
			if hndl_Qndl.Data_Num_Columns != 2 and Q_COLUMN_NUM == 1:
				log.warning('QUANDL: Found more than one column. Ensure you have right column).')
		except Exception:
			pass
		# Return
		return hndl_Qndl