Enum Class FillPolicy

java.lang.Object
java.lang.Enum<FillPolicy>
com.quantfinlib.backtest.FillPolicy
All Implemented Interfaces:
Serializable, Comparable<FillPolicy>, Constable

public enum FillPolicy extends Enum<FillPolicy>
When an order decided on bar t is filled. Shared by every bar engine (Backtester, backtest.portfolio.PortfolioBacktester, alpha.AlphaBacktester).

Signals in this library are computed from bars up to and including close(t). A fill at that same close assumes the order went in before the closing print using a price that did not exist yet, which is not attainable. NEXT_OPEN is the default everywhere: decide on the close, trade at the next bar's open. The gap between a CLOSE run and a NEXT_OPEN run measures how much of a strategy's edge lives inside one bar of latency; fast mean-reversion signals often lose most of it.

  • Enum Constant Details

    • CLOSE

      public static final FillPolicy CLOSE
      Fill at close(t), the decision bar's own close. Optimistic: use it to measure the zero-latency upper bound, not to report results.
    • NEXT_OPEN

      public static final FillPolicy NEXT_OPEN
      Fill at open(t + 1). The default.
    • NEXT_CLOSE

      public static final FillPolicy NEXT_CLOSE
      Fill at close(t + 1): a market-on-close order submitted one bar after the decision, the usual convention in daily cross-sectional research.
  • Method Details

    • values

      public static FillPolicy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FillPolicy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • lagBars

      public int lagBars()
      Bars between the decision bar and the fill bar (0 or 1).