fix: use current_price for overseas limit orders (KIS VTS rejects market orders) (#149)
Some checks failed
CI / test (pull_request) Has been cancelled
Some checks failed
CI / test (pull_request) Has been cancelled
KIS VTS (paper trading) rejects overseas market orders with: "모의투자 주문처리가 안되었습니다(지정가만 가능한 상품입니다)" Root cause: send_overseas_order() was called with price=0.0 (market order) in both trading_cycle() and run_daily_session(), even though current_price was already computed correctly by Fix #147 (exchange code mapping). Fix: pass current_price as the limit order price in both call sites. Domestic broker send_order() keeps price=0 (market orders are fine on KRX). Adds regression test TestOverseasBalanceParsing::test_overseas_buy_order_uses_limit_price verifying price=182.5 is passed, not 0.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -510,7 +510,7 @@ async def trading_cycle(
|
||||
stock_code=stock_code,
|
||||
order_type=decision.action,
|
||||
quantity=quantity,
|
||||
price=0.0, # market order
|
||||
price=current_price, # limit order — KIS VTS rejects market orders
|
||||
)
|
||||
logger.info("Order result: %s", result.get("msg1", "OK"))
|
||||
|
||||
@@ -919,7 +919,7 @@ async def run_daily_session(
|
||||
stock_code=stock_code,
|
||||
order_type=decision.action,
|
||||
quantity=quantity,
|
||||
price=0.0, # market order
|
||||
price=stock_data["current_price"], # limit order — KIS VTS rejects market orders
|
||||
)
|
||||
logger.info("Order result: %s", result.get("msg1", "OK"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user