update 数据导出优化
This commit is contained in:
@@ -137,11 +137,13 @@ class MarketDataCalculator:
|
||||
# 保存小数点后两位,以亿为单位
|
||||
# monthly_data[month_col] = float(result[0]['avg_close']) * 1000 if result and result[0]['avg_close'] else None
|
||||
monthly_data[month_col] = round(float(result[0]['avg_close']) * 1000 / 100000000, 3) if result and result[0]['avg_close'] else None
|
||||
|
||||
|
||||
# 提取所有以 'ym_' 开头的键的值
|
||||
ym_values = [value for key, value in monthly_data.items() if key.startswith('ym_')]
|
||||
valid_ym_values = [value for value in ym_values if value is not None]
|
||||
|
||||
|
||||
|
||||
# 计算全部月的均值
|
||||
if valid_ym_values:
|
||||
average = sum(valid_ym_values) / len(valid_ym_values)
|
||||
|
||||
Reference in New Issue
Block a user