gitee.com/quant1x/engine@v1.8.4/market/subnew.go (about)

     1  package market
     2  
     3  import (
     4  	"gitee.com/quant1x/exchange"
     5  	"gitee.com/quant1x/gotdx/securities"
     6  	"sync"
     7  )
     8  
     9  const (
    10  	// 次新股板块
    11  	kBlockSubNewStock = "880529"
    12  )
    13  
    14  var (
    15  	onceSubNew     sync.Once
    16  	mapSubnewStock = map[string]bool{}
    17  )
    18  
    19  func loadSubNewStock() {
    20  	blockInfo := securities.GetBlockInfo(kBlockSubNewStock)
    21  	if blockInfo == nil {
    22  		return
    23  	}
    24  	for _, v := range blockInfo.ConstituentStocks {
    25  		securityCode := exchange.CorrectSecurityCode(v)
    26  		mapSubnewStock[securityCode] = true
    27  	}
    28  }
    29  
    30  // IsSubNewStock 是否次新股
    31  func IsSubNewStock(code string) bool {
    32  	onceSubNew.Do(loadSubNewStock)
    33  	securityCode := exchange.CorrectSecurityCode(code)
    34  	if v, ok := mapSubnewStock[securityCode]; ok {
    35  		return v
    36  	}
    37  	return false
    38  }