當前位置: 首頁>>代碼示例>>Python>>正文


Python Pool.estimate方法代碼示例

本文整理匯總了Python中pool.Pool.estimate方法的典型用法代碼示例。如果您正苦於以下問題:Python Pool.estimate方法的具體用法?Python Pool.estimate怎麽用?Python Pool.estimate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pool.Pool的用法示例。


在下文中一共展示了Pool.estimate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Pool

# 需要導入模塊: from pool import Pool [as 別名]
# 或者: from pool.Pool import estimate [as 別名]
	
	if const.SOURCE_TYPE < 3:
		prices = dataloader.importData(const.SOURCE_TYPE, const.SOURCE_FILE)
		strategy.runStrategy(prices)
	
	if const.SOURCE_TYPE == 3:
		stocks = dataloader.importStockList(const.SOURCE_FILE)
		for stock in stocks:
			dataloader.downloadStockData(stock)
			
	if const.SOURCE_TYPE == 4:
		stocks = dataloader.importStockList(const.SOURCE_FILE)
		finalPool = Pool(const.POOL_SIZE)
		with concurrent.futures.ProcessPoolExecutor(max_workers=5) as executor:
			trs = executor.map(processStrategy, stocks)
			for tr in trs:
				finalPool.estimate(tr)
			#concurrent.futures.wait(trs)
			#print('===============')
			#print(trs)
			#future_strategy = {executor.submit(processStrategy, stock): stock for stock in stocks}
			#concurrent.futures.wait(future_strategy)
			#for future in concurrent.futures.as_completed(future_strategy):
			#	tr = future.result()
			#	
		
		const.currentSecId = 'FINAL'
		finalPool.showStrategies()
		
	
開發者ID:547872495,項目名稱:pymisc,代碼行數:30,代碼來源:main.py

示例2: Pool

# 需要導入模塊: from pool import Pool [as 別名]
# 或者: from pool.Pool import estimate [as 別名]
	#finalPool.estimate(tr)
	#q.put(tr)

if __name__ == "__main__":
	rwlogging.clearLog()
	
	if const.SOURCE_TYPE < 3:
		prices = dataloader.importData(const.SOURCE_TYPE, const.DATA_FILE)
		strategy.runStrategy(prices)
	
	if const.SOURCE_TYPE == 3:
		stocks = dataloader.importStockList(const.LIST_FILE)
		for stock in stocks:
			dataloader.downloadStockData(stock)
	
	if const.SOURCE_TYPE == 4:
		stocks = dataloader.importStockList(const.LIST_FILE)
		finalPool = Pool(100)
		with concurrent.futures.ProcessPoolExecutor(max_workers=const.MAX_PROCESS_NUM) as executor:
			trs = executor.map(processStrategy, stocks)
			for tr in trs:
				try:
					if tr: finalPool.estimate(tr)
				except:
					pass
		
		const.currentSecId = 'FINAL'
		finalPool.showStrategies()
		
	
開發者ID:ongbe,項目名稱:pymisc,代碼行數:30,代碼來源:main.py

示例3: Pool

# 需要導入模塊: from pool import Pool [as 別名]
# 或者: from pool.Pool import estimate [as 別名]
from pool import Pool
from rwlogging import log


path = os.path.dirname(__file__)

if __name__ == "__main__":
	rwlogging.clearLog()
	
	if const.SOURCE_TYPE < 3:
		prices = dataloader.importData(const.SOURCE_TYPE, const.SOURCE_FILE)
		strategy.runStrategy(prices)
	
	if const.SOURCE_TYPE == 3:
		stocks = dataloader.importStockList(const.SOURCE_FILE)
		for stock in stocks:
			dataloader.downloadStockData(stock)
			
	if const.SOURCE_TYPE == 4:
		stocks = dataloader.importStockList(const.SOURCE_FILE)
		for stock in stocks:
			#dataloader.downloadStockDat
			prices = dataloader.importData(2, stock['file'])
			finalPool = Pool(const.POOL_SIZE)
			strategy.secId = stock['id']
			pool = strategy.runStrategy(prices)
			finalPool.estimate(pool.getFirst())
			
			finalPool.showStrategies()
	
開發者ID:fudong1127,項目名稱:pymisc,代碼行數:31,代碼來源:main.py


注:本文中的pool.Pool.estimate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。