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

AttributeError: 'trading_env' object has no attribute 'backtest' #19

Open
Chaosqing opened this issue Apr 28, 2024 · 0 comments
Open

AttributeError: 'trading_env' object has no attribute 'backtest' #19

Chaosqing opened this issue Apr 28, 2024 · 0 comments

Comments

@Chaosqing
Copy link

Backtesting
loading env just like training
env = trading_env.make(env_id='backtest_v1', obs_data_len=1024, step_len=512,
df=df, fee=0.1, max_position=5, deal_col_name='Price',
feature_names=['Price', 'Volume',
'Ask_price','Bid_price',
'Ask_deal_vol','Bid_deal_vol',
'Bid/Ask_deal', 'Updown'])

start to backtest
agent = YourAgent()

transactions = []
while not env.backtest_done:
state = env.backtest()
done = False
while not done:
state, reward, done, info = env.step(agent.choice_action(state))
#print(state, reward)
#env.render()
if done:
transactions.append(info)
break
transaction = pd.concate(transactions)
transaction

Making new env: backtest_v1
Traceback (most recent call last):
File "\TradingGym-master\BackTest.py", line 32, in
state = env.backtest()
AttributeError: 'trading_env' object has no attribute 'backtest'

how could I fix this.

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

1 participant