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

'Market' object has no attribute 'top_pct_change' #13

Closed
jinghao2eebd opened this issue Apr 1, 2020 · 2 comments
Closed

'Market' object has no attribute 'top_pct_change' #13

jinghao2eebd opened this issue Apr 1, 2020 · 2 comments
Assignees

Comments

@jinghao2eebd
Copy link

我在运行的时候遇到这个问题
in market.py buy_check() and sell_check() function

@iminders
Copy link
Contributor

iminders commented Apr 1, 2020

Mac os
tenvs==1.0.2
tbase==0.1.2

python3 -m tbase.run --alg ddpg --codes "600237.SH"  --num_env 1 --gamma 0.53 --seed 9 --max_iter_num 1000  --tensorboard_dir=./logs/ --eval_end '20200331'  --print_action

Error

2020-04-01 17:00:43,908 run.py[40] INFO tbase.run set global_seeds: 9
2020-04-01 17:00:45,220 reward.py[138] INFO tenvs.envs.reward use reward function: daily_return_with_chl_penalty

********************************************************************************
2020-04-01 17:00:45,221 run.py[45] INFO Initializing agent by parameters:
2020-04-01 17:00:45,221 run.py[46] INFO Namespace(activation='tanh', alg='ddpg', clear_memory_interval=5, codes='600237.SH', data_dir='/tmp/tenvs', debug=False, device=None, end='20191231', entropy_coef=0.1, eval=False, eval_end='20200331', eval_start='20200101', explore_size=400, gamma=0.53, indexs='000001.SH,399001.SZ', investment=100000, log_deals=False, log_interval=10, look_back_days=10, lr=0.001, max_grad_norm=5, max_iter_num=1000, model_dir='/tmp/tbase/models', num_env=1, opt_fn='rmsprop', play=False, policy_net='LSTM_MLP', print_action=True, reward_fn='daily_return_with_chl_penalty', run_id=1, sample_size=200, scenario='average', seed=9, start='20190101', t_max=10, tau=0.95, tensorboard_dir='./logs/', value_loss_coef=0.5, value_net='LSTM_Merge_MLP', warm_up=10000)
2020-04-01 17:00:46,631 reward.py[138] INFO tenvs.envs.reward use reward function: daily_return_with_chl_penalty
2020-04-01 17:00:46,632 run.py[49] INFO Training agent
2020-04-01 17:00:46,632 ac_agent.py[143] INFO warmming up: explore 10000 days in enviroment
Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/run.py", line 59, in <module>
    main()
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/run.py", line 50, in main
    agent.learn()
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/agents/ddpg/agent.py", line 69, in learn
    self.warm_up()
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/agents/base/ac_agent.py", line 147, in warm_up
    self.simple_explore(self.args.warm_up, self.args.sample_size)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/agents/base/ac_agent.py", line 84, in simple_explore
    self.policy, explore_size, self.args.print_action)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tbase/tbase/agents/base/explore.py", line 53, in simple_explore
    next_state, reward, done, info, _ = env.step(action)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tenvs/tenvs/envs/base.py", line 220, in step
    only_update)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tenvs/tenvs/envs/average.py", line 85, in do_action
    sell_cash_change, ok = self.sell(i, sell_price, 0)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tenvs/tenvs/envs/base.py", line 92, in sell
    bid_price=price)
  File "/Users/liuwen/Google/liulishuo/workspace/go/gopath/src/github.com/tradingAI/tenvs/tenvs/market.py", line 265, in sell_check
    if low == high and pct_change < -self.top_pct_change:
AttributeError: 'Market' object has no attribute 'top_pct_change'

@iminders iminders self-assigned this Apr 1, 2020
@iminders iminders mentioned this issue Apr 1, 2020
@iminders
Copy link
Contributor

iminders commented Apr 1, 2020

@JinghaoZ fixed by: #14

@iminders iminders closed this as completed Apr 1, 2020
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