FinRL
FinRL copied to clipboard
Issue invoke AlpacaPaperTrading
Error calling the AlpacaPaperTrading (FinRl/finrl/meta/env_stock_trading/env_stock_papertrading.py) from FinRL/examples/FinRL_PaperTrading_Demo.ipynb
ImportError Traceback (most recent call last)
in ----> 1 paper_trading_erl = AlpacaPaperTrading(ticker_list = DOW_30_TICKER, 2 time_interval = '1Min', 3 drl_lib = 'elegantrl', 4 agent = 'ppo', 5 cwd = './papertrading_erl_retrain', /usr/local/lib/python3.9/dist-packages/finrl/meta/env_stock_trading/env_stock_papertrading.py in init(self, ticker_list, time_interval, drl_lib, agent, cwd, net_dim, state_dim, action_dim, API_KEY, API_SECRET, API_BASE_URL, tech_indicator_list, turbulence_thresh, max_stock, latency) 38 if drl_lib == "elegantrl": 39 from elegantrl.agents import AgentPPO ---> 40 from elegantrl.train.run import init_agent 41 from elegantrl.train.config import ( 42 Arguments,
ImportError: cannot import name 'init_agent' from 'elegantrl.train.run' (/usr/local/lib/python3.9/dist-packages/elegantrl/train/run.py)
To Reproduce
Run FinRL/examples/FinRL_PaperTrading_Demo.ipynb on Colab
Expected behavior This paper trading demo works pretty smooth without bugs a couple of days ago (Before #915 )
Screenshots

I checked commit history ElegantRL/elegantrl/train/run.py
After the commit
03db5bdda409d0b4ce2705340dd5e9be3fd090ee
def init_agent(args: Arguments, gpu_id: int, env=None) -> AgentBase:
were changed to:
def train_agent(args: Config):
I didn't have this issue until today, I assume one of the recent changes for calling the
AlpacaPaperTrading (FinRl/finrl/meta/env_stock_trading/env_stock_papertrading.py)
were deleted?
issue still there, may i know anyone can help?
File "xxx/FinRL/finrl/meta/env_stock_trading/env_stock_papertrading.py", line 40, in init from elegantrl.train.run import init_agent ImportError: cannot import name 'init_agent' from 'elegantrl.train.run' (/opt/anaconda3/envs/Python3_10_14/lib/python3.10/site-packages/elegantrl/train/run.py)
