mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
0275e23b7e
- Add unified NofxOS API key configuration in IndicatorEditor - Add language field to StrategyConfig for consistent prompt generation - Auto-update prompt sections when interface language changes - Remove scattered URL inputs from CoinSourceEditor and IndicatorEditor - Create nofxos provider package with formatted data output - Update kernel engine to use config-based language setting
32 lines
625 B
Go
32 lines
625 B
Go
package nofxos
|
|
|
|
import "fmt"
|
|
|
|
// Language represents the language for formatting output
|
|
type Language string
|
|
|
|
const (
|
|
LangChinese Language = "zh-CN"
|
|
LangEnglish Language = "en-US"
|
|
)
|
|
|
|
// formatValue formats a numeric value with sign and appropriate suffix
|
|
func formatValue(v float64) string {
|
|
sign := "+"
|
|
if v < 0 {
|
|
sign = ""
|
|
}
|
|
absV := v
|
|
if absV < 0 {
|
|
absV = -absV
|
|
}
|
|
if absV >= 1e9 {
|
|
return fmt.Sprintf("%s%.2fB", sign, v/1e9)
|
|
} else if absV >= 1e6 {
|
|
return fmt.Sprintf("%s%.2fM", sign, v/1e6)
|
|
} else if absV >= 1e3 {
|
|
return fmt.Sprintf("%s%.2fK", sign, v/1e3)
|
|
}
|
|
return fmt.Sprintf("%s%.2f", sign, v)
|
|
}
|