fix(market): handle invalid period in calculateDonchian

This commit is contained in:
tinkle-community
2026-01-17 21:43:14 +08:00
parent 5c79aa451e
commit cbe753b9e6
2 changed files with 19 additions and 1 deletions

View File

@@ -1213,7 +1213,7 @@ func ExportCalculateBOLL(klines []Kline, period int, multiplier float64) (upper,
// calculateDonchian calculates Donchian channel (highest high, lowest low) for given period
func calculateDonchian(klines []Kline, period int) (upper, lower float64) {
if len(klines) == 0 {
if len(klines) == 0 || period <= 0 {
return 0, 0
}