Пример #1
0
def processStrategy(stock):
    try:
        if const.REFRESH_DATA: dataloader.downloadStockData(stock)
        prices = dataloader.importData(4, stock['file'])
        const.currentSecId = stock['id']
        tr = strategy.runStrategy(prices)
        return tr
    except:
        return None
Пример #2
0
def processStrategy(stock):
	try:
		if const.REFRESH_DATA: dataloader.downloadStockData(stock)
		prices = dataloader.importData(4, stock['file'])
		const.currentSecId = stock['id']
		tr = strategy.runStrategy(prices)
		return tr
	except:
		return None
Пример #3
0
        prices = dataloader.importData(4, stock['file'])
        const.currentSecId = stock['id']
        tr = strategy.runStrategy(prices)
        return tr
    except:
        return None
    #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)
Пример #4
0
		if const.REFRESH_DATA: dataloader.downloadStockData(stock)
		prices = dataloader.importData(4, stock['file'])
		const.currentSecId = stock['id']
		tr = strategy.runStrategy(prices)
		return tr
	except:
		return None
	#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: