fix average calculation

This commit is contained in:
Larry Ruane 2022-04-13 16:22:40 -06:00
parent 8fe7c0ca1b
commit 5e4e4272ab
2 changed files with 4 additions and 5 deletions

View File

@ -272,8 +272,9 @@ func startServer(opts *common.Options) error {
walletrpc.RegisterDarksideStreamerServer(server, service)
}
// Initialize price fetcher
if !opts.Darkside {
common.StartPriceFetcher(dbPath, chainName)
}
// Start listening
listener, err := net.Listen("tcp", opts.GRPCBindAddr)

View File

@ -109,10 +109,8 @@ func median(inp []float64) (median float64) {
l := len(inp)
if l == 0 {
return -1
} else if l == 2 {
return (inp[0] + inp[1]) / 2
} else if l%2 == 0 {
return (inp[l/2-1] + inp[l/2+1]) / 2
return (inp[l/2-1] + inp[l/2]) / 2
} else {
return inp[l/2]
}