示例#1
0
 def get(code, is_name=False):
     try:
         data = bw.get(Code, code=code)
         if is_name:
             data = data.name
     except Exception as e:
         raise Exception(e)
     return data
示例#2
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
示例#3
0
 def get_date(is_min=False, is_add_one=False):
     try:
         date = bw.get_date(ModelingInfo,
                            is_min=is_min,
                            is_add_one=is_add_one)
     except Exception as e:
         raise Exception(e)
     return date
示例#4
0
 def get_date(is_min=False, is_add_one=True):
     try:
         date = bw.get_date(MarketData,
                            is_min=is_min,
                            is_add_one=is_add_one)
     except Exception as e:
         raise Exception(e)
     return date
示例#5
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
示例#6
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
示例#7
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
示例#8
0
 def get_model(model_name, com_code, date):
     try:
         data = bw.get(ModelInfo,
                       model_name=model_name,
                       com_code=com_code,
                       date=date)
     except Exception as e:
         raise Exception(e)
     return data
示例#9
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
示例#10
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
示例#11
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
示例#12
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
示例#13
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
示例#14
0
 def delete(**kwargs):
     try:
         bw.delete(MyTrading, **kwargs)
     except Exception as e:
         raise Exception(e)
示例#15
0
 def insert(datas):
     try:
         bw.insert(Account, datas)
     except Exception as e:
         raise Exception(e)
示例#16
0
 def get(**kwargs):
     try:
         data = bw.get(MyTrading, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data
示例#17
0
 def insert(datas):
     try:
         bw.insert(MyTrading, datas)
     except Exception as e:
         raise Exception(e)
示例#18
0
 def delete_all():
     try:
         bw.delete(ModelInfo)
     except Exception as e:
         raise Exception(e)
示例#19
0
 def delete(**kwargs):
     try:
         bw.delete(ModelingInfo, **kwargs)
     except Exception as e:
         raise Exception(e)
示例#20
0
 def insert(datas):
     try:
         bw.insert(MarketData, datas)
     except Exception as e:
         raise Exception(e)
示例#21
0
 def delete(**kwargs):
     try:
         bw.delete(MarketData, **kwargs)
     except Exception as e:
         raise Exception(e)
示例#22
0
 def get_trading_account(t_type, t_count):
     try:
         data = bw.get(Account, t_type=t_type, t_count=t_count)
     except Exception as e:
         raise Exception(e)
     return data
示例#23
0
 def get(**kwargs):
     try:
         data = bw.get(Account, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data
示例#24
0
 def gets(*args, **kwargs):
     try:
         data_qs = bw.gets(Code, *args, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data_qs
示例#25
0
 def delete(**kwargs):
     try:
         bw.delete(Account, **kwargs)
     except Exception as e:
         raise Exception(e)
示例#26
0
 def insert(datas):
     try:
         bw.insert(Code, datas)
     except Exception as e:
         raise Exception(e)
示例#27
0
 def get(**kwargs):
     try:
         data = bw.get(ModelingInfo, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data
示例#28
0
 def get(**kwargs):
     try:
         data = bw.get(MarketData, **kwargs)
     except Exception as e:
         raise Exception(e)
     return data
示例#29
0
 def delete(**kwargs):
     try:
         bw.delete(Code, **kwargs)
     except Exception as e:
         raise Exception(e)
示例#30
0
 def insert(datas):
     try:
         bw.insert(ModelingInfo, datas)
     except Exception as e:
         raise Exception(e)