Class RiskConfig

java.lang.Object
com.wualabs.qtsurfer.engine.strategy.RiskConfig

public final class RiskConfig extends Object
The risk half of an ExecutionConfig: the opt-in guards that stop a strategy from buying straight back in after a loss, from holding too many positions at once, or from losing more than a day's budget.

Every knob is OFF by default, so a strategy that configures none of them behaves exactly as it did before the guards existed. Unlike BacktestConfig these apply live as well as in a backtest — the funnel enforces them on both paths, which is what makes them execution configuration rather than backtest configuration.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap.
    int
    How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.
    double
    How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap.
    long
    How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown.
    Optional macro-reset seam: while set, a tripped guard stays tripped until this returns true — ScalpingV2's "fail" state, which only clears on a full macro-cycle reset.
    void
    setMaxConcurrentPositions(int maxConcurrentPositions)
    How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap.
    void
    setMaxConsecutiveLosses(int maxConsecutiveLosses)
    How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.
    void
    setMaxDailyLoss(double maxDailyLoss)
    How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap.
    void
    setReentryCooldownMs(long reentryCooldownMs)
    How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown.
    void
    Optional macro-reset seam: while set, a tripped guard stays tripped until this returns true — ScalpingV2's "fail" state, which only clears on a full macro-cycle reset.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RiskConfig

      public RiskConfig()
  • Method Details

    • getMaxConsecutiveLosses

      public int getMaxConsecutiveLosses()
      How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.
    • getReentryCooldownMs

      public long getReentryCooldownMs()
      How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown. Measured from signal timestamps, so a backtest replaying historical stamps sees the same behaviour as a live run.
    • getReentryResetCondition

      public BooleanSupplier getReentryResetCondition()
      Optional macro-reset seam: while set, a tripped guard stays tripped until this returns true — ScalpingV2's "fail" state, which only clears on a full macro-cycle reset. Not a reflected @StrategyProperty: it is a live predicate wired programmatically, not a scalar. null (the default) means no macro gate.
    • getMaxConcurrentPositions

      public int getMaxConcurrentPositions()
      How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap. Counted as locked balances, so adding to a position already held (a DCA entry) is not a new position.
    • getMaxDailyLoss

      public double getMaxDailyLoss()
      How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap. Measured as the day's cumulative net, so a later win that recovers the day lifts the block.
    • setMaxConsecutiveLosses

      public void setMaxConsecutiveLosses(int maxConsecutiveLosses)
      How many consecutive losing cycles trip the re-entry guard. 0 (the default) disables the streak trigger; 1 means a single losing cycle trips it.
    • setReentryCooldownMs

      public void setReentryCooldownMs(long reentryCooldownMs)
      How long, in milliseconds of engine clock, new entries stay blocked after the losing cycle that tripped the guard. 0 (the default) means no cooldown. Measured from signal timestamps, so a backtest replaying historical stamps sees the same behaviour as a live run.
    • setReentryResetCondition

      public void setReentryResetCondition(BooleanSupplier reentryResetCondition)
      Optional macro-reset seam: while set, a tripped guard stays tripped until this returns true — ScalpingV2's "fail" state, which only clears on a full macro-cycle reset. Not a reflected @StrategyProperty: it is a live predicate wired programmatically, not a scalar. null (the default) means no macro gate.
    • setMaxConcurrentPositions

      public void setMaxConcurrentPositions(int maxConcurrentPositions)
      How many instruments the strategy may hold a funded position in at once. 0 (the default) means no cap. Counted as locked balances, so adding to a position already held (a DCA entry) is not a new position.
    • setMaxDailyLoss

      public void setMaxDailyLoss(double maxDailyLoss)
      How much realised, post-fee loss the strategy may take in one UTC day of engine clock before new entries are refused, as a positive amount in the output currency. 0 (the default) means no cap. Measured as the day's cumulative net, so a later win that recovers the day lifts the block.