class_docstr: A stock trading environment for OpenAI gym
class_docstr_tok: ["A","stock","trading","environment","for","OpenAI","gym"]
code: def save_state_memory(self):
      if len(self.df.tic.unique()) > 1:
          # date and close price length must match actions length
          date_list = self.date_memory[:-1]
          df_date = pd.DataFrame(date_list)
          df_date.columns = ["date"]
  
          state_list = self.state_memory
          df_states = pd.DataFrame(
              state_list,
              columns=[
                  "cash",
                  "Bitcoin_price",
                  "Gold_price",
                  "Bitcoin_num",
                  "Gold_num",
                  "Bitcoin_Disable",
                  "Gold_Disable",
              ],
          )
          df_states.index = df_date.date
          # df_actions = pd.DataFrame({'date':date_list,'actions':action_list})
      else:
          date_list = self.date_memory[:-1]
          state_list = self.state_memory
          df_states = pd.DataFrame(
              {"date": date_list, "states": state_list}
          )
      # print(df_states)
      return df_states
  
imports: from __future__ import annotations
  from typing import List
  import gymnasium
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import pandas
  from gymnasium import spaces
  from gymnasium.utils import seeding
  from stable_baselines3.common.vec_env import DummyVecEnv
label_desc: Use image node_id 11 for calling the StockTradingEnv obj's underlying member method code with example usage: obj.save_state_memory() and returns: df_states