gitee.com/quant1x/engine@v1.8.4/services/task_update_rzrq.go (about)

     1  package services
     2  
     3  import (
     4  	"gitee.com/quant1x/engine/cache"
     5  	"gitee.com/quant1x/engine/factors"
     6  	"gitee.com/quant1x/engine/market"
     7  	"gitee.com/quant1x/gox/logger"
     8  )
     9  
    10  func jobUpdateMarginTrading() {
    11  	logger.Infof("同步融资融券...")
    12  	updateMarginTrading()
    13  	logger.Infof("同步融资融券...OK")
    14  }
    15  
    16  func updateMarginTrading() {
    17  	date := cache.DefaultCanReadDate()
    18  	factors.MarginTradingTargetInit(date)
    19  	allCodes := market.GetCodeList()
    20  	for _, securityCode := range allCodes {
    21  		misc := factors.GetL5Misc(securityCode)
    22  		if misc == nil {
    23  			continue
    24  		}
    25  		rzrq, ok := factors.GetMarginTradingTarget(securityCode)
    26  		if ok {
    27  			misc.RZYEZB = rzrq.RZYEZB
    28  			factors.UpdateL5Misc(misc)
    29  		}
    30  	}
    31  	factors.RefreshL5Misc()
    32  }