Documentation
¶
Overview ¶
Package examples ships the bundled strategies inside the binary.
The Go file lives here, beside the .js files, rather than under internal/ with a copy of them. Two copies would drift, and examples/ at the repository root is where anyone browsing on GitHub looks first.
Embedding is what makes `pyrite run --example golden-cross` work from a downloaded binary with nothing checked out, no API key and nothing else installed. That is the shortest path from finding the project to seeing a real result on real data, and it is worth a few kilobytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Example ¶
type Example struct {
Name string `json:"name"`
// Label is a short human name derived from the file name, for a chart
// legend or a metrics column. Title is a full sentence and is documentation
// rather than a label; using it as one produces a legend nobody can read.
Label string `json:"label"`
// Title and Summary are read from the leading comment block, so each file
// stays the single source of truth rather than duplicating a description
// into a Go table that will drift from it.
Title string `json:"title"`
Summary string `json:"summary"`
Code string `json:"code"`
// Universe, Benchmarks and Warmup come from header directives in the
// file, so a bundled example runs correctly with no flags at all.
Universe []string `json:"universe,omitempty"`
Benchmarks []string `json:"benchmarks,omitempty"`
Warmup int `json:"warmup,omitempty"`
AllowShort bool `json:"allow_short,omitempty"`
// NeedsModel marks an example that calls a model inside the backtest, so
// the CLI can say why it will not run without one.
NeedsModel bool `json:"needs_model,omitempty"`
}
Example is one bundled strategy.
Click to show internal directories.
Click to hide internal directories.