# Market data status scenario. It greets the API, imports KIS daily bars, then
# reads instruments and bars so an operator can confirm imported market data
# status from the terminal without a screen. Running the import first makes this
# a command-first status workflow rather than a generic read of whatever data
# already happens to be stored. `alt operator scenario run --file <this> --api-url
# <ws-url>` executes it; `alt operator scenario validate --file <this>` checks it
# offline.
name: market_data_status_query
timeout: 5s
universes:
  - name: kr-core
    provider: kis
    selector_kind: watchlist
    market: kr
    venue: krx
    symbols: ["005930"]
steps:
  - id: hello
    action: hello
    expect:
      status: ok
      capabilities:
        - market-read
  - id: import_kr_daily_bars
    action: import_daily_bars
    request:
      universe: kr-core
      from_yyyymmdd: "20240527"
      to_yyyymmdd: "20240528"
    expect:
      status: ok
  - id: list_kr_instruments
    action: list_instruments
    request:
      market: kr
    expect:
      status: ok
  - id: list_daily_bars
    action: list_bars
    request:
      instrument_id: "KRX:005930"
      timeframe: daily
      from_unix_ms: 1746057600000
      to_unix_ms: 1747267200000
    expect:
      status: ok
  - id: freshness_status
    action: collection_freshness
    request:
      universe: kr-core
      timeframe: daily
      from_unix_ms: 1746057600000
      to_unix_ms: 1747267200000
      expected_yyyymmdd: ["20250501"]
    expect:
      status: ok
      freshness_status: fresh
      missing_count: 0
      latest_yyyymmdd: "20250501"
      gap_status: clean
      gap_count: 0
      duplicate_count: 0
      provider_delay_days: 0

