45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
|
|
package com.quantai.trader.domain;
|
||
|
|
|
||
|
|
import com.quantai.trader.enums.TraderFeedbackSource;
|
||
|
|
import com.quantai.trader.enums.TraderFeedbackType;
|
||
|
|
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
import java.time.Instant;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
public record TraderAppFeedback(
|
||
|
|
String runId,
|
||
|
|
String cycleId,
|
||
|
|
String actionId,
|
||
|
|
TraderFeedbackType feedbackType,
|
||
|
|
TraderFeedbackSource feedbackSource,
|
||
|
|
String proxyMethod,
|
||
|
|
String simulatorVersion,
|
||
|
|
boolean realFill,
|
||
|
|
String orderId,
|
||
|
|
String positionId,
|
||
|
|
String orderStatus,
|
||
|
|
Instant appReceivedTime,
|
||
|
|
Instant exchangeAckTime,
|
||
|
|
Instant filledTime,
|
||
|
|
BigDecimal filledPrice,
|
||
|
|
BigDecimal filledQuantity,
|
||
|
|
BigDecimal fee,
|
||
|
|
BigDecimal slippageBps,
|
||
|
|
String closeReason,
|
||
|
|
String closeSignalSource,
|
||
|
|
String exchangeErrorCode,
|
||
|
|
String platformErrorCode,
|
||
|
|
Map<String, Object> rawFeedback
|
||
|
|
) {
|
||
|
|
|
||
|
|
public TraderAppFeedback {
|
||
|
|
rawFeedback = Maps.immutable(rawFeedback);
|
||
|
|
boolean sourceCanBeReal = feedbackSource == TraderFeedbackSource.PAPER_APP
|
||
|
|
|| feedbackSource == TraderFeedbackSource.REAL_APP;
|
||
|
|
if (realFill != sourceCanBeReal) {
|
||
|
|
throw new IllegalArgumentException("feedback_source and realFill are inconsistent");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|