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
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
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
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
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
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
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
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
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
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
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
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
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
def delete(**kwargs): try: bw.delete(MyTrading, **kwargs) except Exception as e: raise Exception(e)
def insert(datas): try: bw.insert(Account, datas) except Exception as e: raise Exception(e)
def get(**kwargs): try: data = bw.get(MyTrading, **kwargs) except Exception as e: raise Exception(e) return data
def insert(datas): try: bw.insert(MyTrading, datas) except Exception as e: raise Exception(e)
def delete_all(): try: bw.delete(ModelInfo) except Exception as e: raise Exception(e)
def delete(**kwargs): try: bw.delete(ModelingInfo, **kwargs) except Exception as e: raise Exception(e)
def insert(datas): try: bw.insert(MarketData, datas) except Exception as e: raise Exception(e)
def delete(**kwargs): try: bw.delete(MarketData, **kwargs) except Exception as e: raise Exception(e)
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
def get(**kwargs): try: data = bw.get(Account, **kwargs) except Exception as e: raise Exception(e) return data
def gets(*args, **kwargs): try: data_qs = bw.gets(Code, *args, **kwargs) except Exception as e: raise Exception(e) return data_qs
def delete(**kwargs): try: bw.delete(Account, **kwargs) except Exception as e: raise Exception(e)
def insert(datas): try: bw.insert(Code, datas) except Exception as e: raise Exception(e)
def get(**kwargs): try: data = bw.get(ModelingInfo, **kwargs) except Exception as e: raise Exception(e) return data
def get(**kwargs): try: data = bw.get(MarketData, **kwargs) except Exception as e: raise Exception(e) return data
def delete(**kwargs): try: bw.delete(Code, **kwargs) except Exception as e: raise Exception(e)
def insert(datas): try: bw.insert(ModelingInfo, datas) except Exception as e: raise Exception(e)