Example #1
0
 def handle_bar(context, bar_dict):
     ins_1 = instruments(context.s1)
     ins_2 = instruments(context.s2)
     industry_list_1 = industry(ins_1.industry_name)
     industry_list_2 = industry(ins_2.industry_name)
     assert context.s1 in industry_list_1
     assert context.s2 in industry_list_2
Example #2
0
 def handle_bar(context, bar_dict):
     ins_1 = instruments(context.s1)
     ins_2 = instruments(context.s2)
     industry_list_1 = industry(ins_1.industry_name)
     industry_list_2 = industry(ins_2.industry_name)
     assert context.s1 in industry_list_1
     assert context.s2 in industry_list_2
Example #3
0
 def handle_bar(context, bar_dict):
     print('hello')
     ins = instruments(context.s1)
     assert ins.sector_code_name == '金融'
     assert ins.symbol == '平安银行'
     assert ins.order_book_id == context.s1
     assert ins.type == 'CS'
     print('world')
Example #4
0
 def handle_bar(context, bar_dict):
     ins = instruments(context.s1)
     concepts_list = ins.concept_names.split('|')  # context.s1 的概念列表
     stock_list = concept(concepts_list[0])  # 第一个概念对应的股票列表
     assert context.s1 in stock_list, 'context.s1 not in stock_list {}'.format(
         stock_list)
     assert len(
         concept('深圳本地')
     ) >= 55, 'len(concept_list) < 55, length: {}, stock_list: {}'.format(
         len(concept('深圳本地')))
Example #5
0
def is_predate_listed_date(book_id, days):
    """
        Description : 判断某个股票上市日期是否大于多少天
        Arg :
            @book_id : 股票ID
            @days : 天数
        Returns :
        Raises	 :
    """
    _instrument = instruments(book_id)
    _listed_date = _instrument.listed_date
    return (datetime.datetime.now() - _listed_date).days > days
Example #6
0
 def handle_bar(context, bar_dict):
     ins = instruments(context.s1)
     concept_list = concept(
         ins.concept_names[:4])  # 取 concept_names 的前4个字,即 context.s1 的第一个概念
     assert context.s1 in concept_list
     assert len(concept_list) >= 90
Example #7
0
 def handle_bar(context, bar_dict):
     ins = instruments(context.s1)
     assert ins.sector_code_name == '金融'
     assert ins.symbol == '平安银行'
     assert ins.order_book_id == context.s1
     assert ins.type == 'CS'
Example #8
0
 def handle_bar(context, bar_dict):
     ins = instruments(context.s1)
     concept_list = concept(ins.concept_names[:4])  # 取 concept_names 的前4个字,即 context.s1 的第一个概念
     assert context.s1 in concept_list, 'context.s1 not in concept_list'
     assert len(concept('深圳本地')) >= 55, 'len(concept_list) < 55, length: {}, concept_list: {}'.format(len(concept_list), ins.concept_names[:4])
Example #9
0
 def handle_bar(context, bar_dict):
     if len(context.stocks) == 0:
         context.stocks.append(instruments("600485.XSHG"))
Example #10
0
 def handle_bar(context, bar_dict):
     if len(context.stocks) == 0:
         context.stocks.append(instruments("600485.XSHG"))
Example #11
0
 def handle_bar(context, bar_dict):
     ins = instruments(context.s1)
     concepts_list = ins.concept_names.split('|')  # context.s1 的概念列表
     stock_list = concept(concepts_list[0])  # 第一个概念对应的股票列表
     assert context.s1 in stock_list, 'context.s1 not in stock_list {}'.format(stock_list)
     assert len(concept('深圳本地')) >= 55, 'len(concept_list) < 55, length: {}, stock_list: {}'.format(len(concept('深圳本地')))