26 lines
937 B
Java
26 lines
937 B
Java
|
|
package com.quantai.trader.domain;
|
||
|
|
|
||
|
|
import static com.quantai.trader.util.TraderNumbers.*;
|
||
|
|
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
|
||
|
|
public record TraderPricePlanContext(
|
||
|
|
String pricePlanId,
|
||
|
|
String pricePlanConfigHash,
|
||
|
|
BigDecimal stopDistanceBps,
|
||
|
|
BigDecimal targetDistanceBps,
|
||
|
|
int maxHoldMinutes,
|
||
|
|
BigDecimal costBps
|
||
|
|
) {
|
||
|
|
public TraderPricePlanContext {
|
||
|
|
pricePlanId = requiredText(pricePlanId, "pricePlan.pricePlanId");
|
||
|
|
pricePlanConfigHash = requiredText(pricePlanConfigHash, "pricePlan.pricePlanConfigHash");
|
||
|
|
stopDistanceBps = positive(stopDistanceBps, "pricePlan.stopDistanceBps");
|
||
|
|
targetDistanceBps = positive(targetDistanceBps, "pricePlan.targetDistanceBps");
|
||
|
|
if (maxHoldMinutes <= 0) {
|
||
|
|
throw new IllegalArgumentException("pricePlan.maxHoldMinutes must be > 0");
|
||
|
|
}
|
||
|
|
costBps = nonNegative(costBps, "pricePlan.costBps");
|
||
|
|
}
|
||
|
|
}
|