public final class BuyAndHoldBenchmark extends Object
Using this example. Call run(start, end, capital) to obtain a separately simulated, funded S&P 500 account and its statistics. The source is the Yahoo price index, not a dividend-reinvested total-return index. Reuse the same dates and capital when comparing another strategy; join daily output by date, not array position.
| Modifier and Type | Class and Description |
|---|---|
static class |
BuyAndHoldBenchmark.Fill |
static class |
BuyAndHoldBenchmark.Point |
static interface |
BuyAndHoldBenchmark.PriceSource |
static class |
BuyAndHoldBenchmark.Result |
static class |
BuyAndHoldBenchmark.Statistics |
| Constructor and Description |
|---|
BuyAndHoldBenchmark() |
BuyAndHoldBenchmark(BuyAndHoldBenchmark.PriceSource source)
Inject cached prices or explicit offline fixtures; no market-data fallback is substituted.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
markOpenPositionMeasures(List<AllPerformanceMeasures.Metric> metrics) |
BuyAndHoldBenchmark.Result |
run(LocalDate start,
LocalDate end,
double capital) |
public static final String SYMBOL
public BuyAndHoldBenchmark()
public BuyAndHoldBenchmark(BuyAndHoldBenchmark.PriceSource source)
public BuyAndHoldBenchmark.Result run(LocalDate start, LocalDate end, double capital)
public static void markOpenPositionMeasures(List<AllPerformanceMeasures.Metric> metrics)
Copyright © 2026. All rights reserved.