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

     1  package factors
     2  
     3  import (
     4  	"gitee.com/quant1x/engine/cache"
     5  	"gitee.com/quant1x/engine/datasource/dfcf"
     6  	"gitee.com/quant1x/exchange"
     7  )
     8  
     9  var (
    10  	__mapMarginTradingTargets = map[string]dfcf.SecurityMarginTrading{}
    11  )
    12  
    13  // MarginTradingTargetInit 一次性缓存两融数据, 交易日9点后更新上一个交易的两融数据
    14  func MarginTradingTargetInit(date string) {
    15  	clear(__mapMarginTradingTargets)
    16  	_, featureDate := cache.CorrectDate(date)
    17  	list := dfcf.GetMarginTradingList(featureDate)
    18  	for _, v := range list {
    19  		securityCode := exchange.CorrectSecurityCode(v.SecuCode)
    20  		__mapMarginTradingTargets[securityCode] = v
    21  	}
    22  }
    23  
    24  // GetMarginTradingTarget 获取两融数据
    25  func GetMarginTradingTarget(code string) (dfcf.SecurityMarginTrading, bool) {
    26  	securityCode := exchange.CorrectSecurityCode(code)
    27  	v, ok := __mapMarginTradingTargets[securityCode]
    28  	return v, ok
    29  }