Record Class StrategyNotice

java.lang.Object
java.lang.Record
com.wualabs.qtsurfer.engine.strategy.StrategyNotice
Record Components:
level - how much attention this deserves
code - stable, greppable identifier — clients may switch on it, so treat it as API
message - human-readable explanation, safe to show to a strategy author
All Implemented Interfaces:
Notice

public record StrategyNotice(@NonNull Notice.Level level, @NonNull String code, @NonNull String message) extends Record implements Notice
A Notice about the strategy itself rather than about one of its indicators — a condition that concerns the whole run, so it names neither an indicator nor an instrument.

Two are raised today, both for things a strategy author cannot otherwise discover when the run happens on a worker they have no logs for: the market-data source died (the strategy is blind and will stay blind until resubscribed) and update errors are being isolated (the feed survives, but some events never reached the strategy's logic).

Deduplicated by code() alone — the inherited default — because a strategy has exactly one market-data source and one update path, so a second occurrence is the same problem seen again. Conditions that can occur independently many times do not belong here: see StrategyPropertyNotice, which keys on the property as well.

  • Field Details

    • MARKET_DATA_SOURCE_FAILED

      public static final String MARKET_DATA_SOURCE_FAILED
      Raised when the market-data subscription terminates with an error. ERROR: no further data arrives on it, so every number the strategy produces from here on is stale.
      See Also:
    • UPDATE_ERRORS_ISOLATED

      public static final String UPDATE_ERRORS_ISOLATED
      Raised when a market-data event made the strategy's own update throw. WARN: the subscription deliberately survives (one bad event must not kill the feed), so the run continues — but it continues with gaps the author would otherwise never learn about.
      See Also:
  • Constructor Details

    • StrategyNotice

      public StrategyNotice(@NonNull @NonNull Notice.Level level, @NonNull @NonNull String code, @NonNull @NonNull String message)
      Creates an instance of a StrategyNotice record class.
      Parameters:
      level - the value for the level record component
      code - the value for the code record component
      message - the value for the message record component
  • Method Details

    • marketDataSourceFailed

      public static StrategyNotice marketDataSourceFailed(@NonNull @NonNull String sourceName, @NonNull @NonNull Throwable error)
      Builds the MARKET_DATA_SOURCE_FAILED notice.
      Parameters:
      sourceName - the market-data source that failed
      error - what it failed with
      Returns:
      the notice
    • updateErrorsIsolated

      public static StrategyNotice updateErrorsIsolated(@NonNull @NonNull Throwable error)
      Builds the UPDATE_ERRORS_ISOLATED notice.
      Parameters:
      error - the first error seen; later ones do not raise a second notice
      Returns:
      the notice
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • level

      @NonNull public @NonNull Notice.Level level()
      Returns the value of the level record component.
      Specified by:
      level in interface Notice
      Returns:
      the value of the level record component
    • code

      @NonNull public @NonNull String code()
      Returns the value of the code record component.
      Specified by:
      code in interface Notice
      Returns:
      the value of the code record component
    • message

      @NonNull public @NonNull String message()
      Returns the value of the message record component.
      Specified by:
      message in interface Notice
      Returns:
      the value of the message record component