class Stock(Resource): def __init__(self): self.dao = StockDao() self.df = StockDfo() def get(self): result = self.dao.find_all() print(result) print(type(result)) return jsonify([item.json for item in result])
def get(keyword: str): """ 유저 아이디를 받아와 해당 유저 객채를 리턴한다 Parameter: User ID 를 받아온다 return: 해당 아이디 유저 객체 """ print('===========Emotion=============') print(keyword) try: print(f'Emotion is {keyword}') stockNews = StockDao.find_by_keyword(keyword) print('=============확인==============') if stockNews: return jsonify([item.json for item in stockNews]) except Exception as e: print(e) return {'error': 'Emotion not found'}, 404
with app.app_context(): db.create_all() emotion = session.query(EmotionDto) emotion_find_key = EmotionDao.find_by_keyword(keyword) # ====================== kain code ============================== status_count = CovidStatusDao.count() # =============================================================== # emotion_find_x = EmotionDao.find_x(keyword) # emotion_find_y = EmotionDao.find_y(keyword) # emotion_like = EmotionDao.find_like(keyword) # emotion_match = EmotionDao.match(emotion, keyword) # emotion_fi_insert = EmotionDao.find_insert(emotion, keyword) emotion_count = EmotionDao.count() stock_new_count = StockNewsDao.count() stock_count = StockDao.count() finance_count = FinanceDao.count() exchange_count = ExchangeDao.count() print(type(keyword)) print(f'***** Emotion Total Count is {emotion_count} *****') if emotion_count[0] == 0: # if emotion_find == 0: EmotionDao.bulk() # elif emotion_find_x == 0: # elif emotion_like != 2: # elif emotion_match != 3: elif emotion_find_key == 0: EmotionDao.bulk() print('ok!') elif emotion_find_key == 1: EmotionDao.find_update(keyword)
def __init__(self): self.dao = StockDao() self.df = StockDfo()
code_df = FinanceKdd() # EmotionDfo.data_pro(0, keyword) EmotionDfo.data_pro(0, keyword) FinanceKdd.get_finance(0, keyword, code_df) ExchangeKdd.market_index_kdd(0) ExchangeDfo.get_ex_df(0) # FinanceDfo.fina_pro(keyword) with app.app_context(): db.create_all() # ====================== kain code ============================== status_count = CovidStatusDao.count() # =============================================================== emotion_count = EmotionDao.count() stock_new_count = StockNewsDao.count() stock_count = StockDao.count() finance_count = FinanceDao.count() exchange_count = ExchangeDao.count() # user user_count = UserDao.count() review_count = ReviewDao.count() print(f'***** Emotion Total Count is {emotion_count} *****') if emotion_count[0] == 0: EmotionDao.bulk() else: EmotionDao.find_keyword(keyword) print(f'***** StockNews Total Count is {stock_new_count} *****') if stock_new_count[0] == 0: StockNewsDao.bulk() else: