You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.0 KiB
88 lines
3.0 KiB
|
2 months ago
|
"""
|
||
|
|
财务数据模型
|
||
|
|
"""
|
||
|
|
from datetime import datetime, date
|
||
|
|
from sqlalchemy import Column, Integer, String, BigInteger, Numeric, Date, DateTime
|
||
|
|
from app.db.base import Base
|
||
|
|
|
||
|
|
|
||
|
|
class FinanceBalanceSheet(Base):
|
||
|
|
"""资产负债表"""
|
||
|
|
__tablename__ = "finance_balance_sheet"
|
||
|
|
|
||
|
|
id = Column(BigInteger, primary_key=True, index=True)
|
||
|
|
code = Column(String(20), nullable=False, index=True)
|
||
|
|
report_date = Column(Date, nullable=False, index=True)
|
||
|
|
report_type = Column(Integer)
|
||
|
|
statement_type = Column(Integer)
|
||
|
|
|
||
|
|
# 资产
|
||
|
|
total_assets = Column(Numeric(18, 4))
|
||
|
|
total_cur_assets = Column(Numeric(18, 4))
|
||
|
|
total_noncur_assets = Column(Numeric(18, 4))
|
||
|
|
currency_cap = Column(Numeric(18, 4))
|
||
|
|
notes_receivable = Column(Numeric(18, 4))
|
||
|
|
acct_receivable = Column(Numeric(18, 4))
|
||
|
|
inventory = Column(Numeric(18, 4))
|
||
|
|
fix_assets = Column(Numeric(18, 4))
|
||
|
|
|
||
|
|
# 负债
|
||
|
|
total_liab = Column(Numeric(18, 4))
|
||
|
|
total_cur_liab = Column(Numeric(18, 4))
|
||
|
|
total_noncur_liab = Column(Numeric(18, 4))
|
||
|
|
notes_payable = Column(Numeric(18, 4))
|
||
|
|
acct_payable = Column(Numeric(18, 4))
|
||
|
|
st_borrowing = Column(Numeric(18, 4))
|
||
|
|
lt_loan = Column(Numeric(18, 4))
|
||
|
|
|
||
|
|
# 权益
|
||
|
|
tot_share_equity = Column(Numeric(18, 4))
|
||
|
|
|
||
|
|
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||
|
|
|
||
|
|
|
||
|
|
class FinanceCashFlow(Base):
|
||
|
|
"""现金流量表"""
|
||
|
|
__tablename__ = "finance_cash_flow"
|
||
|
|
|
||
|
|
id = Column(BigInteger, primary_key=True, index=True)
|
||
|
|
code = Column(String(20), nullable=False, index=True)
|
||
|
|
report_date = Column(Date, nullable=False, index=True)
|
||
|
|
report_type = Column(Integer)
|
||
|
|
statement_type = Column(Integer)
|
||
|
|
|
||
|
|
net_cash_flows_opera_act = Column(Numeric(18, 4))
|
||
|
|
net_cash_flows_inv_act = Column(Numeric(18, 4))
|
||
|
|
net_cash_flows_fin_act = Column(Numeric(18, 4))
|
||
|
|
net_incr_cash_and_cash_equ = Column(Numeric(18, 4))
|
||
|
|
cash_recp_sg_and_rs = Column(Numeric(18, 4))
|
||
|
|
cash_pay_goods_services = Column(Numeric(18, 4))
|
||
|
|
|
||
|
|
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||
|
|
|
||
|
|
|
||
|
|
class FinanceIncome(Base):
|
||
|
|
"""利润表"""
|
||
|
|
__tablename__ = "finance_income"
|
||
|
|
|
||
|
|
id = Column(BigInteger, primary_key=True, index=True)
|
||
|
|
code = Column(String(20), nullable=False, index=True)
|
||
|
|
report_date = Column(Date, nullable=False, index=True)
|
||
|
|
report_type = Column(Integer)
|
||
|
|
statement_type = Column(Integer)
|
||
|
|
|
||
|
|
tot_opera_rev = Column(Numeric(18, 4))
|
||
|
|
opera_rev = Column(Numeric(18, 4))
|
||
|
|
tot_opera_cost = Column(Numeric(18, 4))
|
||
|
|
opera_profit = Column(Numeric(18, 4))
|
||
|
|
total_profit = Column(Numeric(18, 4))
|
||
|
|
net_pro_incl_min_int_inc = Column(Numeric(18, 4))
|
||
|
|
basic_eps = Column(Numeric(12, 6))
|
||
|
|
diluted_eps = Column(Numeric(12, 6))
|
||
|
|
rd_exp = Column(Numeric(18, 4))
|
||
|
|
selling_exp = Column(Numeric(18, 4))
|
||
|
|
admin_exp = Column(Numeric(18, 4))
|
||
|
|
fin_exp = Column(Numeric(18, 4))
|
||
|
|
|
||
|
|
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|