-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
TypeError: __init__() got an unexpected keyword argument 'initial_amount' #518
Comments
Hi team, I got the same error and when I commented out the initial_amount line of code I got
And in the source code, I saw that the Initial_amount is commented out, is it as simple as un-comment that line? If so I would be happy to submit a PR |
I see, there is a PR to revert the change that commented initial_amount |
Trying to get started and cant run the initial notebook because of this error. |
I ran into the same problem. It seems 'initial_list' is now used instead of 'initial_amount'. 'buy_cost_pct' and 'sell_cost_pct' are now lists instead of floats. I'm guessing this was done so that initial amounts and slippage could be varied by instrument. Not sure if this the correct solution but the following code seemed to work: Create the lists: Update the environment args: Again, I have no idea if this is the correct solution but everything seemed to run after these fixes. |
This was also discussed a while back here: #495 It was closed, but there is still a problem to be addressed. |
I have submit a PR which has been merged and fix this bug in |
It works! But you need to change I can't fix this bug because I couldn't understand the operation in the source code. With your help I commented the meaning of # for multiple stock
# 将所有东西转换成一个list表示的state
state = (
[self.initial_amount] # 初始空余资金
+ self.data.close.values.tolist() #data[self.day]当天股票价格
+ self.initial_list[1:] #初始各股票持有share
+ sum(
[
self.data[tech].values.tolist()
for tech in self.tech_indicator_list
], #当天各股票因子list
[],
)
) # append initial stocks_share to initial state, instead of all zero |
developpers updated the code today: initial_amount exists in args, and add the num_stock_shares, which should be initialized as [0] * stock_dimension |
I updated the code to this:
It runs fine however the next step (Environment for Training) now returns this error:
|
@PierrickI3 "initial_amount" should be set 1000000 |
That works. Thanks! |
@PierrickI3 Could you please submit a PR for this problem if you have enough time? |
Not sure how I can do that. Here is the final version of my
|
@PierrickI3 Fixed. Thanks. |
Where did you put this in the code? I'm having issues where it says: Traceback (most recent call last): Would really appreciate the help! I'm a beginner :) |
@flyingsandwich1 which notebook did you run? Have you revised anything? |
I got a bug on cell number [18]. Line code number 14 is red underlined.
here is the code which is red underlined:
e_train_gym = StockTradingEnv(df = train, **env_kwargs)
here is the error warning:
TypeError Traceback (most recent call last)
in ()
12 }
13
---> 14 e_train_gym = StockTradingEnv(df = train, **env_kwargs)
TypeError: init() got an unexpected keyword argument 'initial_amount'
How to solve this bug? thank's before.
The text was updated successfully, but these errors were encountered: