name: paper_order_lifecycle
timeout: 5s
steps:
  - id: import_kr_daily_bars
    action: import_daily_bars
    request:
      provider: kis
      selector_kind: watchlist
      market: kr
      venue: krx
      symbols: ["005930"]
      from_yyyymmdd: "20240527"
      to_yyyymmdd: "20240528"
    expect:
      status: ok
  - id: start
    action: start_paper_trading
    request:
      account_id: paper-1
      strategy_id: strategy-v1
      market: kr
      timeframe: daily
      from_unix_ms: 1746057600000
      to_unix_ms: 1747267200000
      starting_cash: "10000000"
    expect:
      status: ok
      run_status: succeeded
  - id: submit
    action: submit_paper_order
    request:
      account_id: paper-1
      instrument_id: KRX:005930
      side: buy
      quantity: "1"
      order_type: market
      market: kr
    expect:
      status: ok
      order_status: pending
  - id: fill
    action: fill_paper_order
    request:
      account_id: paper-1
      order_id: "{{steps.submit.order.id}}"
      market: kr
      fill_price: "1000"
    expect:
      status: ok
      order_status: filled
  - id: submit2
    action: submit_paper_order
    request:
      account_id: paper-1
      instrument_id: KRX:005930
      side: buy
      quantity: "1"
      order_type: market
      market: kr
    expect:
      status: ok
      order_status: pending
  - id: cancel
    action: cancel_paper_order
    request:
      account_id: paper-1
      order_id: "{{steps.submit2.order.id}}"
    expect:
      status: ok
      order_status: canceled
  - id: state
    action: get_paper_trading_state
    request:
      account_id: paper-1
    expect:
      status: ok
