Coder Social home page Coder Social logo

Comments (6)

miroblog avatar miroblog commented on August 11, 2024

sorry for the late response,
try installing talib from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib

from tf_deep_rl_trader.

windowshopr avatar windowshopr commented on August 11, 2024

I followed the install instructions mentioned on that page as well, and I receive the same error. Windows 10 64-bit. TA-Lib did install successfully. Any further suggestions? Would love to get this working.

This is the full error I receive on mine:

python ppo_trader.py
Traceback (most recent call last):
File "ppo_trader.py", line 134, in
main()
File "ppo_trader.py", line 59, in main
environment = create_btc_env(window_size=TIMESTEP, path=PATH_TRAIN, train=True)
File "C:\Users...\tf_deep_rl_trader-master\env\gymWrapper.py", line 239, in create_btc_env
raw_env = OhlcvEnv(window_size=window_size, path=path, train=train)
File "C:\Users...\tf_deep_rl_trader-master\env\TFTraderEnv.py", line 43, in init
self.observation_space = spaces.Box(low=-np.inf, high=np.inf, shape=self.shape, dtype=np.float32)
TypeError: init() got an unexpected keyword argument 'dtype'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users...\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\utils\closer.py", line 67, in close
closeable.close()
File "C:\Users...\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
TypeError: render() got an unexpected keyword argument 'close'
Exception ignored in: <bound method Env.del of <env.TFTraderEnv.OhlcvEnv object at 0x00000223D69C55C0>>
Traceback (most recent call last):
File "C:\Users...\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\core.py", line 203, in del
self.close()
File "C:\Users...\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
TypeError: render() got an unexpected keyword argument 'close'

from tf_deep_rl_trader.

windowshopr avatar windowshopr commented on August 11, 2024

Yeah I can't seem to get this to work. Seems like there's issues with other people having similar issues. I've tried completely uninstalling my Visual Studio 2017, reinstalling 2015, following the install guide as described above, along with others I've found online. Nothing seems to fix this error. Must be something to do with trying to install ta-lib on Windows 64 bit. If there are some other suggestions, I would love to see them. Thanks!

from tf_deep_rl_trader.

miroblog avatar miroblog commented on August 11, 2024

If installing the "python wrapper for talib" on windows is a problem,
try replacing talib functions (talib.MA , talib.RSI ...etc) written purely in numpy or pandas.

from tf_deep_rl_trader.

windowshopr avatar windowshopr commented on August 11, 2024

This is a great idea. When I get some time, I will tweak it to get it working without TA-Lib. I saw in the issues of TA-Lib that people with 64 bit operating systems are having some issues installing it as TA-Lib was first compiled in a 32 bit env? Either way, thanks for the suggestion!

from tf_deep_rl_trader.

windowshopr avatar windowshopr commented on August 11, 2024

Looks like I was able to get it working. In the "process_data.py" file, I used pandas to calculate the moving averages, and then I utilized the "ta" library instead of the "ta-lib" library where applicable.

    def add_ta_features(self):

        self.df['bmidband'] = ta.bollinger_mavg(self.close, n=20)
        self.df['blowband'] = ta.bollinger_hband(self.close, n=20, nbdev=2)
        self.df['bupband'] = ta.bollinger_lband(self.close, n=20, nbdev=2)
        self.df['pctB'] = (self.close - self.df.blowband) / (self.df.bupband - self.df.blowband)
        self.df['rsi14'] = ta.rsi(self.close, n=14)
        self.df['rsi14'] = rsi14

        self.df['macd_diff'] = ta.macd_diff(self.close, n_fast=12, n_slow=26, n_sign=9)
        self.df['macd'] = ta.macd(self.close, n_fast=12, n_slow=26, fillna=False)
        self.df['signal'] = ta.macd_signal(self.close, n_fast=12, n_slow=26, n_sign=9)

        ## addtional info
        self.df['adx'] = ta.adx(self.high, self.low, self.close, n=14)
        self.df['cci'] = ta.cci(self.high, self.low, self.close, n=14)

        ## maximum profit
        #self.df['plus_di'] = ta.PLUS_DI(self.high, self.low, self.close, timeperiod=14)

        ## lower_bound
        self.df['lower_bound'] = self.df['open'] - self.df['low'] + 1

        ## ATR
        self.df['atr'] = ta.atr(self.high, self.low, self.close, n=14)

        ## STOCH momentum
        self.df = ta.stochastic_oscillator_k(self.df)
        self.df = ta.stochastic_oscillator_d(self.df, n=10)

        ## TRIX
        self.df['trix'] = ta.trix(self.close, n=15)
        self.df['trix_signal'] = ta.moving_average(self.df['trix'], n=3)
        self.df['trix_hist'] = self.df['trix'] - self.df['trix_signal']

        ## MFI
        self.df['mfi14'] = ta.money_flow_index(self.high, self.low, self.close, self.volume, n=14)

Then I had to update the "gymWrapper.py" by editing

import gym
from gym import wrappers

...and then just replacing the gym.wrappers instances with just wrappers, and it looks like it's running now. Hopefully this helps someone who stumbles across this! Thanks @miroblog

from tf_deep_rl_trader.

Related Issues (9)

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.