Git Product home page Git Product logo

Comments (11)

JinChengneng avatar JinChengneng commented on May 27, 2024

I have met the same problem. The error log is shown below.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-1960ecceda46> in <module>()
      1 env_train = env_setup.create_env_training(data = train,
----> 2                                           env_class = SingleStockEnv)

/usr/local/lib/python3.6/dist-packages/finrl/env/environment.py in create_env_training(self, data, env_class, turbulence_threshold)
     54 
     55     def create_env_training(self, data, env_class, turbulence_threshold=150):
---> 56         env_train = DummyVecEnv([lambda: env_class(df = data,
     57                                                     stock_dim = self.stock_dim,
     58                                                     hmax = self.hmax,

/usr/local/lib/python3.6/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py in __init__(self, env_fns)
     23 
     24     def __init__(self, env_fns: List[Callable[[], gym.Env]]):
---> 25         self.envs = [fn() for fn in env_fns]
     26         env = self.envs[0]
     27         VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space)

/usr/local/lib/python3.6/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py in <listcomp>(.0)
     23 
     24     def __init__(self, env_fns: List[Callable[[], gym.Env]]):
---> 25         self.envs = [fn() for fn in env_fns]
     26         env = self.envs[0]
     27         VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space)

/usr/local/lib/python3.6/dist-packages/finrl/env/environment.py in <lambda>()
     63                                                     action_space = self.action_space,
     64                                                     tech_indicator_list = self.tech_indicator_list,
---> 65                                                     turbulence_threshold = turbulence_threshold)])
     66         return env_train
     67 

<ipython-input-17-33a3af6cb4c6> in __init__(self, df, stock_dim, hmax, initial_amount, transaction_cost_pct, reward_scaling, state_space, action_space, tech_indicator_list, turbulence_threshold, day)
     93         self.turbulence_threshold = turbulence_threshold
     94         # initalize state: inital amount + close price + shares + technical indicators + other features
---> 95         self.state = [self.initial_amount] +                       [self.data.close] +                       [0]*self.stock_dim  +                       sum([[self.data[tech]] for tech in self.tech_indicator_list ], [])+                       [self.data.open] +                       [self.data.high] +                       [self.data.low] +                      [self.data.daily_return]
     96         # initialize reward
     97         self.reward = 0

/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in __getattr__(self, name)
   5139             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5140                 return self[name]
-> 5141             return object.__getattribute__(self, name)
   5142 
   5143     def __setattr__(self, name: str, value) -> None:

AttributeError: 'Series' object has no attribute 'daily_return'

from finrl.

JinChengneng avatar JinChengneng commented on May 27, 2024

I guess this issue occurred since the column daily_return in DataFrame data_df missed. I would appreciate it if you could check it.

from finrl.

BruceYanghy avatar BruceYanghy commented on May 27, 2024

I fixed it. Please try again. Please do runtime, and factory reset runtime, and run everything again.

from finrl.

JinChengneng avatar JinChengneng commented on May 27, 2024

It works well now. Thanks for your effort.

from finrl.

zyzhang1130 avatar zyzhang1130 commented on May 27, 2024

Sorry I have a relevant question regarding 'daily_return': why it cannot be found before doing feature engineering? Does that mean 'daily_return' is a technical indicator? If so why it is not included in the tech_indicator_list? Thanks

from finrl.

TekpreXyz avatar TekpreXyz commented on May 27, 2024

This code is incredible awesome! thank you for! some idea to try it on binance future testnet? or to implement ccxt?
https://github.com/ccxt/ccxt
https://binance-docs.github.io/apidocs/testnet/en/#change-log

from finrl.

BruceYanghy avatar BruceYanghy commented on May 27, 2024

Sorry I have a relevant question regarding 'daily_return': why it cannot be found before doing feature engineering? Does that mean 'daily_return' is a technical indicator? If so why it is not included in the tech_indicator_list? Thanks

good question, I found this 'daily_return' is actually hardcoded into the env file for single stock trading, that's not good, I will work on improvements.

from finrl.

BruceYanghy avatar BruceYanghy commented on May 27, 2024

This code is incredible awesome! thank you for! some idea to try it on binance future testnet? or to implement ccxt?
https://github.com/ccxt/ccxt
https://binance-docs.github.io/apidocs/testnet/en/#change-log

Great library. We are actually doing research papers on cryptocurrencies, if you are an expert, let's work together.

from finrl.

TekpreXyz avatar TekpreXyz commented on May 27, 2024

i am not an expert but i would gladly help you in some way

from finrl.

TekpreXyz avatar TekpreXyz commented on May 27, 2024

I'd like to implement some stuff inFinRL:

Autoregressive Integrated Moving Average:
https://towardsdatascience.com/aifortrading-2edd6fac689d

Add to dataframe all the indicator of TA lib together:
https://github.com/bukosabino/ta/blob/master/examples_to_use/all_features_example.py
https://github.com/bukosabino/ta

Use of Ray agent for crypto
https://www.tensortrade.org/en/latest/agents/overview.html#ray

Implement Tensorflow2.4

from finrl.

BruceYanghy avatar BruceYanghy commented on May 27, 2024

I'd like to implement some stuff inFinRL:

Autoregressive Integrated Moving Average:
https://towardsdatascience.com/aifortrading-2edd6fac689d

Add to dataframe all the indicator of TA lib together:
https://github.com/bukosabino/ta/blob/master/examples_to_use/all_features_example.py
https://github.com/bukosabino/ta

Use of Ray agent for crypto
https://www.tensortrade.org/en/latest/agents/overview.html#ray

Implement Tensorflow2.4

https://join.slack.com/t/ai4financeworkspace/shared_invite/zt-jyaottie-hHqU6TdvuhMHHAMXaLw_~w

Please join our open source community.

from finrl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.