changes 总资产报酬率公式

This commit is contained in:
P3ngSaM 2023-01-04 15:38:00 +08:00
parent 6dfbb85c32
commit 8a161a694a
1 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,8 @@ router = APIRouter()
class Params(BaseModel): class Params(BaseModel):
利润总额: float 净利润: float
所得税: float
利息费用: float 利息费用: float
期末资产总计: float 期末资产总计: float
期初资产总计: float 期初资产总计: float
@ -18,7 +19,7 @@ class Params(BaseModel):
def func(p: Params): def func(p: Params):
try: try:
d = (p.期末资产总计 + p.期初资产总计) / 2 d = (p.期末资产总计 + p.期初资产总计) / 2
result = (p.利润总额 + p.利息费用) / d * 100 result = (p.净利润 + p.所得税 + p.利息费用) / d * 100
return round(result, 2) return round(result, 2)
except ZeroDivisionError: except ZeroDivisionError: