guarantee-admin-api-v0.2/Modules/Models/ScoreAndRankModel.py

90 lines
5.1 KiB
Python
Raw Normal View History

2022-06-02 16:57:45 +08:00
"""
打分评级模型
"""
from Modules.Company.CompanyObject import FinancialData
from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr, Validate
class CreditIndexScore(SpecObject):
compensation = ValidateAttr(field="compensation", type=[float, int], default=None)
compensation_rate = ValidateAttr(field="compensation_rate", type=[float, int], default=None)
compensation_reserve_ratio = ValidateAttr(field="compensation_reserve_ratio", type=[float, int], default=None)
cash_assets_ratio = ValidateAttr(field="cash_assets_ratio", type=[float, int], default=None)
risk_reserve_adequacy_ratio = ValidateAttr(field="risk_reserve_adequacy_ratio", type=[float, int], default=None)
current_ratio = ValidateAttr(field="current_ratio", type=[float, int], default=None)
growth_ability = ValidateAttr(field="growth_ability", type=[float, int], default=None)
guaranteed_insured_balance_growth_rate = ValidateAttr(field="guaranteed_insured_balance_growth_rate", type=[float, int], default=None)
guaranteed_revenue_growth_rate = ValidateAttr(field="guaranteed_revenue_growth_rate", type=[float, int], default=None)
growth_rate_of_total_assets = ValidateAttr(field="growth_rate_of_total_assets", type=[float, int], default=None)
guaranteed_asset_quality = ValidateAttr(field="guaranteed_asset_quality", type=[float, int], default=None)
single_customer_concentration = ValidateAttr(field="single_customer_concentration", type=[float, int], default=None)
current_guarantee_compensation_rate = ValidateAttr(field="current_guarantee_compensation_rate", type=[float, int], default=None)
financing_guarantee_magnification = ValidateAttr(field="financing_guarantee_magnification", type=[float, int], default=None)
industry_concentration = ValidateAttr(field="industry_concentration", type=[float, int], default=None)
current_compensation_recovery_rate = ValidateAttr(field="current_compensation_recovery_rate", type=[float, int], default=None)
enterprise_size = ValidateAttr(field="enterprise_size", type=[float, int], default=None)
paid_capital = ValidateAttr(field="paid_capital", type=[float, int], default=None)
guarantee_business_income = ValidateAttr(field="guarantee_business_income", type=[float, int], default=None)
profitability = ValidateAttr(field="profitability", type=[float, int], default=None)
return_total_assets = ValidateAttr(field="return_total_assets", type=[float, int], default=None)
operating_margin = ValidateAttr(field="operating_margin", type=[float, int], default=None)
roe = ValidateAttr(field="roe", type=[float, int], default=None)
capital_structure = ValidateAttr(field="capital_structure", type=[float, int], default=None)
actual_asset_liability_ratio = ValidateAttr(field="actual_asset_liability_ratio", type=[float, int], default=None)
capital_adequacy_ratio = ValidateAttr(field="capital_adequacy_ratio", type=[float, int], default=None)
fields_map = {
"compensation": "代偿能力",
"compensation_rate": "代偿保障率(%)",
"compensation_reserve_ratio": "代偿准备金比率(%)",
"cash_assets_ratio": "现金类资产比率(%)",
"risk_reserve_adequacy_ratio": "风险准备金充足率(%)",
"current_ratio": "流动比率(%)",
"growth_ability": "成长能力",
"guaranteed_insured_balance_growth_rate": "担保在保余额增长率(%)",
"guaranteed_revenue_growth_rate": "担保收入增长率(%)",
"growth_rate_of_total_assets": "资产总额增长率(%)",
"guaranteed_asset_quality": "担保资产质量",
"single_customer_concentration": "单一客户集中度(%)",
"current_guarantee_compensation_rate": "当期担保代偿率(%)",
"financing_guarantee_magnification": "融资担保放大倍数(倍)",
"industry_concentration": "行业集中度(%)",
"current_compensation_recovery_rate": "当期代偿回收率(%)",
"enterprise_size": "企业规模",
"paid_capital": "实收资本(亿元)",
"guarantee_business_income": "担保业务收入(万元)",
"profitability": "盈利能力",
"return_total_assets": "总资产收益率(%)",
"operating_margin": "营业利润率(%)",
"roe": "净资产收益率(%)",
"capital_structure": "资本结构",
"actual_asset_liability_ratio": "实际资产负债率(%)",
"capital_adequacy_ratio": "资本充足率(%)"
}
class ScoreAndRankModel(SpecObject):
rid = ValidateAttr(field="rid", type=str)
cid = ValidateAttr(field="cid", type=str)
report_date = ValidateAttr(field="report_date", func=Validate.date_format)
rank_level = ValidateAttr(field="rank_level", type=str)
rank_score = ValidateAttr(field="rank_score", type=float)
credit_index_score = ValidateAttr(field="credit_index_score", type=CreditIndexScore)
fields_map = {
"rid": "评价ID",
"cid": "企业ID",
"report_date": "报告期",
"rank_level": "信用级别",
"rank_score": "信用得分",
"credit_index_score": "信用指标得分"
}