根据环境变量配置,有条件的执行saveCandle

This commit is contained in:
zhangkun 2024-12-10 16:19:28 +08:00
parent e75badf1b7
commit 6f3be66181
2 changed files with 8 additions and 4 deletions

View File

@ -1,13 +1,13 @@
package core package core
import ( import (
"crypto/sha256"
"encoding/hex"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/rand" "math/rand"
// "os" "os"
"crypto/sha256"
"encoding/hex"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -164,7 +164,11 @@ func (core *Core) SaveCandle(instId string, period string, rsp *CandleData, dura
Data: v, Data: v,
From: "rest", From: "rest",
} }
candle.SetToKey(core) //保存rest得到的candle
saveCandle := os.Getenv("TEXUS_SAVECANDLE")
if saveCandle == "true" {
candle.SetToKey(core)
}
// 发布到allCandles|publish, 给外部订阅者用于setToKey // 发布到allCandles|publish, 给外部订阅者用于setToKey
arys := []string{ALLCANDLES_PUBLISH} arys := []string{ALLCANDLES_PUBLISH}
if withWs { if withWs {

BIN
texus

Binary file not shown.