} financial_growth_ability_map2 = { "op_profit_growth_yoy": "op_yoy", "net_profit_growth_yoy": "ni_yoy", "total_profit_growth_yoy": "ebt_yoy", "inc_net_profit_shareholders_deducted_yoy": "deducted_net_profit_growth_yoy", "net_op_cash_flows_yoy": "cfo_yoy", "net_operate_cash_flow_ps_yoy": "cfo_ps_yoy", "total_assets_relative_of_year": "asset_relative", "bps_relativeof_year": "bps_relative", "equity_relative_of_year": "equity_relative", } add_func_to_value(financial_growth_ability_map, first_item_to_float) class ChinaStockFinanceGrowthAbilityRecorder(EmBaseChinaStockFinanceRecorder2): """ 财务指标-成长能力 """ data_schema = FinanceGrowthAbility finance_report_type = 'FinanceGrowthAbility' data_type = 5 def get_data_map(self): return financial_growth_ability_map
# 券商相关 # 拆入资金净增加额 "fi_borrowing_increase": "Niborrowfund", # 代理买卖证券收到的现金净额 "fi_cash_from_trading_agent": "Agenttradesecurityrec", # 回购业务资金净增加额 "fi_cash_from_repurchase_increase": "Nibuybackfund", # 处置交易性金融资产的净减少额 "fi_disposal_trade_asset_decrease": "Nddisptradefasset", # 回购业务资金净减少额 "fi_repurchase_decrease": "Ndbuybackfund", # 代理买卖证券支付的现金净额(净减少额) "fi_cash_to_agent_trade": "Agenttradesecuritypay", } add_func_to_value(cash_flow_map, first_item_to_float) cash_flow_map["report_period"] = ("ReportDate", to_report_period_type) cash_flow_map["report_date"] = ("ReportDate", to_pd_timestamp) class ChinaStockCashFlowRecorder(BaseChinaStockFinanceRecorder): data_schema = CashFlowStatement url = 'https://emh5.eastmoney.com/api/CaiWuFenXi/GetXianJinLiuLiangBiaoList' finance_report_type = 'XianJinLiuLiangBiaoList' data_type = 4 def get_data_map(self): return cash_flow_map
from zvt.utils.utils import add_func_to_value, first_item_to_float capital_structure_map = { 'debt_asset_ratio': 'LIBILITYTOASSET', # 资产负债率 'em': 'ASSETSTOEQUITY', # 权益乘数 'ca_to_asset': 'CATOASSET', # 流动资产/总资产 'nc_to_asset': 'NCATOASSET', # 非流动资产/总资产 'tangible_assets_to_asset': 'TANGIBLEASSETSTOASSET', # 有形资产/总资产 'equity_to_total_capital': 'EQUITYTOTOTALCAPITAL', # 归属母公司股东的权益/全部投入资本 'interest_liblity_to_total_capital': 'INTERESTLIBILITYTOTOTALCAPITAL', # 带息负债/全部投入资本 'cl_to_libility': 'CLTOLIBILITY', # 流动负债/负债合计 'cnl_to_libility': 'NCLTOLIBILITY', # 非流动负债/负债合计 'interest_liblity_to_libility': 'INTERESLIBILITYTOLIBILITY', # 有息负债率 } add_func_to_value(capital_structure_map, first_item_to_float) class ChinaStockFinanceCapitalStructure(EmBaseChinaStockFinanceRecorder): """ 财务指标-资本结构 """ data_schema = FinanceCapitalStructure finance_report_type = 'FinanceCapitalStructure' data_type = 16 def get_data_map(self): return capital_structure_map
from zvt.utils.utils import add_func_to_value, first_item_to_float financial_operational_capability_map = { 'fixed_assets_turnover_rate': 'FATURNRATIO', # 固定资产周转率 'current_asset_turnover_rate': 'CATURNRATIO', # 流动资产周转率 'total_assets_turnover': 'ASSETTURNRATIO', # 总资产周转率 'inventory_turnover': 'INVTURNRATIO', # 存货周转率 'inventory_turnover_days': 'INVTURNDAYS', # 存货周转天数 'receivables_turnover': 'ARTURNRATIO', # 应收账款周转率(含应收票据) 'receivables_turnover_days': 'ARTURNDAYS', # 应收账款周转天数(含应收票据) 'operating_cycle': 'TURNDAYS', # 营业周期 # 'accounts_payable_turnover_rate': 'ACCOUNTSTURNOVERRATIO', # 应付账款周转率 'accounts_payable_turnover_days': 'APTURNDAYS', # 应付账款周转天数(含应付票据) } add_func_to_value(financial_operational_capability_map, first_item_to_float) class ChinaStockFinanceOperationalCapabilityRecorder( EmBaseChinaStockFinanceRecorder): """ 财务指标-盈利能力 """ data_schema = FinanceOperationalCapability finance_report_type = 'FinanceOperationalCapability' data_type = 6 def get_data_map(self): return financial_operational_capability_map
'fi_operate_income': 'OPERATEINCOME', # 经营活动净收益 'fi_investment_income': 'INVESTINCOME', # 价值变动净收益 'fi_ebit': 'EBIT', # 息税前利润 'fi_ebitda': 'EBITDA', # 息税折旧摊销前利润 'fi_extraordinary_item': 'EXTRAORDINARY', # 非经常性损益 'fi_deducted_income': 'DEDUCTEDINCOME', # 扣除非经常性损益后的归属于上市公司股东的净利润 'fi_free_cash_flow_firm': 'FCFF', # 企业自由现金流量 'fi_free_cash_flow_equity': 'FCFE', # 股权自由现金流量 'fi_depreciation_amortization': 'DA', # 折旧与摊销 # 'EBIAT':'',#息前税后利润 # 'N_INT_EXP':'',#净利息费用 # 'INT_CL':'',#带息流动负债 # 'IC':'',#投入资本 } add_func_to_value(finance_derivative_map, first_item_to_float) class ChinaStockFinanceDerivativeRecorder(EmBaseChinaStockFinanceRecorder): """ 财务衍生数据 """ data_schema = FinanceDerivative finance_report_type = 'FinanceDerivative' data_type = 4 def get_data_map(self): return finance_derivative_map
"non_op_profit_to_ebt": "NONOPERATEPROFITTOEBT", # 所得税/利润总额 "tax_to_ebt": "TAXTOEBT", # 扣除非经常性损益的净利润/净利润 "deducted_profit_to_ebt": "DEDUCTEDPROFITTOEBT", # 经营活动净收益/利润总额 "op_income_to_ebt": "OPERATEINCOMETOEBT", # 经营活动净收益/利润总额(TTM) "op_income_to_ebt_ttm": "OPERATEINCOMETOEBTTTM", # 价值变动净收益/利润总额(TTM) "invest_income_to_ebt_ttm": "INVESTINCOMETOEBTTTM", # 营业外收支净额/利润总额(TTM) "non_op_profit_to_ebt_ttm": "NONOPERATEPROFITTOEBTTTM", } add_func_to_value(finance_qualityofearnings_map, first_item_to_float) class ChinaStockFinanceRevenueQualityRecorder( EmBaseChinaStockFinanceIndexRecorder): """ 财务指标-收益质量 """ data_schema = FinanceRevenueQuality finance_report_type = 'FinanceRevenueQuality' data_type = 8 def get_data_map(self): return finance_qualityofearnings_map
# -*- coding: utf-8 -*- from zvt.domain import FinanceSinglEquarterDerivative from zvt.recorders.emquantapi.finance.base_china_stock_finance_recorder import EmBaseChinaStockFinanceRecorder from zvt.utils.utils import add_func_to_value, first_item_to_float finance_singlequarterderivative_map = { # 更新时间 'fi_investment_income': 'INVESTINCOME', # 价值变动净收益 'fi_gross_margin': 'GROSSMARGIN', # 毛利 'deducted_net_profit': 'DEDUCTEDINCOME', # 扣除非经常性损益后的净利润 'fi_extraordinary_item': 'EXTRAORDINARY', # 非经常性损益 'fi_operate_income': 'OPERATEINCOME', # 经营活动净收益 } add_func_to_value(finance_singlequarterderivative_map, first_item_to_float) class ChinaStockFinanceSinglEquarterDerivativeRecorder( EmBaseChinaStockFinanceRecorder): """ 财务指标-单季财务衍生数据 """ data_schema = FinanceSinglEquarterDerivative finance_report_type = 'FinanceSinglEquarterDerivative' data_type = 11 def get_data_map(self): return finance_singlequarterderivative_map
'total_operating_revenue_ps': 'GRPS', # 每股营业总收入 'operating_revenue_pee': 'ORPS', # 每股营业收入 # 'operating_profit_ps': '', # 每股营业利润 'earnings_bf_interest_taxes_ps': 'EBITPS', # 每股息税前利润 'capital_reserve_ps': 'CAPITALRESERVEPS', # 每股资本公积 'surplus_reserve_fund_ps': 'SURPLUSRESERVEPS', # 每股盈余公积 'undistributed_profit_ps': 'UNDISTRIBUTEDPS', # 每股未分配利润 'retained_earnings_ps': 'RETAINEDPS', # 每股留存收益 'net_operate_cash_flow_ps': 'CFOPS', # 每股经营活动产生的现金流量净额 'net_cash_flow_ps': 'CFPS', # 每股现金流量净额 'free_cash_flow_firm_ps': 'FCFFPS', # 每股企业自由现金流量 'free_cash_flow_equity_ps': 'FCFEPS', # 每股股东自由现金流量 # 'RESER_PS': '', # 每股公积金 } add_func_to_value(finance_per_share_map, first_item_to_float) class ChinaStockFinancePerShareRecorder(EmBaseChinaStockFinanceRecorder): data_schema = FinancePerShare finance_report_type = 'FinancePerShare' data_type = 7 def get_data_map(self): return finance_per_share_map __all__ = ['ChinaStockFinancePerShareRecorder']
# 'REVENUE': '', # 营业收入 # 'ROA': '', # 总资产收益率(平均) # 'SELL_EXP': '', # 销售费用 # 'T_ASSETS': '', # 总资产 # 'T_ASSETS_A': '', # 平均总资产 # 'T_ASSETS_BGN': '', # 年初总资产 # 'T_CA': '', # 流动资产 # 'T_COGS': '', # 营业总成本 # 'T_LIAB': '', # 总负债 # 'T_LIAB_A': '', # 平均总负债 # 'T_LIAB_BGN': '', # 年初总负债 # 'T_NCA': '', # 非流动资产 # 'T_REVENUE': '', # 营业总收入 # 'VAL_CHG_PROFIT': '', # 价值变动净收益 } add_func_to_value(finance_dupont_map, first_item_to_float) class ChinaStockFinanceDuPontRecorder(EmBaseChinaStockFinanceRecorder): """ 财务指标-杜邦分析 """ data_schema = FinanceDuPont finance_report_type = 'FinanceDuPont' data_type = 11 def get_data_map(self): return finance_dupont_map
financial_debtpayingability_map = { 'cfo_to_gr': 'CFOTOGR', #经营活动产生的现金流量净额/营业总收入 'sales_cash_intoor': 'SALESCASHINTOOR', # 销售商品提供劳务收到的现金/营业收入 'qcfi_to_cf': 'QCFITOCF', # 投资活动产生的现金流量净额占比 'qcfo_to_cfo': 'QCFOTCFO', # 经营活动产生的现金流量净额占比 'qcfo_to_or': 'QCFOTOOR', # 经营活动产生的现金流量净额/营业收入 'qcfo_to_operate_income': 'QCFOTOOPERATEINCOME', # 经营活动产生的现金流量净额/经营活动净收益 'qcff_to_cf': 'QCFFTOCF', # 筹资活动产生的现金流量净额占比 # 'ADV_R_R': '', # 预收款项/营业收入 # 'AR_R': '', # 应收账款/营业收入 # 'P_FIXA_O_DA': '', # 投资支出/折旧和摊销 # 'C_RCVRY_A': '', # 全部资产现金回收率 # 'N_CF_OPA_OP': '', # 经营活动产生的现金流量净额/营业利润 } add_func_to_value(financial_debtpayingability_map, first_item_to_float) class ChinaStockFinanceReceivingAbilityRecorder(EmBaseChinaStockFinanceRecorder ): """ 财务指标-收现能力 """ data_schema = FinanceReceivingAbility finance_report_type = 'FinanceReceivingAbility' data_type = 9 def get_data_map(self): return financial_debtpayingability_map
# 应付手续费及佣金 "fi_fees_and_commissions_payable": "commission_payable", # 应付分保账款 "fi_dividend_payable_for_reinsurance": "reinsurance_payables", # 应付赔付款 # "fi_claims_payable": "compensation_payable", # 应付保单红利 # "fi_policy_holder_dividend_payable": "interest_insurance_payable", # 保户储金及投资款 # "fi_policy_holder_deposits_and_investment_funds": "investment_money", # 保险合同准备金 "fi_contract_reserve": "insurance_contract_reserves", } add_func_to_value(balance_sheet_map, first_item_to_float) balance_sheet_map["report_period"] = ("ReportDate", to_report_period_type) balance_sheet_map["report_date"] = ("ReportDate", to_pd_timestamp) class JqStockBalanceSheetRecorder(BaseJqStockFinanceRecorder): data_schema = BalanceSheet # 合并资产负债表 # STK_BALANCE_SHEET finance_report_type = 'BALANCE_SHEET' data_type = 3 def get_data_map(self): return balance_sheet_map
financial_balancesheetstructureanalysis_map = { 'cfo_to_gr': 'CFOTOGR', #经营活动产生的现金流量净额/营业总收入 'sales_cash_intoor': 'SALESCASHINTOOR', # 销售商品提供劳务收到的现金/营业收入 'qcfi_to_cf': 'QCFITOCF', # 投资活动产生的现金流量净额占比 'qcfo_to_cfo': 'QCFOTCFO', # 经营活动产生的现金流量净额占比 'qcfo_to_or': 'QCFOTOOR', # 经营活动产生的现金流量净额/营业收入 'qcfo_to_operate_income': 'QCFOTOOPERATEINCOME', # 经营活动产生的现金流量净额/经营活动净收益 'qcff_to_cf': 'QCFFTOCF', # 筹资活动产生的现金流量净额占比 # 'ADV_R_R': '', # 预收款项/营业收入 # 'AR_R': '', # 应收账款/营业收入 # 'P_FIXA_O_DA': '', # 投资支出/折旧和摊销 # 'C_RCVRY_A': '', # 全部资产现金回收率 # 'N_CF_OPA_OP': '', # 经营活动产生的现金流量净额/营业利润 } add_func_to_value(financial_balancesheetstructureanalysis_map, first_item_to_float) class ChinaStockFinanceBalanceSheetStructureAnalysisRecorder( EmBaseChinaStockFinanceRecorder): """ 财务指标-资产负债表结构分析 """ data_schema = FinanceBalanceSheetStructureAnalysis finance_report_type = 'FinanceBalanceSheetStructureAnalysis' data_type = 10 def get_data_map(self): return financial_balancesheetstructureanalysis_map
"preview_type": "type", # 预告净利润(下限) "profit_min": "profit_min", # 预告净利润(上限) "profit_max": "profit_max", # 去年同期净利润(上限) "profit_last": "profit_last", # 预告净利润变动幅度(下限)单位:% "profit_ratio_min": "profit_ratio_min", # 预告净利润变动幅度(上限)单位:% "profit_ratio_max": "profit_ratio_max", # 预告内容 "content": "content", } add_func_to_value(performance_forecast_map, first_item_to_float) performance_forecast_map["report_period"] = ("ReportDate", to_report_period_type) performance_forecast_map["report_date"] = ("ReportDate", to_pd_timestamp) class JqStockPerformanceForecastRecorder(BaseJqStockFinanceRecorder): data_schema = StockPerformanceForecast # 业绩预告 # STK_FIN_FORCAST finance_report_type = 'FIN_FORCAST' data_type = 4 def get_data_map(self): return performance_forecast_map __all__ = ['JqStockPerformanceForecastRecorder']
# -*- coding: utf-8 -*- from zvt.domain import FinanceIncomeStatementStructureAnalysis from zvt.recorders.emquantapi.finance.base_china_stock_finance_recorder import EmBaseChinaStockFinanceRecorder from zvt.utils.utils import add_func_to_value, first_item_to_float finance_incomestatementstructureanalysis_map = { 'financial_expense_rate': 'QFINAEXPENSETOGR', # 财务费用与营业总收入之比 'operating_profit_to_total_profit': 'QOPERATEINCOMETOEBT', # 经营活动净收益与利润总额之比 'net_profit_to_total_operate_revenue': 'QNITOGR', # 净利润与营业总收入之比 'admin_expense_rate': 'QADMINEXPENSETOGR', # 管理费用与营业总收入之比 'operating_profit_to_operating_revenue': 'QOPTOGR', # 营业利润与营业总收入之比 'total_operating_cost_to_total_operating_income': 'QGCTOGR', # 营业总成本与营业总收入之比 } add_func_to_value(finance_incomestatementstructureanalysis_map, first_item_to_float) class ChinaStockFinanceIncomeStatementStructureAnalysisRecorder( EmBaseChinaStockFinanceRecorder): """ 财务指标-利润表结构分析 """ data_schema = FinanceIncomeStatementStructureAnalysis finance_report_type = 'FinanceIncomeStatementStructureAnalysis' data_type = 10 def get_data_map(self): return finance_incomestatementstructureanalysis_map
# 其他业务收入 "fi_other_income": "other_income", # 保险相关 # 已赚保费 "fi_net_income_from_premium": "premiums_earned", # 退保金 "fi_insurance_surrender_costs": "refunded_premiums", # 保单红利支出 "fi_dividend_expenses_to_insured": "policy_dividend_payout", # 分保费用 "fi_reinsurance_expenses": "reinsurance_cost", } add_func_to_value(income_statement_qtr_map, first_item_to_float) class ChinaStockIncomeStatementQtrRecorder(BaseChinaStockFinanceQtrRecorder): data_schema = IncomeStatementQtr finance_report_type = 'IncomeStatementQSHSZ' data_type = 2 def get_data_map(self): return income_statement_qtr_map __all__ = ['ChinaStockIncomeStatementQtrRecorder'] if __name__ == '__main__':
# # 净资本 "broker_net_capital": "Netcapital", # 净资产 "broker_net_assets": "Netassets", # 净资本/净资产 "broker_net_capital_assets_ratio": "Captialrate", # 自营固定收益类证券规模/净资本 "broker_self_operated_fixed_income_securities_net_capital_ratio": "Incomesizerate", } add_func_to_value(finance_factor_map, to_float) finance_factor_map["report_period"] = ("ReportDate", to_report_period_type) finance_factor_map["report_date"] = ("ReportDate", to_pd_timestamp) class JqStockFinanceFactorRecorder(BaseJqStockFinanceRecorder): finance_report_type = 'ZhuYaoZhiBiaoList' data_schema = FinanceFactor data_type = 1 def get_data_map(self): return finance_factor_map __all__ = ['JqStockFinanceFactorRecorder']
financial_profitability_map = { 'gross_income_ratio': 'GPMARGIN', # 销售毛利率 'net_profit_ratio': 'NPMARGIN', # 销售净利率 'roe_diluted': 'ROEDILUTED', # 净资产收益率ROE(摊薄) 'roe_avg': 'ROEAVG', # 净资产收益率ROE(平均) 'roe_wa': 'ROEWA', # 净资产收益率ROE(加权) 'roe_ex_diluted': 'ROEEXDILUTED', # 净资产收益率ROE(扣除/摊薄) 'roe_ex_wa': 'ROEEXWA', # 净资产收益率ROE(扣除/加权) 'net_roa': 'NROA', # 总资产净利率ROA 'roa': 'ROA', # 总资产报酬率ROA 'roic': 'ROIC' # 投入资本回报率ROIC } add_func_to_value(financial_profitability_map, first_item_to_float) class ChinaStockFinanceProfitAbilityRecorder(EmBaseChinaStockFinanceRecorder): """ 财务指标-盈利能力 """ data_schema = FinanceProfitAbility finance_report_type = 'FinanceProfitAbility' data_type = 8 def get_data_map(self): return financial_profitability_map
# 审计单位 "audit_unit": "AGENCY", # 审计单位薪酬 "audit_unit_pay": "AUDITPAY", # 审计年限(境内) "audit_year": "AUDITYEAR", # 非标意见说明 # "non_standard_opinion_description": "INTERPRETATION", # 审计意见类别 "audit_opinion_category": "CATEGORY", # 签字注册会计师 "CPA": "CPA", } add_func_to_value(audit_opinions_map, first_item_to_float) class ChinaStockAuditOpinionsRecorder(EmBaseChinaStockFinanceRecorder): data_schema = AuditOpinions finance_report_type = 'AuditOpinions' data_type = 17 def get_data_map(self): return audit_opinions_map __all__ = ['ChinaStockAuditOpinionsRecorder']