Package com.longbridge.grid
Class GridTrigger
- java.lang.Object
-
- com.longbridge.grid.GridTrigger
-
public final class GridTrigger extends Object
How a grid's up/down trigger thresholds are expressed. Percent and spread are mutually exclusive; use thepercent(java.math.BigDecimal, java.math.BigDecimal)/spread(java.math.BigDecimal, java.math.BigDecimal)factories to make the choice explicit instead of setting four independent fields.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimalgetDown()Returns the downward threshold.TriggerPriceTypegetType()Returns the trigger price type (percent or spread).BigDecimalgetUp()Returns the upward threshold.static GridTriggerpercent(BigDecimal up, BigDecimal down)Trigger by percent.static GridTriggerspread(BigDecimal up, BigDecimal down)Trigger by absolute price spread.StringtoString()
-
-
-
Method Detail
-
percent
public static GridTrigger percent(BigDecimal up, BigDecimal down)
Trigger by percent.- Parameters:
up- upward trigger percentdown- downward trigger percent- Returns:
- a percent trigger
-
spread
public static GridTrigger spread(BigDecimal up, BigDecimal down)
Trigger by absolute price spread.- Parameters:
up- upward trigger spreaddown- downward trigger spread- Returns:
- a spread trigger
-
getType
public TriggerPriceType getType()
Returns the trigger price type (percent or spread).- Returns:
- the trigger price type
-
getUp
public BigDecimal getUp()
Returns the upward threshold.- Returns:
- upward threshold
-
getDown
public BigDecimal getDown()
Returns the downward threshold.- Returns:
- downward threshold
-
-