code: def test_cn_ppo_strategy():
      set_log_with_config(C.logging_config)
      # The data starts with 9:31 and ends with 15:00
      orders = pickle_styled.load_orders(
          CN_ORDER_DIR,
          start_time=pd.Timestamp("9:31"),
          end_time=pd.Timestamp("14:58"),
      )
      assert len(orders) == 40
  
      state_interp = FullHistoryStateInterpreter(
          8, 240, 6, PickleProcessedDataProvider(CN_FEATURE_DATA_DIR)
      )
      action_interp = CategoricalActionInterpreter(4)
      network = Recurrent(state_interp.observation_space)
      policy = PPO(
          network,
          state_interp.observation_space,
          action_interp.action_space,
          1e-4,
      )
      policy.load_state_dict(
          torch.load(
              CN_POLICY_WEIGHTS_DIR / "ppo_recurrent_30min.pth",
              map_location="cpu",
          )
      )
      csv_writer = CsvWriter(Path(__file__).parent / ".output")
  
      backtest(
          partial(
              SingleAssetOrderExecutionSimple,
              data_dir=CN_DATA_DIR,
              ticks_per_step=30,
          ),
          state_interp,
          action_interp,
          orders,
          policy,
          [ConsoleWriter(total_episodes=len(orders)), csv_writer],
          concurrency=4,
      )
  
      metrics = pd.read_csv(
          Path(__file__).parent / ".output" / "result.csv"
      )
      assert len(metrics) == len(orders)
      assert np.isclose(metrics["ffr"].mean(), 1.0)
      assert np.isclose(metrics["pa"].mean(), -16.21578303474833)
      assert np.isclose(
          metrics["market_price"].mean(), 58.68277690875527
      )
      assert np.isclose(
          metrics["trade_price"].mean(), 58.76063985000002
      )
  
imports: import sys
  from functools import partial
  from pathlib import Path
  from typing import NamedTuple
  import numpy
  import pandas
  import pytest
  import torch
  from tianshou.data import Batch
  from qlib.backtest import Order
  from qlib.config import C
  from qlib.log import set_log_with_config
  from qlib.rl.data import pickle_styled
  from qlib.rl.data.pickle_styled import PickleProcessedDataProvider
  from qlib.rl.order_execution import *
  from qlib.rl.trainer import backtest, train
  from qlib.rl.utils import ConsoleWriter, CsvWriter, EnvWrapperStatus
label_desc: Use image node_id 9 for calling a global function with example usage: test_cn_ppo_strategy() without return types