From 5c420f8a5fe7e70d4544740e70e9dd33f69dbefe Mon Sep 17 00:00:00 2001 From: discountry Date: Thu, 25 Sep 2025 10:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=AD=96=E7=95=A5=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=B5=8B=E8=AF=95=EF=BC=8C=E6=B7=BB=E5=8A=A0=20markPr?= =?UTF-8?q?ice=20=E5=AD=97=E6=AE=B5=E4=BB=A5=E7=A1=AE=E4=BF=9D=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=E9=BB=98=E8=AE=A4=E4=BD=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E4=BD=8D=E7=BD=AE=E5=8C=85=E5=90=AB=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/strategy-utils.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/strategy-utils.test.ts b/tests/strategy-utils.test.ts index d5ecf4b..7f94914 100644 --- a/tests/strategy-utils.test.ts +++ b/tests/strategy-utils.test.ts @@ -34,17 +34,17 @@ const mockKlines = (values: number[]): AsterKline[] => describe("strategy utils", () => { it("returns default position when snapshot missing", () => { - expect(getPosition(null, "BTCUSDT")).toEqual({ positionAmt: 0, entryPrice: 0, unrealizedProfit: 0 }); + expect(getPosition(null, "BTCUSDT")).toEqual({ positionAmt: 0, entryPrice: 0, unrealizedProfit: 0, markPrice: null }); }); it("extracts position for symbol", () => { const snapshot = mockSnapshot([{ symbol: "BTCUSDT", amt: 1, entry: 100, pnl: 5 }]); - expect(getPosition(snapshot, "BTCUSDT")).toEqual({ positionAmt: 1, entryPrice: 100, unrealizedProfit: 5 }); + expect(getPosition(snapshot, "BTCUSDT")).toEqual({ positionAmt: 1, entryPrice: 100, unrealizedProfit: 5, markPrice: null }); }); it("returns zero position when symbol not found", () => { const snapshot = mockSnapshot([{ symbol: "ETHUSDT", amt: 2, entry: 200, pnl: 10 }]); - expect(getPosition(snapshot, "BTCUSDT")).toEqual({ positionAmt: 0, entryPrice: 0, unrealizedProfit: 0 }); + expect(getPosition(snapshot, "BTCUSDT")).toEqual({ positionAmt: 0, entryPrice: 0, unrealizedProfit: 0, markPrice: null }); }); it("returns null when not enough klines", () => {