| import pandas as pd |
| from stable_baselines3.common.env_checker import check_env |
| from environment import PortfolioEnv |
|
|
| def main(): |
| """ |
| Main function to create and check the custom portfolio environment. |
| """ |
| print("--- Loading Data and Creating Environment ---") |
| try: |
| |
| df = pd.read_csv('data/train.csv', index_col='Date', parse_dates=True) |
| |
| env = PortfolioEnv(df) |
| print("Environment created successfully.") |
| except FileNotFoundError: |
| print("β Error: 'data/train.csv' not found. Make sure you've run the data fetching script.") |
| return |
|
|
| print("\n--- Checking Environment Compatibility ---") |
| try: |
| |
| check_env(env) |
| print("β
Environment check passed!") |
| except Exception as e: |
| print("β Environment check failed:") |
| |
| import traceback |
| traceback.print_exc() |
|
|
| if __name__ == "__main__": |
| main() |