Files
gogobee/internal/plugin/forex_analysis_test.go
prosolis 3369d7d8fe gofmt: bring internal/ and cmd/ back to gofmt -l clean
Mechanical `gofmt -w ./internal ./cmd`. Mostly struct-field realignment that
had drifted, plus a few trailing-newline fixes. No behaviour change — gofmt is
semantics-preserving, and build/vet/test are green either side.

Split out from the code-review fixes that follow so those stay reviewable
instead of hiding inside a wall of realignment.
2026-07-10 07:18:07 -07:00

44 lines
1.1 KiB
Go

package plugin
import (
"math/rand/v2"
"testing"
)
func BenchmarkComputeSignalFromRates(b *testing.B) {
// Simulate 260 trading days of rates around 150 (JPY-like)
rates := make([]float64, 261)
for i := range rates {
rates[i] = 145 + rand.Float64()*10
}
currentRate := rates[len(rates)-1]
b.ResetTimer()
for b.Loop() {
fxComputeSignalFromRates(rates, currentRate)
}
}
func BenchmarkComputeSignalFromRates_CrossPairSize(b *testing.B) {
// Simulate cross-pair: 260 days of EUR/JPY-like rates
baseRates := make([]float64, 260)
quoteRates := make([]float64, 260)
for i := range baseRates {
baseRates[i] = 0.90 + rand.Float64()*0.10 // EUR/USD ~0.90-1.00
quoteRates[i] = 145 + rand.Float64()*10 // JPY/USD ~145-155
}
// Compute cross-rates (simulating the join)
crossRates := make([]float64, len(baseRates)+1)
for i := range baseRates {
crossRates[i] = quoteRates[i] / baseRates[i]
}
crossRates[len(baseRates)] = quoteRates[len(quoteRates)-1] / baseRates[len(baseRates)-1]
currentRate := crossRates[len(crossRates)-1]
b.ResetTimer()
for b.Loop() {
fxComputeSignalFromRates(crossRates, currentRate)
}
}