up
This commit is contained in:
parent
9a83607b2c
commit
51f087589a
@ -15,16 +15,24 @@ import (
|
||||
|
||||
simple "github.com/bitly/go-simplejson"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/phyer/core/core"
|
||||
"github.com/phyer/texus/utils"
|
||||
logrus "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// 定义核心服务接口
|
||||
type CoreService interface {
|
||||
GetCfg() *simple.Json
|
||||
GetRedisLocalCli() *redis.Client
|
||||
AddToGeneralCandleChnl(candle *Candle, channels []string)
|
||||
PeriodToMinutes(period string) (int64, error)
|
||||
// 其他需要的方法...
|
||||
}
|
||||
|
||||
type Candle struct {
|
||||
Id string `json:"_id"`
|
||||
core *core.Core
|
||||
InstID string `json:"instID"`
|
||||
Period string `json:"period"`
|
||||
Id string `json:"_id"`
|
||||
Core CoreService // 改为接口类型
|
||||
InstID string `json:"instID"`
|
||||
Period string `json:"period"`
|
||||
Data []interface{}
|
||||
From string `json:"from"`
|
||||
Timestamp time.Time `json:"timeStamp"`
|
||||
@ -37,7 +45,7 @@ type Candle struct {
|
||||
Confirm bool `json:"confirm"`
|
||||
}
|
||||
type Sample interface {
|
||||
SetToKey(cr *Core) ([]interface{}, error)
|
||||
SetToKey(cr *CoreService) ([]interface{}, error)
|
||||
}
|
||||
|
||||
type SampleList interface {
|
||||
@ -63,7 +71,7 @@ type MatchCheck struct {
|
||||
Matched bool
|
||||
}
|
||||
|
||||
func (cd *Candle) Filter(cr *Core) bool {
|
||||
func (cd *Candle) Filter(cr *CoreService) bool {
|
||||
myFocusList := cr.Cfg.Config.Get("focusList").MustArray()
|
||||
founded := false
|
||||
for _, v := range myFocusList {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package core
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -632,7 +632,7 @@ func (cr *Core) ProcessOrder(od *private.Order) error {
|
||||
// return res.V5Response, nil
|
||||
// }
|
||||
|
||||
func (cr *Core) AddToGeneralCandleChnl(candle *Candle, channels []string) {
|
||||
func (cr *Core) AddToGeneralCandleChnl(candle *model.Candle, channels []string) {
|
||||
redisCli := cr.RedisLocalCli
|
||||
ab, err := json.Marshal(candle)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user