Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tuple error in FinRL-Tutorials/3-Practical/FinRL_PaperTrading_Demo.ipynb #78

Open
BlockchainPunks opened this issue Jan 13, 2024 · 1 comment

Comments

@BlockchainPunks
Copy link

Opened : /notebooks/FinRL/examples/FinRL_PaperTrading_Demo.ipynb on google collab and tried locally.

Both times: Part 2: Train the agent fails with Tuple error:
Alpaca successfully connected
Data cleaning started
align start and end dates
produce full timestamp index
Start processing tickers
ticker list complete
Start concat and rename
Data clean finished!
Started adding Indicators
Running Loop
Restore Timestamps
Finished adding Indicators
Data cleaning started
align start and end dates
produce full timestamp index
Start processing tickers
ticker list complete
Start concat and rename
Data clean finished!


TypeError Traceback (most recent call last)
Cell In[64], line 1
----> 1 train(start_date = '2022-08-25',
2 end_date = '2022-08-31',
3 ticker_list = ticker_list,
4 data_source = 'alpaca',
5 time_interval= '1Min',
6 technical_indicator_list= INDICATORS,
7 drl_lib='elegantrl',
8 env=env,
9 model_name='ppo',
10 if_vix=True,
11 API_KEY = API_KEY,
12 API_SECRET = API_SECRET,
13 API_BASE_URL = API_BASE_URL,
14 erl_params=ERL_PARAMS,
15 cwd='./papertrading_erl', #current_working_dir
16 break_step=1e5)

Cell In[49], line 60, in train(start_date, end_date, ticker_list, data_source, time_interval, technical_indicator_list, drl_lib, env, model_name, if_vix, **kwargs)
53 agent = DRLAgent_erl(
54 env=env,
55 price_array=price_array,
56 tech_array=tech_array,
57 turbulence_array=turbulence_array,
58 )
59 model = agent.get_model(model_name, model_kwargs=erl_params)
---> 60 trained_model = agent.train_model(
61 model=model, cwd=cwd, total_timesteps=break_step
62 )

Cell In[48], line 77, in DRLAgent.train_model(self, model, cwd, total_timesteps)
75 model.cwd = cwd
76 model.break_step = total_timesteps
---> 77 train_agent(model)

Cell In[47], line 310, in train_agent(args)
308 env = build_env(args.env_class, args.env_args)
309 agent = args.agent_class(args.net_dims, args.state_dim, args.action_dim, gpu_id=args.gpu_id, args=args)
--> 310 agent.states = env.reset()[np.newaxis, :]
312 evaluator = Evaluator(eval_env=build_env(args.env_class, args.env_args),
313 eval_per_step=args.eval_per_step,
314 eval_times=args.eval_times,
315 cwd=args.cwd)
316 torch.set_grad_enabled(False)

TypeError: tuple indices must be integers or slices, not tuple

please help as I cannot get paper trading demo to run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants