indexcalculation/基本信用评级指标/偿债能力/总债务_EBITDA.py

27 lines
587 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from fastapi import APIRouter
from pydantic import BaseModel
INDEX = "总债务/EBITDA"
router = APIRouter()
class Params(BaseModel):
短期借款: float
长期借款: float
利润总额: float
计入财务费用的利息支出: float
@router.post("/{}".format(INDEX))
def func(p: Params):
try:
result = (p.短期借款 + p.长期借款) / (p.利润总额 + p.计入财务费用的利息支出)
return round(result, 6)
except ZeroDivisionError:
return "算式无意义"
except Exception:
return "计算错误"