package servicemanager import ( "github.com/shopspring/decimal" "os" "wss-pool/cmd/selfMarketSpot" "wss-pool/config" "wss-pool/internal/data" red "wss-pool/internal/redis" "wss-pool/logging/applogger" ) // Gather func SelfMarketSpot(checkStr, ipServer, addrServer, symbol string) { red.RedisClient = red.RedisInit(config.Config.Redis.DbEleven) data.Mgo_init(config.Config.Mongodb) data.InitGorm(config.Config.Bourse) if symbol == "" { applogger.Error("Lack of symbol") os.Exit(400) } //初始价格优先数据库 res := selfMarketSpot.GetNewPrice(symbol) if len(res) > 0 { selfMarketSpot.InitialPrice = decimal.RequireFromString(res[0].Close) } if selfMarketSpot.InitialPrice.IsZero() { selfMarketSpot.InitialPrice, _ = decimal.NewFromString(checkStr) } if selfMarketSpot.InitialPrice.IsZero() { applogger.Error("Lack of initial price") os.Exit(400) } selfMarketSpot.SelfSymbol = symbol applogger.Info("现货", selfMarketSpot.SelfSymbol, "初始价格", selfMarketSpot.InitialPrice) // Enable collaborative data collection selfMarketSpot.NewSelfMarketSpot() }