티스토리 뷰

SWDesk

BStockTrade - DataManager

inhae 2022. 3. 15. 09:00

업데이트 예정

	def ExtractAValues(self, dataIn, dataID=None):
		# dataIn : DataFrame, 180 days
		# dataID : 'I01', ...
		if not dataID:
			dataID = "I01"
		data20 =  dataIn[0:19]
		date0 = datetime.now()
		dateString0 = date0.strftime("%Y%m%d")

		data_1 = pd.to_numeric(dataIn[dataID])
		data20_1 = pd.to_numeric(data20[dataID])

		dataNumber = data_1.count()
		dataNumber20 = data20_1.count()
		meanValue = data_1.mean()
		meanValue20 = data20_1.mean()
		maxValue = data_1.max()
		maxValue20 = data20_1.max()
		overMean = data_1[data_1>meanValue].count()
		overMean20 = data20_1[data20_1>meanValue].count()
		data3_1 = pd.to_numeric(dataIn['CP'])

		ret1 = {
			'DT': dateString0,
			'DID': dataID,
			'N0': dataNumber,
			'N20': dataNumber20,
			'A0': round(meanValue, 3),
			'A20': round(meanValue20, 3),
			'X0': round(maxValue, 3),
			'X20': round(maxValue20, 3),
			'OM0': overMean,
			'OM20': overMean20
		}

		return ret1

 

 

반응형

'SWDesk' 카테고리의 다른 글

[Python] Data Addition after Initialization  (0) 2022.05.23
[Python] Stock Trade  (0) 2022.04.12
Python에서 한글 사용 예제  (0) 2022.02.24
[Python Test] Manipulating DataFrame  (0) 2022.02.14
[Python] Tistory API 수정  (0) 2021.11.21