请 [注册] 或 [登录]  | 返回主站

量化交易吧 /  量化平台 帖子:3364724 新帖:11

开源工具系列-(你的公司踩商誉减值的雷了吗)商誉与净利润分析工具

好的名字都没了发表于:5 月 10 日 06:34回复(1)

开源工具系列-(你的公司踩商誉减值的雷了吗)商誉与净利润分析工具

author: aaron-clark-aic
这货的其他文章目录

这周最热门的是什么?是很多公司年报大幅计提商誉,你经历过业绩大变脸吗?

这个小工具帮你计算下你的公司到底有多少商誉,你的净利润足够计提吗?

import datetime
#处理股票代码
class Stocks:

    def combineIdustryStocks(self,industries:list):
        return  np.hstack([get_industry_stocks(i)  for i in industries])

    def standardStocks(self,stockList):
        _stocks = list(get_all_securities('stock').index)
        _standardStocks = []
        for i in stockList:
            _standardStocks =_standardStocks [code for code in _stocks if code.upper().startswith(i)]
        return _standardStocks

class Goodwill:
    def get(self,stock):
        df = get_fundamentals(
            query(balance.good_will,
                     income.net_profit,
                     (balance.good_will/income.net_profit)*100
                     ).filter(
                # 这里不能使用 in 操作, 要使用in_()函数
                valuation.code == stock,
            ).order_by(
            ), date=datetime.date.today())
        return [('商誉(元)',df['good_will'].values[0]),('净利润(元)',df['net_profit'].values[0]),('商誉占净利润百分比%',df['anon_1'].values[0])]

_st = Stocks()
_gd = Goodwill()
print(_gd.get(stock=_st.standardStocks(stockList=['002422'])[0]))
import datetime
#处理股票代码
class Stocks:

    def combineIdustryStocks(self,industries:list):
        return  np.hstack([get_industry_stocks(i)  for i in industries])

    def standardStocks(self,stockList):
        _stocks = list(get_all_securities('stock').index)
        _standardStocks = []
        for i in stockList:
            _standardStocks =_standardStocks+[code for code in _stocks if code.upper().startswith(i)]
        return _standardStocks

class Goodwill:
    def get(self,stock):
        df = get_fundamentals(
            query(balance.good_will,
                     income.net_profit,
                     (balance.good_will/income.net_profit)*100
                     ).filter(
                # 这里不能使用 in 操作, 要使用in_()函数
                valuation.code == stock,
            ).order_by(
            ), date=datetime.date.today())
        return [('商誉(元)',df['good_will'].values[0]),('净利润(元)',df['net_profit'].values[0]),('商誉占净利润百分比%',df['anon_1'].values[0])]
_st = Stocks()
_gd = Goodwill()
print(_gd.get(stock=_st.standardStocks(stockList=['000915'])[0]))
[('商誉(元)', 26133366.0), ('净利润(元)', 108361032.0), ('商誉占净利润百分比%', 24.11694086)]
 

全部回复

0/140

量化课程

    移动端课程