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

量化交易吧 /  量化平台 帖子:3364737 新帖:1

企业的人均利润计算

量化王者发表于:5 月 23 日 20:00回复(1)

貌似是在吴军的谷歌方法论中看到过类似的论述,国家的竞争最终是人的竞争,企业的竞争也是一样。一家企业的人均利润如果逐年呈现上升态势,说明企业正走在正确的发展道路上。
所以我使用聚款数据将我期待的数据进行了查找并呈现,选取的股票都是多数机构评级较高的股票。

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from jqdata import finance
def profit_per_employ(stock_code):    
    d_employee = finance.run_query(
        query(
            finance.STK_EMPLOYEE_INFO        
        ).filter(
            finance.STK_EMPLOYEE_INFO.code==stock_code
        ).order_by(
            finance.STK_EMPLOYEE_INFO.end_date.desc()    
        ).limit(10)
    )    
    d_employee['profit'] = None
    d_employee['pro_rate'] = None
    p = np.zeros(len(d_employee))
    for i in range(len(d_employee)):
        
        d_temp = get_fundamentals(
            query(
                income.net_profit
            ).filter(
                income.code == stock_code
            ),date = d_employee.end_date.iloc[i]
        )     
        if len(d_temp)>0:
            p[i] = d_temp.net_profit.iloc[0].copy()
    d_employee.profit = p           
    d_employee = d_employee.drop(
        ['id','company_id','graduate_rate','middle_rate','college_rate','pub_date','retirement'] ,
        axis = 1)
    d_employee.pro_rate = (d_employee.profit / d_employee.employee).values
    d_employee.index = d_employee.end_date
    #d_employee.pro_rate.plot()
    return d_employee.name.iloc[0],d_employee.code.iloc[0],d_employee.pro_rate
s = '000776.002007.002371.002594.002677.002707.002747.300012.300037.\
    300070.300073.300144.300251.300747.300750.600030.600036.600054.\
    600305.600315.600588.600660.600754.600837.601211.601633.601688.\
    601766.603027.603288.603799.603866.603877.603899.000002.000024.\
    000063.000333.000568.000661.000858.001979.002024.002475.002511.\
    002624.002916.300003.600031.600048.600104.600323.600426.600438.\
    600486.600519.600809.600872.600887.601012.601155.601233.601336.\
    601888.603517.603588'
s = s.split('.')
s = np.sort(s)
lenth_s = len(s)
fig,axes = plt.subplots(33,2,figsize=(20,120))
fig.subplots_adjust( hspace = 0.5)

for i,ax in enumerate(axes.flat):
    n = normalize_code(s[i])
    name,code,pro_rate = profit_per_employ(n)    
    ax.plot(pro_rate,'-')
    title = code + '.' + name
    ax.set_title(title)
plt.show()

全部回复

0/140

达人推荐

量化课程

    移动端课程