Sizing: no financing floor when a trade costs nothing (zero commission and spread)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
169fe19fad
commit
957b9a50fe
@@ -1431,7 +1431,9 @@ export function sizeNotional(o: {
|
||||
for (let pass = 0; pass < 4; pass++) {
|
||||
const { a, b } = distances(n);
|
||||
const nTime = Math.sqrt((a * b) / (sigma * sigma * hold));
|
||||
const nCost = fh > 0 ? Math.sqrt((fh * a * b) / (sigma * sigma * (2 * c + s))) : 0;
|
||||
// No per-trade cost (a zero-commission firm on a zero spread): no
|
||||
// floor — there is nothing for a bigger position to save.
|
||||
const nCost = fh > 0 && 2 * c + s > 0 ? Math.sqrt((fh * a * b) / (sigma * sigma * (2 * c + s))) : 0;
|
||||
n = Math.max(nTime, nCost);
|
||||
}
|
||||
if (!Number.isFinite(n) || n <= 0) return null;
|
||||
|
||||
Reference in New Issue
Block a user