Exemplo n.º 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
Exemplo n.º 2
0
Arquivo: main.py Projeto: ongbe/pymisc
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
Exemplo n.º 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)
Exemplo n.º 4
0
Arquivo: main.py Projeto: ongbe/pymisc
		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: