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

     1  package factors
     2  
     3  import (
     4  	"gitee.com/quant1x/engine/cache"
     5  	"gitee.com/quant1x/gotdx/securities"
     6  	"time"
     7  )
     8  
     9  // GetTimestamp 时间戳
    10  //
    11  //	格式: YYYY-MM-DD hh:mm:ss.SSS
    12  func GetTimestamp() string {
    13  	now := time.Now()
    14  	return now.Format(cache.TimeStampMilli)
    15  }
    16  
    17  // PriceDigits 获取证券标的价格保留小数点后几位
    18  //
    19  //	默认范围2, 即小数点后2位
    20  func PriceDigits(securityCode string) int {
    21  	securityInfo, ok := securities.CheckoutSecurityInfo(securityCode)
    22  	if !ok {
    23  		return 2
    24  	}
    25  	return int(securityInfo.DecimalPoint)
    26  }