Exemple #1
0
def getSVCArgs(share, start_date, end_date):
	
#	emas = stats.ema(data, period)[1]
	retry_count = 5
	while retry_count > 0:
		try:
			data = share.get_historical(start_date, end_date)
			features = stats.features(data)
			if len(features) == 0:
				print "analysis - getSVCArgs(): features is empty. Ticker: " + \
					share.get_info()['symbol']
				retry_count = retry_count - 1
				continue

			labels = stats.labels(data)
			del labels[len(features):]

			return [features, labels]
	
		except IndexError:
			print "analysis - getSVCArgs(): IndexError. Ticker: " + \
				share.get_info()['symbol']
			retry_count = retry_count - 1
			continue
		except KeyError:
			print "analysis - getSVCArgs(): KeyError. Ticker: " + \
				share.get_info()['symbol']
			retry_count = retry_count - 1
			continue

	return None
Exemple #2
0
def getSVCArgs(share, start_date, end_date, alg_type):
	
	data = share.get_historical(start_date, end_date)
#	emas = stats.ema(data, period)[1]
	try:
	
		features = stats.features(data)
		if len(features) == 0:
			print "analysis - getSVCArgs(): features is empty. Ticker: " + \
				share.get_info()['symbol']
			return None
		
		labels = stats.labels(data, alg_type)		
		del labels[len(features):]

		features = np.array(features)
		labels = np.array(labels)
		return [features, labels]
	
	except IndexError:
		print "analysis - getSVCArgs(): IndexError. Ticker: " + \
			share.get_info()['symbol']
		return None
	except KeyError:
		print "analysis - getSVCArgs(): KeyError. Ticker: " + \
			share.get_info()['symbol']
		return None