1、合约止盈止损单在减仓单成交之后再取消

This commit is contained in:
2025-04-11 09:06:09 +08:00
parent a9fc1c87f5
commit d4c8e692a7
10 changed files with 142 additions and 86 deletions

View File

@ -162,14 +162,19 @@ func handleTickerAllMessage(msg []byte) {
}
}
//行情存储时间
lastUtc := utcTime - 1000*60*60
if _, err := helper.DefaultRedis.RemoveBeforeScore(lastPriceKey, float64(lastUtc)); err != nil {
log.Errorf("移除 合约交易对:%s %d之前的最新成交价失败,err:%v", symbol, lastUtc, err)
}
val, _ := helper.DefaultRedis.GetAllList(rediskey.CacheSymbolLastPrice)
if err := helper.DefaultRedis.AddSortSet(lastPriceKey, float64(utcTime), lastPrice.String()); err != nil {
log.Errorf("添加 合约交易对:%s %d之前的最新成交价失败,err:%v", symbol, lastUtc, err)
if utility.ContainsStr(val, symbol) {
//行情存储时间
lastUtc := utcTime - 1000*60*60
content := fmt.Sprintf("%d:%s", utcTime, lastPrice.String())
if _, err := helper.DefaultRedis.RemoveBeforeScore(lastPriceKey, float64(lastUtc)); err != nil {
log.Errorf("移除 合约交易对:%s %d之前的最新成交价失败,err:%v", symbol, lastUtc, err)
}
if err := helper.DefaultRedis.AddSortSet(lastPriceKey, float64(utcTime), content); err != nil {
log.Errorf("添加 合约交易对:%s %d之前的最新成交价失败,err:%v", symbol, lastUtc, err)
}
}
}