auto: 일일 백업 2026-07-22 02:00
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -164,16 +164,25 @@ def propose_trade(
|
||||
price: Optional[int] = None,
|
||||
routing_force: Optional[str] = None,
|
||||
budget: Optional[int] = None,
|
||||
stop_price: Optional[int] = None,
|
||||
) -> dict:
|
||||
sidecar.guard_or_raise()
|
||||
_sweep_expired_and_notify()
|
||||
|
||||
if order_type not in ('LIMIT', 'MARKET', 'AGGRESSIVE_LIMIT'):
|
||||
if order_type not in ('LIMIT', 'MARKET', 'AGGRESSIVE_LIMIT', 'STOP_LIMIT'):
|
||||
return {'ok': False,
|
||||
'message': card.format_rejected('INVALID_ORDER_TYPE', f'잘못된 주문방식: {order_type}')}
|
||||
if side not in ('BUY', 'SELL'):
|
||||
return {'ok': False,
|
||||
'message': card.format_rejected('INVALID_SIDE', f'잘못된 방향: {side}')}
|
||||
if order_type == 'STOP_LIMIT':
|
||||
if side != 'SELL':
|
||||
return {'ok': False,
|
||||
'message': card.format_rejected('STOP_SELL_ONLY', '스톱지정가는 현재 매도만 지원')}
|
||||
if not price or price <= 0 or not stop_price or stop_price <= 0:
|
||||
return {'ok': False,
|
||||
'message': card.format_rejected('STOP_INPUT',
|
||||
'스톱지정가는 지정가와 조건단가(트리거)가 모두 필요')}
|
||||
if budget is not None and qty is not None:
|
||||
return {'ok': False,
|
||||
'message': card.format_rejected('AMBIGUOUS_INPUT',
|
||||
@@ -211,6 +220,9 @@ def propose_trade(
|
||||
}
|
||||
if order_type == 'LIMIT':
|
||||
request['price'] = price
|
||||
elif order_type == 'STOP_LIMIT':
|
||||
request['price'] = price
|
||||
request['stop_price'] = stop_price
|
||||
|
||||
r = guards.validate_request(request, md)
|
||||
if not r.ok:
|
||||
@@ -254,6 +266,8 @@ def propose_trade(
|
||||
'account': account, 'side': side, 'symbol': symbol, 'symbol_name': symbol_name,
|
||||
'qty': qty, 'price': final_price, 'order_type': order_type, 'routing_suffix': suffix,
|
||||
}
|
||||
if order_type == 'STOP_LIMIT':
|
||||
payload['stop_price'] = stop_price
|
||||
|
||||
try:
|
||||
pending = _pin_store.issue(account, payload)
|
||||
@@ -450,6 +464,7 @@ def submit_with_pin(pin_input: str, dry_run: bool = True) -> dict:
|
||||
routing_suffix=p['routing_suffix'],
|
||||
dry_run=dry_run,
|
||||
card_id=card_obj.card_id,
|
||||
stop_price=p.get('stop_price'),
|
||||
)
|
||||
|
||||
if res['ok']:
|
||||
|
||||
Reference in New Issue
Block a user