Class ESPTradeTimer
- java.lang.Object
-
- com.caplin.motif.fx.ret.fxtrading.submission.esp.ESPTradeTimer
-
public class ESPTradeTimer extends java.lang.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ESPTradeTimer.GapTimeMode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
getGapTimeErrorCode(java.lang.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.void
invalidateEntry(java.lang.String currencyPair)
Invalidates an entry in the deal log.java.lang.String
toString()
-
-
-
Method Detail
-
getGapTimeErrorCode
@Nonnull public java.util.Optional<java.lang.String> getGapTimeErrorCode(java.lang.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(java.lang.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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-