Record Class WalkForwardSpec

java.lang.Object
java.lang.Record
com.qtsurfer.api.sdk.WalkForwardSpec
Record Components:
folds - how many sequential optimize-then-score windows to run. Two is the floor and the reason is structural rather than a tuning preference: parameter drift is measured between consecutive fold winners, and a single fold has no consecutive pair, so it would report the strongest possible stability having measured nothing. The ceiling is a platform setting; exceeding it is rejected.
inSamplePct - share of each fold's window spent optimizing, the rest being where its winner is scored. null takes the platform default. Lower values leave more data to score on and, on short sessions, are what let the requested fold count tile the data at all.

public record WalkForwardSpec(int folds, Integer inSamplePct) extends Record
Opt a sweep into walk-forward validation.

Attaching this changes what the sweep does, not just how much of it runs. Instead of scoring every parameter vector once over the whole range, the data is cut into sequential folds; each fold optimizes the whole grid on its own window and then scores only its winner on the window immediately after — data that winner was never chosen on. The question it answers is not "which parameters won" but "does re-optimizing this periodically actually work".

Omit it and nothing about the sweep changes, including the shape of the response.

It costs folds × grid. Four folds over a 500-point grid is roughly 2000 backtests where the plain sweep is 500, which is why it is opt-in. The platform rejects the request outright when that product exceeds its sweep budget.

It is a different sweep, not a variant of one. Two requests that differ only in this block do not deduplicate against each other.

The answer arrives as ExecuteSweepResult.getWalkForward() — see WalkForwardResult and Sweep.await() for how to read it.

  • Constructor Summary

    Constructors
    Constructor
    Description
    WalkForwardSpec(int folds, Integer inSamplePct)
    Creates an instance of a WalkForwardSpec record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the folds record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the inSamplePct record component.
    of(int folds)
    Walk forward over the given number of folds, leaving the in-sample share to the platform default.
    of(int folds, int inSamplePct)
    Walk forward over the given number of folds with an explicit in-sample share.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WalkForwardSpec

      public WalkForwardSpec(int folds, Integer inSamplePct)
      Creates an instance of a WalkForwardSpec record class.
      Parameters:
      folds - the value for the folds record component
      inSamplePct - the value for the inSamplePct record component
  • Method Details

    • of

      public static WalkForwardSpec of(int folds)
      Walk forward over the given number of folds, leaving the in-sample share to the platform default.
      Parameters:
      folds - how many sequential optimize-then-score windows to run; at least 2
      Returns:
      the spec
    • of

      public static WalkForwardSpec of(int folds, int inSamplePct)
      Walk forward over the given number of folds with an explicit in-sample share.
      Parameters:
      folds - how many sequential optimize-then-score windows to run; at least 2
      inSamplePct - share of each fold spent optimizing, within 10..90
      Returns:
      the spec
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • folds

      public int folds()
      Returns the value of the folds record component.
      Returns:
      the value of the folds record component
    • inSamplePct

      public Integer inSamplePct()
      Returns the value of the inSamplePct record component.
      Returns:
      the value of the inSamplePct record component