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

i think util.py file is missing. #1

Open
doncat99 opened this issue May 25, 2017 · 7 comments
Open

i think util.py file is missing. #1

doncat99 opened this issue May 25, 2017 · 7 comments

Comments

@doncat99
Copy link

No description provided.

@4575759ww
Copy link

The same question, can't find util.py

@doncat99
Copy link
Author

doncat99 commented Jun 14, 2017

I simply reconstruct the only export function "get_data" in util.py file as below:

def get_data(symbols, dates_range, update):
    import os
    cwd = os.getcwd()
    dir = cwd + "/data/"
    df = pd.DataFrame()
    symbols.append('spy')
    for symbol in symbols:
        print("symbol", symbol)
        filename = dir + symbol + '.csv'
        data = pd.read_csv(filename, index_col=["Date"], parse_dates=['Date'])
        if df.empty:
            if 'Close' in data:
                df[symbol] = data['Close']
            else:
                df[symbol] = data['Rate']
        else:
            if 'Close' in data:
                df[symbol] = data['Close']
            else:
                df[symbol] = data['Rate']
    return df[df.index.isin(dates_range)].sort_index()

I used all the default setting (dates, stocks selected), and the result seems promising.
With 100,000 initial cash to start,


190044.204471


@4575759ww

@magick93
Copy link

@doncat99

I added a file called util.py and added your function.

Now when I try to run, I get further, but I now get:

python RLMDP/runner.py
Traceback (most recent call last):
  File "RLMDP/runner.py", line 2, in <module>
    from agent import PolicyGradientAgent, CriticsAgent
  File "/home/anton/git/priceinsight/Deep-Reinforcement-Learning-in-Stock-Trading/RLMDP/agent.py", line 4, in <module>
    import lasagne
  File "/usr/local/lib/python2.7/dist-packages/lasagne/__init__.py", line 19, in <module>
    from . import layers
  File "/usr/local/lib/python2.7/dist-packages/lasagne/layers/__init__.py", line 7, in <module>
    from .pool import *
  File "/usr/local/lib/python2.7/dist-packages/lasagne/layers/pool.py", line 6, in <module>
    from theano.tensor.signal import downsample
ImportError: cannot import name downs

Any idea what I might be doing wrong?

@LymengLM
Copy link

@magick93
Since downsample has been moved, try configure this file "/usr/local/lib/python2.7/dist-packages/lasagne/layers/pool.py"

from theano.tensor.signal import downsample
...
pooled_out = downsample.max_pool_2d( ... )

to

from theano.tensor.signal import pool
...
pooled_out = pool.pool_2d( ... )

@lorrp1
Copy link

lorrp1 commented Jul 9, 2018

i got: 190044.2044709011 which is good but it should be 461000

@doncat99
@LymengLM
@shenyichen105
@4575759ww

@zhoujinhai
Copy link

zhoujinhai commented Dec 31, 2018

the code just 5 interactions, I run need long time on CPU! How to improve the running speed?

@silviumatei
Copy link

the code just 5 interactions, I run need long time on CPU! How to improve the running speed?

Did you try running it on Kaggle? Usually their server is faster than my laptop, particularly if the script allows activating the GPU option.

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

7 participants