本文整理汇总了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()
示例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()
示例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()