def days_adv_receipts_y(): '''预收账款周转天数''' return MetricsMeta('f_days_adv_receipts_y', expr.Div( expr.Multi(expr.Get('f_adv_receipts_ave_y'), expr.Value(360)), expr.Get('revenue', period='y')), display='预收账款周转天数')
def days_prepayment_y(): '''预付账款周转天数''' return MetricsMeta('f_days_prepayment_y', expr.Div( expr.Multi(expr.Get('f_prepayment_ave_y'), expr.Value(360)), expr.Get('oper_cost', period='y')), display='预付账款周转天数')
def days_inventory_y(): '''存货周转天数''' return MetricsMeta('f_days_inventory_y', expr.Div( expr.Multi(expr.Get('f_inventory_ave_y'), expr.Value(360)), expr.Get('oper_cost', period='y')), display='存货周转天数')
def days_acct_payable_y(): '''应付账款周转天数''' return MetricsMeta('f_days_acct_payable_y', expr.Div( expr.Multi(expr.Get('f_acct_payable_ave_y'), expr.Value(360)), expr.Sub(expr.Get('oper_cost', period='y'), expr.Get('inventories', period='y'))), display='应付账款周转天数')
def market_cap(base: int, moat: int): ''' 估算总市值 = 净资产 * (1+滚动roe) ^ (基本因子+护城河因子+成长因子) ''' return expr.Multi(expr.Get('total_hldr_eqy_exc_min_int'), expr.Power(expr.Sum(expr.Value(1), expr.Get('f_roe_ttm')), expr.Sum(base_factor(base), moat_factor(moat), growth_factor())))
def price_selling(price_share: expr.Expr): '''卖出价''' return expr.Multi(price_share, premium_rate())
def price_buying(price_share: expr.Expr): '''买入价''' return expr.Multi(price_share, safety_factor())