def collect_all(): df = stock_industry_dao.get_list() for code in df['code'].values: try: collect_single(code) time.sleep(1) except Exception as e: logger.error(repr(e))
def industry_filter(code1, code2): industry_df = stock_industry_dao.get_list() bk1 = industry_df[industry_df['code'] == code1]['bk_name'].values[0] bk2 = industry_df[industry_df['code'] == code2]['bk_name'].values[0] if bk1 == bk2: return bk1, bk2 else: return False
def collect_full(): df = stock_industry_dao.get_list() now = datetime.now().strftime('%Y-%m-%d') for code in df['code'].values: try: collect_single(code=code, start='2015-01-01', end=now) except Exception as e: logger.error( "collect technical features failed code:%s, exception:%s" % (code, repr(e)))
def init(self, context): super(KDJStrategy, self).init(context) # context.pool = stock_pool_dao.get_list()['code'].values context.pool = stock_industry_dao.get_list()['code'].values self.context = context
def test_get_list(self): df = stock_industry_dao.get_list() logger.debug(df.head())
def collect_all(futu_quote_ctx): now = datetime.now().strftime('%Y-%m-%d') df_industry = stock_industry_dao.get_list() for index,row in df_industry.iterrows(): code = row['code'] collect_single(code=code, start='2013-01-01', end=now, futu_quote_ctx=futu_quote_ctx)
# ae_h - 2018/7/5 from dao.basic.stock_industry_dao import stock_industry_dao import pandas as pd def fill_zero(code): code = str(code) code = code.zfill(6) return code industry_df = stock_industry_dao.get_list() # bk_code = set(list(industry_df['bk_code'].values)) # print(bk_code) df = pd.read_csv( '/Users/yw.h/quant-awesome/quant/strategy/pair/pair_result.csv') # print(industry_df[industry_df['code'] == '000001']['bk_code']) list = [] for index, row in df.iterrows(): code1 = fill_zero(str(int(row['stock1']))) code2 = fill_zero(str(int(row['stock2']))) bk1 = industry_df[industry_df['code'] == code1]['bk_name'].values[0] bk2 = industry_df[industry_df['code'] == code2]['bk_name'].values[0] if bk1 == bk2: list.append((code1 + bk1, code2 + bk2))