code: def price_advantage(
      exec_price: float_or_ndarray,
      baseline_price: float,
      direction: OrderDir | int,
  ) -> float_or_ndarray:
      if (
          baseline_price == 0
      ):  # something is wrong with data. Should be nan here
          if isinstance(exec_price, float):
              return 0.0
          else:
              return np.zeros_like(exec_price)
      if direction == OrderDir.BUY:
          res = (1 - exec_price / baseline_price) * 10000
      elif direction == OrderDir.SELL:
          res = (exec_price / baseline_price - 1) * 10000
      else:
          raise ValueError(f"Unexpected order direction: {direction}")
      res_wo_nan: np.ndarray = np.nan_to_num(res, nan=0.0)
      if res_wo_nan.size == 1:
          return res_wo_nan.item()
      else:
          return cast(float_or_ndarray, res_wo_nan)
  
imports: from __future__ import annotations
  from typing import Any, cast, List, Optional
  import numpy
  import pandas
  from pathlib import Path
  from qlib.backtest.decision import Order, OrderDir
  from qlib.constant import EPS, EPS_T, float_or_ndarray
  from qlib.rl.data.base import BaseIntradayBacktestData
  from qlib.rl.data.native import DataframeIntradayBacktestData, load_handler_intraday_processed_data
  from qlib.rl.data.pickle_styled import load_simple_intraday_backtest_data
  from qlib.rl.simulator import Simulator
  from qlib.rl.utils import LogLevel
  from .state import SAOEMetrics, SAOEState
label_desc: Use image node_id 1 for calling a global function with example usage: price_advantage(exec_price, baseline_price, direction) and returns: res_wo_nan, cast, int, np