fix average calculation
This commit is contained in:
parent
8fe7c0ca1b
commit
5e4e4272ab
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue