44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
|
|
package com.quantai.trader.domain;
|
||
|
|
|
||
|
|
import com.quantai.trader.enums.TraderSide;
|
||
|
|
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
import java.time.Instant;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
public record TraderPositionPath(
|
||
|
|
String runId,
|
||
|
|
String cycleId,
|
||
|
|
String actionId,
|
||
|
|
String positionId,
|
||
|
|
TraderSide side,
|
||
|
|
Instant entryTime,
|
||
|
|
Instant lastEventTime,
|
||
|
|
BigDecimal entryPrice,
|
||
|
|
BigDecimal currentPrice,
|
||
|
|
BigDecimal mfeBps,
|
||
|
|
BigDecimal maeBps,
|
||
|
|
Long timeToTargetMs,
|
||
|
|
Long timeToInvalidMs,
|
||
|
|
boolean targetBeforeStop,
|
||
|
|
boolean stagnationTimeoutHit,
|
||
|
|
boolean proxyOnly,
|
||
|
|
boolean reduceSeen,
|
||
|
|
int filledLegCount,
|
||
|
|
BigDecimal totalPositionRatio,
|
||
|
|
Map<String, Object> pathSummary
|
||
|
|
) {
|
||
|
|
|
||
|
|
public TraderPositionPath {
|
||
|
|
pathSummary = Maps.immutable(pathSummary);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean opened() {
|
||
|
|
return positionId != null && filledLegCount > 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean fullSize() {
|
||
|
|
return totalPositionRatio != null && totalPositionRatio.compareTo(BigDecimal.ONE) >= 0;
|
||
|
|
}
|
||
|
|
}
|