def main(save_file): stock, etf, alias = NASDAQ.init().stock_list() background = STOCKMONITOR.init() logging.info(background) stockmonitor = background() temp = reduce(lambda a, b: a + b, stockmonitor.values()) stock = set(stock) - set(temp) stock_list = sorted(list(stock)) FinanceModel = scrape_financemodelling(stock_list) temp = reduce(lambda a, b: a + b, FinanceModel.values()) stock = set(stock) - set(temp) stock_list = sorted(list(stock)) yahoo = scrape_yahoo(stock_list) temp = reduce(lambda a, b: a + b, yahoo.values()) stock = set(stock) - set(temp) stock_list = sorted(list(stock)) ''' Try a set of alternative names ''' _retry, stock_list = handle_alias(*stock_list, **alias) retry = map(lambda x: alias[x].values(), _retry) retry = reduce(lambda a, b: a + b, retry) FinanceModel2 = scrape_financemodelling(retry) temp_fm = reduce(lambda a, b: a + b, FinanceModel2.values()) retry = set(retry) - set(temp_fm) retry = sorted(list(retry)) yahoo2 = scrape_yahoo(retry) temp_y = reduce(lambda a, b: a + b, yahoo2.values()) retry = set(retry) - set(temp_y) retry = sorted(list(retry)) logging.info(retry) logging.info(temp_fm) logging.info(temp_y) logging.info(_retry) config = INI.init() INI.write_section(config, "STOCKMONITOR", **stockmonitor) INI.write_section(config, "FINANCEMODEL", **FinanceModel) INI.write_section(config, "YAHOO", **yahoo) INI.write_section(config, "FINANCEMODEL2", **FinanceModel2) INI.write_section(config, "YAHOO2", **yahoo2) INI.write_section(config, "NASDAQTRADER", **{ 'unkown': stock_list, 'alias': retry }) for name in sorted(alias): INI.write_section(config, name, **alias[name]) config.write(open(save_file, 'w'))
def main() : data_store = EXTRACT.instance().data_store fund_list = NASDAQ.init().fund_list() config = process_by_type(fund_list) LOAD.config(**config) names = process_names(fund_list) ticker_list = sorted(names.keys()) background = TRANSFORM.summary(data_store, ticker_list) background['NAME'] = names LOAD.background(**background)
def main(): data_store = EXTRACT.instance().data_store nasdaq = NASDAQ.init() stock_list, etf_list, alias = nasdaq.stock_list() stock_names, etf_names = process_names(nasdaq) names = {} names.update(etf_names) names.update(stock_names) ticker_list = sorted(names.keys()) background = TRANSFORM.summary(data_store, stock_list) background['NAME'] = names LOAD.background(**background)
def main() : nasdaq = NASDAQ.init() stock_list, etf_list, alias = nasdaq.stock_list() fund_list = nasdaq.fund_list() data_store = EXTRACT.instance().data_store_stock LOAD.robust(data_store, stock_list) LOAD.robust(data_store, etf_list) fund_list = map(lambda x : NASDAQ_TRANSFORM.fund_ticker(x),fund_list) fund_list = list(fund_list) data_store = EXTRACT.instance().data_store_fund LOAD.robust(data_store, fund_list)
def get_tickers(): nasdaq = NASDAQ.init() stock_list, etf_list, _alias = nasdaq.stock_list() fund_list = nasdaq.fund_list() stock_list = stock_list.index.values.tolist() etf_list = etf_list.index.values.tolist() fund_list = fund_list.index.values.tolist() alias = [] for column in _alias.columns.values.tolist(): alias.extend(_alias[column].tolist()) alias = sorted(list(set(alias))) logging.info(alias) return fund_list, stock_list, etf_list, alias
def test_01_(self): test = TEST.init() logging.info(vars(test)) logging.info(dir(test)) logging.info(type(test)) logging.info(type(test.ftp)) logging.info(vars(test.ftp)) ret = FTP.LIST(test.ftp, pwd='symboldirectory') ret = set(ret) file_list = set(TEST.file_list) lhs = ret - file_list rhs = file_list - ret if len(lhs) > 0: logging.warn(lhs) if len(rhs) > 0: logging.warn(rhs) for i, name in enumerate(test.file_list): logging.info((i, name)) logging.info(ret)
def extract(): nasdaq = NASDAQ.init() stock_list, etf_list, alias = nasdaq.stock_list() sm, stocks = STOCKMONITOR.extract() stock_list = set(stock_list) - set(stocks) stock_list = sorted(list(stock_list)) fm, stocks = FINANCEMODELLING.extract(stock_list) stock_list = set(stock_list) - set(stocks) stock_list = sorted(list(stock_list)) y, stocks = YAHOO.extract(stock_list) stock_list = set(stock_list) - set(stocks) stock_list = sorted(list(stock_list)) ''' Try a set of alternative names ''' _retry, retry, stock_list = handle_alias(*stock_list,**alias) fm2, stocks = FINANCEMODELLING.extract(retry) retry = set(retry) - set(stocks) retry = sorted(list(retry)) y2, stocks = YAHOO.extract(retry) retry = set(retry) - set(stocks) retry = sorted(list(retry)) logging.info(retry) logging.info(_retry) ret = { "STOCKMONITOR" : sm, "FINANCEMODEL" : fm, "YAHOO" : y , "FINANCEMODEL2" : fm2, "YAHOO2" : y2 } ret["NASDAQTRADER"] = {'unknown' : stock_list , 'alias' : retry } ret['alias'] = alias return ret
def get_tickers(): nasdaq = NASDAQ.init() stock_list, etf_list, alias = nasdaq.stock_list() stock_names = stock_list.index.values.tolist() return stock_names, alias
def test_07_(self): test = TEST.init() a, raw = test.funds() logging.info(a.filter(items=test_columns_funds)) logging.info(a.filter(items=test_columns_funds).describe()) logging.info(list(a.columns))
def test_06_(self): test = TEST.init() a, raw = test.other() logging.info(a.filter(items=test_columns_other)) logging.info(a.filter(items=test_columns_other).describe()) logging.info(list(a.columns))
def test_05_(self): test = TEST.init() a, raw = test.traded() logging.info(a.filter(items=test_columns_traded)) logging.info(a.filter(items=test_columns_traded).describe()) logging.info(list(a.columns))
def test_04_(self): test = TEST.init() a, raw = test.listed() logging.info(a.filter(items=test_columns_list)) logging.info(a.filter(items=test_columns_list).describe()) logging.info(list(a.columns))
def test_10_(self): test = TEST.init() stock, etf, alias = test.stock_list() logging.info(list(stock.columns)) logging.info(list(etf.columns)) logging.info(list(alias.columns))
def test_09_(self): test = TEST.init() a, raw = test.participants() logging.info(a.filter(items=test_columns_participants)) logging.info(a.filter(items=test_columns_participants).describe()) logging.info(list(a.columns))
def get_tickers(): ret = NASDAQ.init().fund_list() logging.info(ret) ret = ret.T.to_dict() return ret
def get_tickers(): nasdaq = NASDAQ.init() stock_list, etf_list, alias = nasdaq.stock_list() ret = stock_list.append(etf_list) names = stock_list.index.values.tolist() return names, ret.T.to_dict()