AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.71k stars 2.35k forks source link

TypeError: DRLAgent.DRL_prediction() missing 1 required positional argument: 'env_args' #1196

Open burger456 opened 6 months ago

burger456 commented 6 months ago

When I tested with this finrl, I encountered a problem with missing parameters. Can the test cases in Frinl still be used? Do you need improvement?

` if options.mode =="test": from finrl import test from finrl import train

    env = StockTradingEnv

    #ELEgantrl
    kwargs={'method': 'GET', 'url': 'https://apidojo-yahoo-finance-v1.p.rapidapi.com/auto-complete', 'params': { 'q': 'tesla', 'region': 'US' }, 'headers': { 'X-RapidAPI-Key': 'c74c8437ffmshd98594af221767dp1b31ebjsnfbf6d6a8b695', 'X-RapidAPI-Host': 'apidojo-yahoo-finance-v1.p.rapidapi.com' }}

    account_value_erl = test(start_date=TEST_START_DATE,
                             end_date=TEST_END_DATE,
                             ticker_list=DOW_30_TICKER,
                             data_source="yahoofinance",
                             time_interval="1D",
                             technical_indicator_list=INDICATORS,
                             drl_lib="elegantrl",
                             env=env,
                             model_name="ppo",
                             cwd="./test_ppo",
                             net_dimension=512,
                             kwargs=kwargs)`
ghyzx commented 5 months ago

i meet the same issue, may i know any update for this?

File "xxx/FinRL/finrl/test.py", line 53, in test episode_total_assets = DRLAgent_erl.DRL_prediction( TypeError: DRLAgent.DRL_prediction() missing 1 required positional argument: 'env_args'

DerekChu-YF commented 4 months ago

Problem found: mising one parameter just add env_args = env_config to

_DRLAgent_erl.DRL_prediction( model_name=model_name, cwd=cwd, net_dimension=net_dimension, environment=env_instance, env_args = env_config )_