fix setting.

This commit is contained in:
2026-02-27 13:34:31 +08:00
parent fc5a1be7e1
commit 3b7eeb22a9

View File

@@ -9,6 +9,10 @@ import (
"git.apinb.com/quant/gostock/internal/models" "git.apinb.com/quant/gostock/internal/models"
) )
var (
DefaultClosedPnl float64 = 9
)
func Run(key string, ymd int) { func Run(key string, ymd int) {
log.Println("Run Mock Order.") log.Println("Run Mock Order.")
var stocks []*models.StratModel var stocks []*models.StratModel
@@ -87,7 +91,7 @@ func Report() {
} }
// 3.判断盈亏超过10%,才确定平仓 // 3.判断盈亏超过10%,才确定平仓
if pnlRate >= 10 { if pnlRate >= DefaultClosedPnl {
impl.DBService.Model(&models.MockPosition{}).Where("id=?", p.ID).Updates(map[string]any{ impl.DBService.Model(&models.MockPosition{}).Where("id=?", p.ID).Updates(map[string]any{
"close_price": newClosePrice, "close_price": newClosePrice,
"pnl": pnl, "pnl": pnl,