Fix 期期 sheets bias: split total 2n from same-sheets, not n.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -364,9 +364,11 @@
|
||||
if (!(ratio > 0) || !(ratio < 1)) ratio = 0.7;
|
||||
const splitBy = state.ooBiasSplitBy === "sheets" ? "sheets" : "budget";
|
||||
const pair = costA + costB;
|
||||
let nSame = pair > 0 ? Math.floor(budget / pair + 1e-12) : 0;
|
||||
nSame = capByDepth(nSame, state.legA && state.legA.ask_sz);
|
||||
nSame = capByDepth(nSame, state.legB && state.legB.ask_sz);
|
||||
const nPair = pair > 0 ? Math.floor(budget / pair + 1e-12) : 0;
|
||||
const nSame = Math.min(
|
||||
capByDepth(nPair, state.legA && state.legA.ask_sz),
|
||||
capByDepth(nPair, state.legB && state.legB.ask_sz)
|
||||
);
|
||||
|
||||
let nA = 0;
|
||||
let nB = 0;
|
||||
@@ -381,12 +383,14 @@
|
||||
let nCall = 0;
|
||||
let nPut = 0;
|
||||
if (splitBy === "sheets") {
|
||||
if (nSame < 2) {
|
||||
return { sheetsA: 0, sheetsB: 0, premium: 0, ok: false, msg: "同张数规模不足 2,无法按比例拆分" };
|
||||
// 总张数 = 同张数两侧合计(每腿 n → 共 2n),再按比例拆
|
||||
const total = nSame * 2;
|
||||
if (total < 2) {
|
||||
return { sheetsA: 0, sheetsB: 0, premium: 0, ok: false, msg: "同张数总规模不足 2,无法按比例拆分" };
|
||||
}
|
||||
let majorN = Math.round(nSame * ratio);
|
||||
majorN = Math.max(1, Math.min(majorN, nSame - 1));
|
||||
const minorN = nSame - majorN;
|
||||
let majorN = Math.round(total * ratio);
|
||||
majorN = Math.max(1, Math.min(majorN, total - 1));
|
||||
const minorN = total - majorN;
|
||||
nCall = majorIsCall ? majorN : minorN;
|
||||
nPut = majorIsCall ? minorN : majorN;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user