Class AbstractExecutionCallback
java.lang.Object
com.wualabs.qtsurfer.engine.strategy.execution.AbstractExecutionCallback
- All Implemented Interfaces:
ExecutionCallback
- Direct Known Subclasses:
DefaultExecutionCallback
Base class for an ExecutionCallback, storing execution results and emitting info signals
-
Field Summary
Fields inherited from interface ExecutionCallback
NOOP -
Constructor Summary
ConstructorsConstructorDescriptionAbstractExecutionCallback(@NonNull Strategy strategy, @NonNull Consumer<StrategySignal> signalEmitter, @NonNull Consumer<StrategyYield> yieldEmitter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear(Instrument instrument) protected voidemitSignal(StrategySignal signal) protected voidemitYield(StrategyYield yield) getCompleteAmount(Instrument instrument) getFailedBuy(Instrument instrument) getFailedSell(Instrument instrument) getFilledBuy(Instrument instrument) getFilledSell(Instrument instrument) getPartialBuys(Instrument instrument) getPartialSells(Instrument instrument) protected Optional<StateStore> getStateStore(Instrument instrument) protected Optional<StateStore> getStateStore(ExecutionResult result) voidonComplete(ExecutionResult enterResult, ExecutionResult exitResult, Amount yieldAmount) Handles a completed buy-sell cycle by recording the yield amount and emitting a yield event for downstream consumers (metrics, UI).onFailedBuy(ExecutionResult result) onFailedSell(ExecutionResult result) voidonFilledBuy(ExecutionResult result) Records a filled buy execution and emits a chart marker signal (green arrow) for visualization in the trading UI.voidonFilledSell(ExecutionResult result) onPartialBuy(ExecutionResult result) onPartialSell(ExecutionResult result) voidonPositionUpdated(PositionSnapshot position) voidonStopLossCancelled(Instrument instrument) Called when an active stop-loss order has been cancelled (e.g., before a manual sell).voidonStopLossPlaced(Instrument instrument, String orderId, BigDecimal stopPrice) Called when a stop-loss order has been successfully placed on the exchange.voidonStopLossTriggered(Instrument instrument, ExecutionResult exitResult) Called when a stop-loss order has been triggered (filled) by the exchange.
-
Constructor Details
-
AbstractExecutionCallback
public AbstractExecutionCallback(@NonNull @NonNull Strategy strategy, @NonNull @NonNull Consumer<StrategySignal> signalEmitter, @NonNull @NonNull Consumer<StrategyYield> yieldEmitter)
-
-
Method Details
-
clear
-
getFilledBuy
-
getFailedBuy
-
getFilledSell
-
getFailedSell
-
getPartialBuys
-
getPartialSells
-
getCompleteAmount
-
onFilledBuy
Records a filled buy execution and emits a chart marker signal (green arrow) for visualization in the trading UI.- Specified by:
onFilledBuyin interfaceExecutionCallback
-
onPartialBuy
- Specified by:
onPartialBuyin interfaceExecutionCallback
-
onFailedBuy
- Specified by:
onFailedBuyin interfaceExecutionCallback
-
onFilledSell
- Specified by:
onFilledSellin interfaceExecutionCallback
-
onPartialSell
- Specified by:
onPartialSellin interfaceExecutionCallback
-
onFailedSell
- Specified by:
onFailedSellin interfaceExecutionCallback
-
onComplete
Handles a completed buy-sell cycle by recording the yield amount and emitting a yield event for downstream consumers (metrics, UI). The emitted yield's output isinput + yieldAmountsogetYield()agrees EXACTLY with the authoritative amount computed byStrategyExecutorManager.processYield— previously the gross exit traded amount was emitted, so the yield stream disagreed with the accounted PnL whenever fees existed.- Specified by:
onCompletein interfaceExecutionCallback
-
emitSignal
-
emitYield
-
onPositionUpdated
- Specified by:
onPositionUpdatedin interfaceExecutionCallback
-
onStopLossPlaced
Description copied from interface:ExecutionCallbackCalled when a stop-loss order has been successfully placed on the exchange.- Specified by:
onStopLossPlacedin interfaceExecutionCallback
-
onStopLossTriggered
Description copied from interface:ExecutionCallbackCalled when a stop-loss order has been triggered (filled) by the exchange.- Specified by:
onStopLossTriggeredin interfaceExecutionCallback
-
onStopLossCancelled
Description copied from interface:ExecutionCallbackCalled when an active stop-loss order has been cancelled (e.g., before a manual sell).- Specified by:
onStopLossCancelledin interfaceExecutionCallback
-
getStateStore
-
getStateStore
-
getStrategy
-