up
This commit is contained in:
parent
9a83607b2c
commit
51f087589a
@ -15,14 +15,22 @@ import (
|
|||||||
|
|
||||||
simple "github.com/bitly/go-simplejson"
|
simple "github.com/bitly/go-simplejson"
|
||||||
"github.com/go-redis/redis"
|
"github.com/go-redis/redis"
|
||||||
"github.com/phyer/core/core"
|
|
||||||
"github.com/phyer/texus/utils"
|
"github.com/phyer/texus/utils"
|
||||||
logrus "github.com/sirupsen/logrus"
|
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 {
|
type Candle struct {
|
||||||
Id string `json:"_id"`
|
Id string `json:"_id"`
|
||||||
core *core.Core
|
Core CoreService // 改为接口类型
|
||||||
InstID string `json:"instID"`
|
InstID string `json:"instID"`
|
||||||
Period string `json:"period"`
|
Period string `json:"period"`
|
||||||
Data []interface{}
|
Data []interface{}
|
||||||
@ -37,7 +45,7 @@ type Candle struct {
|
|||||||
Confirm bool `json:"confirm"`
|
Confirm bool `json:"confirm"`
|
||||||
}
|
}
|
||||||
type Sample interface {
|
type Sample interface {
|
||||||
SetToKey(cr *Core) ([]interface{}, error)
|
SetToKey(cr *CoreService) ([]interface{}, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SampleList interface {
|
type SampleList interface {
|
||||||
@ -63,7 +71,7 @@ type MatchCheck struct {
|
|||||||
Matched bool
|
Matched bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cd *Candle) Filter(cr *Core) bool {
|
func (cd *Candle) Filter(cr *CoreService) bool {
|
||||||
myFocusList := cr.Cfg.Config.Get("focusList").MustArray()
|
myFocusList := cr.Cfg.Config.Get("focusList").MustArray()
|
||||||
founded := false
|
founded := false
|
||||||
for _, v := range myFocusList {
|
for _, v := range myFocusList {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package core
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -632,7 +632,7 @@ func (cr *Core) ProcessOrder(od *private.Order) error {
|
|||||||
// return res.V5Response, nil
|
// return res.V5Response, nil
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (cr *Core) AddToGeneralCandleChnl(candle *Candle, channels []string) {
|
func (cr *Core) AddToGeneralCandleChnl(candle *model.Candle, channels []string) {
|
||||||
redisCli := cr.RedisLocalCli
|
redisCli := cr.RedisLocalCli
|
||||||
ab, err := json.Marshal(candle)
|
ab, err := json.Marshal(candle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user