gitee.com/quant1x/engine@v1.8.4/factors/feature_f10_capital.go (about)

     1  package factors
     2  
     3  import (
     4  	"gitee.com/quant1x/engine/datasource/dfcf"
     5  )
     6  
     7  // ComputeFreeCapital 计算自由流通股本
     8  func ComputeFreeCapital(holderList []dfcf.CirculatingShareholder, capital float64) (top10Capital, freeCapital, capitalChanged, increaseRatio, reductionRatio float64) {
     9  	increase := 0
    10  	reduce := 0
    11  	for k, holder := range holderList {
    12  		top10Capital += float64(holder.HoldNum)
    13  		capitalChanged += float64(holder.HoldNumChange)
    14  		if holder.HoldNumChange >= 0 {
    15  			increase += holder.HoldNumChange
    16  		} else {
    17  			reduce += holder.HoldNumChange
    18  		}
    19  		if k >= 10 {
    20  			continue
    21  		}
    22  		if holder.FreeHoldNumRatio >= 1.00 && holder.IsHoldOrg == "1" {
    23  			capital -= float64(holder.HoldNum)
    24  		}
    25  	}
    26  	increaseRatio = 100.0000 * (float64(increase) / top10Capital)
    27  	reductionRatio = 100.0000 * (float64(reduce) / top10Capital)
    28  	return top10Capital, capital, capitalChanged, increaseRatio, reductionRatio
    29  }