code: def __init__(
      self,
      cwd="./data/nas100",
      price_ary=None,
      tech_ary=None,
      turbulence_ary=None,
      gamma=0.999,
      turbulence_thresh=30,
      min_stock_rate=0.1,
      max_stock=1e2,
      initial_capital=1e6,
      buy_cost_pct=1e-3,
      sell_cost_pct=1e-3,
      data_gap=4,
      reward_scaling=2**-11,
      ticker_list=None,
      tech_indicator_list=None,
      initial_stocks=None,
      if_eval=False,
      if_trade=False,
  ):
      self.min_stock_rate = min_stock_rate
      beg_i, mid_i, end_i = 0, int(211210), int(422420)
  
      (i0, i1) = (beg_i, mid_i) if if_eval else (mid_i, end_i)
      data_arrays = (
          self.load_data(cwd) if cwd is not None else price_ary,
          tech_ary,
          turbulence_ary,
      )
      if not if_trade:
          data_arrays = [ary[i0:i1:data_gap] for ary in data_arrays]
      else:
          data_arrays = [
              ary[int(422420) : int(528026) : data_gap]
              for ary in data_arrays
          ]
      self.price_ary, self.tech_ary, turbulence_ary = data_arrays
  
      self.tech_ary = self.tech_ary * 2**-7
      self.turbulence_bool = (
          turbulence_ary > turbulence_thresh
      ).astype(np.float32)
      self.turbulence_ary = (
          self.sigmoid_sign(turbulence_ary, turbulence_thresh) * 2**-5
      ).astype(np.float32)
  
      stock_dim = self.price_ary.shape[1]
      self.gamma = gamma
      self.max_stock = max_stock
      self.buy_cost_pct = buy_cost_pct
      self.sell_cost_pct = sell_cost_pct
      self.reward_scaling = reward_scaling
      self.initial_capital = initial_capital
      self.initial_stocks = (
          np.zeros(stock_dim, dtype=np.float32)
          if initial_stocks is None
          else initial_stocks
      )
  
      # reset()
      self.day = None
      self.amount = None
      self.stocks = None
      self.total_asset = None
      self.gamma_reward = None
      self.initial_total_asset = None
  
      # environment information
      self.env_name = "StockEnvNAS"
      # self.state_dim = 1 + 2 + 2 * stock_dim + self.tech_ary.shape[1]
      # # amount + (turbulence, turbulence_bool) + (price, stock) * stock_dim + tech_dim
      self.state_dim = 1 + 2 + 3 * stock_dim + self.tech_ary.shape[1]
      # amount + (turbulence, turbulence_bool) + (price, stock) * stock_dim + tech_dim
      self.stocks_cd = None
      self.action_dim = stock_dim
      self.max_step = self.price_ary.shape[0] - 1
      self.if_discrete = False
      self.target_return = 2.2
      self.episode_return = 0.0
  
file_path: FinRL/finrl/meta/env_stock_trading/env_nas100_wrds.py
imports: from __future__ import annotations
  import os
  import gym
  import numpy
  from numpy import random
label_desc: Use image node_id 1 to create a new StockEnvNAS100 object  with example: obj = StockEnvNAS100(cwd, price_ary, tech_ary, turbulence_ary, gamma, turbulence_thresh, min_stock_rate, max_stock, initial_capital, buy_cost_pct, sell_cost_pct, data_gap, reward_scaling, ticker_list, tech_indicator_list, initial_stocks, if_eval, if_trade)