Class PovTracker
java.lang.Object
com.quantfinlib.execution.PovTracker
POV (percentage-of-volume) execution tracker: the streaming counterpart of
the precomputed
TwapScheduler/VwapScheduler schedules.
POV cannot be prescheduled because it chases realized market volume, so
this class maintains the participation ledger live: feed it market
prints and own fills, and it answers "how many shares am I allowed to
send right now" (dueQuantity()).
The participation rate p is a share of total traded volume,
ours included (the industry definition). With V the volume
printed by others (onMarketVolume(long), which must exclude our fills),
executing x gives a share x / (x + V); solving
x / (x + V) = p gives the target x = p / (1 - p) * V.
The naive target p * V realises only p / (1 + p).
Sent-but-unfilled children count against the target: report them with
onChildSent(long) and their unfilled remainders with
onChildDone(long), so a resting child is not re-sent. Child sizes are
clamped to [minSlice, maxSlice]: the minimum suppresses dribble
orders, the maximum caps signalling.
Primitives only, zero allocation, single-writer.
-
Constructor Summary
ConstructorsConstructorDescriptionPovTracker(long parentQty, double participation, long minSlice, long maxSlice) -
Method Summary
Modifier and TypeMethodDescriptionbooleandone()longShares to send now to restore the target participation: the behind- schedule quantity, clamped to the slice bounds and the parent remainder.longexecuted()longvoidonChildDone(long unfilledQty) A child ended withunfilledQtynever executed.voidonChildSent(long qty) A child ofqtywas sent and is working.voidonExecuted(long qty) Our own child fill (do not also feed it toonMarketVolume(long)).voidonMarketVolume(long qty) A market trade print that was not our fill.longSent child quantity not yet filled or reported done.doubleRealised share of total volume,executed / (executed + V); NaN before any volume.longlongTarget executed quantity for the volume seen so far:p / (1 - p) * V.
-
Constructor Details
-
PovTracker
public PovTracker(long parentQty, double participation, long minSlice, long maxSlice) - Parameters:
parentQty- total shares to executeparticipation- target share of total volume in (0, 1), e.g. 0.1 = 10%minSlice- smallest child worth sending (0 = no minimum)maxSlice- largest child ever sent (caps information leakage)
-
-
Method Details
-
onMarketVolume
public void onMarketVolume(long qty) A market trade print that was not our fill. -
onExecuted
public void onExecuted(long qty) Our own child fill (do not also feed it toonMarketVolume(long)). -
onChildSent
public void onChildSent(long qty) A child ofqtywas sent and is working. -
onChildDone
public void onChildDone(long unfilledQty) A child ended withunfilledQtynever executed. -
openQuantity
public long openQuantity()Sent child quantity not yet filled or reported done. -
targetQuantity
public long targetQuantity()Target executed quantity for the volume seen so far:p / (1 - p) * V. -
dueQuantity
public long dueQuantity()Shares to send now to restore the target participation: the behind- schedule quantity, clamped to the slice bounds and the parent remainder. Returns 0 while withinminSliceof schedule (or when done) — poll it on every print, act when it's positive. -
realizedParticipation
public double realizedParticipation()Realised share of total volume,executed / (executed + V); NaN before any volume. -
executed
public long executed() -
remaining
public long remaining() -
marketVolume
public long marketVolume() -
done
public boolean done()
-