Ejemplo n.º 1
0
 def gets_modeling_target():
     try:
         data_qs = bw.gets(Company,
                           'com_code',
                           data_size__gt=MODELING_SKIP_DATA_SIZE)
     except Exception as e:
         raise Exception(e)
     return data_qs
Ejemplo n.º 2
0
 def gets_target_accuracy(date):
     try:
         data_qs = bw.gets(ModelingInfo,
                           '-accuracy',
                           date=date,
                           r_open__gt=0.)
     except Exception as e:
         raise Exception(e)
     return data_qs
Ejemplo n.º 3
0
 def get_models(model_name, date):
     try:
         data_qs = bw.gets(ModelInfo,
                           'com_code',
                           model_name=model_name,
                           date=date)
     except Exception as e:
         raise Exception(e)
     return data_qs
Ejemplo n.º 4
0
 def gets_trading_data(y_date, com_code):
     try:
         data = bw.gets(ModelingData,
                        'date',
                        date__gt=y_date,
                        com_code=com_code)[0]
     except Exception as e:
         raise Exception(e)
     return data
Ejemplo n.º 5
0
 def gets_yesterday_data(date, t_type, t_count):
     try:
         data_qs = bw.gets(MyTrading,
                           'com_code',
                           date=date,
                           t_type=t_type,
                           t_count=t_count)
     except Exception as e:
         raise Exception(e)
     return data_qs
Ejemplo n.º 6
0
 def gets_target_price(date):
     try:
         data_qs = bw.gets(ModelingInfo,
                           '-p_ratio',
                           date=date,
                           r_open__gt=0.,
                           p_ratio__lte=1.5)
     except Exception as e:
         raise Exception(e)
     return data_qs
Ejemplo n.º 7
0
 def get_type_list(c_type=SYSTEM_CODE_TYPE, is_name=False):
     try:
         data_qs = bw.gets(Code, 'code', c_type=c_type)
     except Exception as e:
         raise Exception(e)
     else:
         lists = []
         for data in data_qs:
             if is_name:
                 lists.append(data.name)
             else:
                 lists.append(data.code)
         return lists
Ejemplo n.º 8
0
 def get_prediction_datas(com_code, date, w_size):
     try:
         data_qs = bw.gets(ModelingData,
                           '-date',
                           com_code=com_code,
                           date__lte=date)[:w_size]
         if data_qs[0].date != date:
             return None
         data_lst = []
         for data in reversed(data_qs):
             new_lst = [
                 data.open, data.low, data.high, data.close, data.volume
             ]
             data_lst.append(new_lst)
     except Exception as e:
         raise Exception(e)
     return data_lst
Ejemplo n.º 9
0
 def get_type_dict(c_type=SYSTEM_CODE_TYPE, is_name_index=False):
     """
     코드 타입별로 리스트를 구함
     :param c_type: 추출할 코드 타입(기본값은 시스템 코드)
     :param is_name_index:
       - True : 코드명을 인덱스로 생성, 값은 코드
       - False : 코드를 인덱스로 생성, 값은 코드명
     :return: 코드 타입의 리스트
     """
     try:
         data_qs = bw.gets(Code, 'code', c_type=c_type)
     except Exception as e:
         raise Exception(e)
     else:
         datas = {}
         for data in data_qs:
             if is_name_index:
                 datas[data.name] = data.code
             else:
                 datas[data.code] = data.name
         return datas
Ejemplo n.º 10
0
 def gets(*args, **kwargs):
     try:
         data_qs = bw.gets(Code, *args, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data_qs