fix: 修复计算机未按权重计算的问题
This commit is contained in:
@@ -133,6 +133,7 @@ class Calculator:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
self._get_weight()
|
||||||
self.price_ftb, self.fluctuating_ftb = self._get_ftb_price()
|
self.price_ftb, self.fluctuating_ftb = self._get_ftb_price()
|
||||||
self.price_ss, self.fluctuating_ss = self._get_ss_price()
|
self.price_ss, self.fluctuating_ss = self._get_ss_price()
|
||||||
self.price_fhb, self.fluctuating_fhb = self._get_fhb_price()
|
self.price_fhb, self.fluctuating_fhb = self._get_fhb_price()
|
||||||
@@ -204,8 +205,6 @@ class Calculator:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_recommend_price(self, round_by=10):
|
def _get_recommend_price(self, round_by=10):
|
||||||
self._get_weight()
|
|
||||||
|
|
||||||
if not self.previous_prices:
|
if not self.previous_prices:
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
@@ -231,7 +230,7 @@ class Calculator:
|
|||||||
|
|
||||||
def _get_weight(self):
|
def _get_weight(self):
|
||||||
# 如果有上月数据按上月权重计算 无则平均数
|
# 如果有上月数据按上月权重计算 无则平均数
|
||||||
if self._previous_prices:
|
if self.previous_prices:
|
||||||
self.weight_ftb = self._previous_prices.weight_ftb
|
self.weight_ftb = self._previous_prices.weight_ftb
|
||||||
self.weight_ss = self._previous_prices.weight_ss
|
self.weight_ss = self._previous_prices.weight_ss
|
||||||
self.weight_fhb = self._previous_prices.weight_fhb
|
self.weight_fhb = self._previous_prices.weight_fhb
|
||||||
|
@@ -39,11 +39,11 @@ if __name__ == '__main__':
|
|||||||
from core.factory import ClientApp
|
from core.factory import ClientApp
|
||||||
|
|
||||||
with ClientApp().app_context():
|
with ClientApp().app_context():
|
||||||
calculate(2024, 4)
|
calculate(2025, 3)
|
||||||
|
|
||||||
# for i in range(2, 12):
|
# for i in range(2, 12):
|
||||||
# calculate(2022, i+1)
|
# calculate(2022, i+1)
|
||||||
# for i in range(0, 12):
|
# for i in range(1, 5+1):
|
||||||
# calculate(2023, i+1)
|
# calculate(2025, i)
|
||||||
# for i in range(6-1, 10):
|
# for i in range(6-1, 10):
|
||||||
# calculate(2024, i+1)
|
# calculate(2024, i+1)
|
||||||
|
Reference in New Issue
Block a user