From 5b3d79a2818dba34bd36c3cec0aa914772caab08 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Mon, 12 Feb 2024 20:56:07 +0900 Subject: [PATCH] init --- stock/analysis/AnalyzerSqlite.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stock/analysis/AnalyzerSqlite.py b/stock/analysis/AnalyzerSqlite.py index e6c6e7d..6820676 100644 --- a/stock/analysis/AnalyzerSqlite.py +++ b/stock/analysis/AnalyzerSqlite.py @@ -788,11 +788,7 @@ class AnalyzerSqlite: trend_k_list = trend_k_df.values.tolist() for i, price in enumerate(stock['PRICE']): price['trend_k'] = trend_k_list[i][0] - else: - for i, price in enumerate(stock['PRICE']): - price['trend'] = stock['PRICE'][i]['avg120'] - price['trend_s'] = stock['PRICE'][i]['avg120'] - price['trend_k'] = stock['PRICE'][i]['avg120'] + size = int(len(close_list) / 2) pos = round(size / 2) @@ -803,6 +799,11 @@ class AnalyzerSqlite: trend_list = trend_df.values.tolist() for i, price in enumerate(stock['PRICE']): price['trend'] = trend_list[i][0] + else: + for i, price in enumerate(stock['PRICE']): + price['trend'] = stock['PRICE'][i]['avg120'] + price['trend_s'] = stock['PRICE'][i]['avg120'] + price['trend_k'] = stock['PRICE'][i]['avg120'] sorted_stock = sorted(stock["PRICE"], key=lambda x: x['ymd'], reverse=True)