java.lang.Object
com.caplin.motif.fx.ret.fxtrading.submission.esp.ESPTradeTimer

public class ESPTradeTimer extends Object
Contains rules that ensure a trade conforms to gap-time rules.

Use this class to check whether the trade should be rejected because of a gap-time limit.

The gap-time limit is best described as the time a user must wait between one-click trades. If the user tries to submit consecutive trades within the gap-time period, the first trade should pass and the remaining trades should fail. Gap-time is a concept supported in TrAPI, however the native implementation limits trades per proxy-client, which results in unpredictable behaviour when combined with our connection pool model involving shared proxy clients.

There are three settings for gap-time validation

  • Same pair -- will limit consecutive trades on the same currency by a user
  • All pairs -- will limit consecutive trades globally for a user
  • None -- won't limit consecutive trades

There should be one ESPTradeTimer per trade channel.

  • Method Details

    • getGapTimeErrorCode

      @Nonnull public Optional<String> getGapTimeErrorCode(String currencyPair)
      Returns false if the trade would breach the gap-time limit (too soon after the last trade) according to the mode; otherwise true.
    • invalidateEntry

      public void invalidateEntry(String currencyPair)
      Invalidates an entry in the deal log. Use this method if a deal has failed or been withdrawn to permit the submission of a new deal that may be within the gap time limit.
    • toString

      public String toString()
      Overrides:
      toString in class Object