sim

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package sim runs financial simulation. It generates cycles from data, and runs strategies on each cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cycles

func Cycles(data []*pb.Record, num, size int) iter.Seq[[]*pb.Record]

Cycles generates num cycles of length size from data, moving from the end:

data[size:], data[size-12:len(data)-12], etc.

func NewRunner

func NewRunner(cycles, cycleLenMonths int, rfs []strategy.RebalanceFunc) *runner

NewRunner creates a runner to run simulations with cycles of given length in months and rebalancers.

Types

type Result

type Result struct {
	// Start is the beginning balance.
	Start fin.Cents
	// End holds descriptive statistics of the end balance of a sample of
	// multiple cycles, run through simulation.
	End stat.Description
}

Result is a output of a simulation. It holds the beginning balance and descriptive statistics about the end sample.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL