Vest: a day that lost to the bot's limit stops, even with Vest room left
The daily-loss room on Vest was min(the stage's limit, balance − Vest's floor), which ignored the day's losses against the bot's own limit. With the type's $1,229 under Vest's 3% ($1,500), five 50k evals that had lost $1,111.65 today still saw $388 of room and traded again. The room is now min(limit + the day's realized loss, balance − floor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
32081f3dcf
commit
29eaf64a6b
+4
-1
@@ -631,7 +631,10 @@ function dailyLossGate(
|
||||
if (floor === null) return { reason: DLL_BASE_PENDING };
|
||||
let room: number;
|
||||
if (typeof floor === 'number') {
|
||||
room = floorRoom({ dailyLossLimit: dll, closedBalance: cash.amount, floor });
|
||||
room = floorRoom({
|
||||
dailyLossLimit: dll, closedBalance: cash.amount, floor,
|
||||
realizedToday: Math.min(cash.realizedPnL, combinedRealized),
|
||||
});
|
||||
} else {
|
||||
const dayStart: number | null | undefined = client.dayStartBalance?.(accountId);
|
||||
if (dayStart === null) return { reason: DLL_BASE_PENDING };
|
||||
|
||||
+6
-1
@@ -31,7 +31,12 @@ export function dayLossRoom(
|
||||
if (!(dll > 0)) return null;
|
||||
const floor: number | null | undefined = client.dailyLossFloor?.(accountId);
|
||||
if (floor === null) return null;
|
||||
if (typeof floor === 'number') return floorRoom({ dailyLossLimit: dll, closedBalance: cash.amount, floor });
|
||||
if (typeof floor === 'number') {
|
||||
return floorRoom({
|
||||
dailyLossLimit: dll, closedBalance: cash.amount, floor,
|
||||
realizedToday: Math.min(cash.realizedPnL, combinedRealized),
|
||||
});
|
||||
}
|
||||
const dayStart = client.dayStartBalance?.(accountId);
|
||||
return dayStart === null ? null : computeDllRoom({
|
||||
dailyLossLimit: dll, closedBalance: cash.amount, dayStartBalance: dayStart,
|
||||
|
||||
+14
-4
@@ -1368,12 +1368,22 @@ export function stageInputsFor(
|
||||
/**
|
||||
* dllRoom where the platform states its daily-loss floor itself (Vest: the
|
||||
* equity the account may not fall below today, already moved by the day's
|
||||
* transfers): never more than the stage's limit, nor than the floor leaves.
|
||||
* Infinity when there is no limit.
|
||||
* transfers): what's left of the stage's limit after the day's losses, and
|
||||
* never more than the floor leaves. The firm's floor alone isn't enough — a
|
||||
* limit set below the firm's (Vest's 3% is $1,500; the bot's day stops at
|
||||
* $1,229) would let a day that already lost $1,111 trade the $389 Vest still
|
||||
* allows. Infinity when there is no limit.
|
||||
*/
|
||||
export function floorRoom(o: { dailyLossLimit: number; closedBalance: number; floor: number }): number {
|
||||
export function floorRoom(o: {
|
||||
dailyLossLimit: number;
|
||||
closedBalance: number;
|
||||
floor: number;
|
||||
/** The day's realized P&L since its base (Vest: since this client's
|
||||
* latest claim today, else since the reset). */
|
||||
realizedToday: number;
|
||||
}): number {
|
||||
if (!(o.dailyLossLimit > 0)) return Infinity;
|
||||
return round2(Math.min(o.dailyLossLimit, o.closedBalance - o.floor));
|
||||
return round2(Math.min(o.dailyLossLimit + Math.min(0, o.realizedToday), o.closedBalance - o.floor));
|
||||
}
|
||||
|
||||
export function dllRoom(o: {
|
||||
|
||||
Reference in New Issue
Block a user