[2026-06-02] 결산 중복과 모의투자 호출 안정화

This commit is contained in:
2026-06-02 18:26:12 +09:00
parent b71e08b498
commit 77ddf6760d
4 changed files with 49 additions and 15 deletions
+10 -2
View File
@@ -31,10 +31,14 @@ class OrderExecutor:
qty: int,
reason: str = "",
ai_boosted: bool = False,
fill_price: float | None = None,
) -> dict:
"""Submit a market buy and save the opened trade."""
try:
result = await self.kis.order_buy(ticker, qty)
if self.dry_run and fill_price:
result = {"entry_price": fill_price}
else:
result = await self.kis.order_buy(ticker, qty)
price = result.get("entry_price", 0)
if not price:
price = (await self.kis.get_price(ticker))["current"]
@@ -64,10 +68,14 @@ class OrderExecutor:
name: str,
qty: int,
reason: str = "",
fill_price: float | None = None,
) -> dict:
"""Submit a market sell and save full or partial exit results."""
try:
result = await self.kis.order_sell(ticker, qty)
if self.dry_run and fill_price:
result = {"exit_price": fill_price}
else:
result = await self.kis.order_sell(ticker, qty)
price = result.get("exit_price", 0)
if not price:
price = (await self.kis.get_price(ticker))["current"]