hackthemarket / gym-trading

Environment for reinforcement-learning algorithmic trading models
MIT License
699 stars 214 forks source link

incorrect Quandl code (QECx02) #3

Open Amarchuk opened 7 years ago

Amarchuk commented 7 years ago

Hi

thanks a lot for a great project, its really hard to find smth such useful.

I bump in the same issue as in #1, make described changes and came up to next error:

---------------------------------------------------------------------------
NotFoundError                             Traceback (most recent call last)
<ipython-input-3-b93e6210c1a2> in <module>()
----> 1 env = gym.make('trading-v0')
      2 #env.time_cost_bps = 0 #

C:\Anaconda\envs\py353\lib\site-packages\gym\envs\registration.py in make(id)
    159 
    160 def make(id):
--> 161     return registry.make(id)
    162 
    163 def spec(id):

C:\Anaconda\envs\py353\lib\site-packages\gym\envs\registration.py in make(self, id)
    117         logger.info('Making new env: %s', id)
    118         spec = self.spec(id)
--> 119         env = spec.make()
    120         if (env.spec.timestep_limit is not None) and not spec.tags.get('vnc'):
    121             from gym.wrappers.time_limit import TimeLimit

C:\Anaconda\envs\py353\lib\site-packages\gym\envs\registration.py in make(self)
     84 
     85         cls = load(self._entry_point)
---> 86         env = cls(**self._kwargs)
     87 
     88         # Make the enviroment aware of which spec it came from.

c:\users\root\documents\upwork\anton\gitlab\notebooks\lime\gym-trading-master\gym_trading\envs\trading_env.py in __init__(self)
    185   def __init__(self):
    186     self.days = 252
--> 187     self.src = QuandlEnvSrc(days=self.days)
    188     self.sim = TradingSim(steps=self.days, trading_cost_bps=1e-3,
    189                           time_cost_bps=1e-4)

c:\users\root\documents\upwork\anton\gitlab\notebooks\lime\gym-trading-master\gym_trading\envs\trading_env.py in __init__(self, days, name, auth, scale)
     45     self.days = days+1
     46     log.info('getting data for %s from quandl...',QuandlEnvSrc.Name)
---> 47     df = quandl.get(self.name) if self.auth=='' else quandl.get(self.name, authtoken=self.auth)
     48     log.info('got data for %s from quandl...',QuandlEnvSrc.Name)
     49 

C:\Anaconda\envs\py353\lib\site-packages\quandl\get.py in get(dataset, **kwargs)
     46         if dataset_args['column_index'] is not None:
     47             kwargs.update({'column_index': dataset_args['column_index']})
---> 48         data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)
     49     # Array
     50     elif isinstance(dataset, list):

C:\Anaconda\envs\py353\lib\site-packages\quandl\model\dataset.py in data(self, **options)
     45         updated_options = Util.merge_options('params', params, **options)
     46         try:
---> 47             return Data.all(**updated_options)
     48         except NotFoundError:
     49             if handle_not_found_error:

C:\Anaconda\envs\py353\lib\site-packages\quandl\operations\list.py in all(cls, **options)
     12             options['params'] = {}
     13         path = Util.constructed_path(cls.list_path(), options['params'])
---> 14         r = Connection.request('get', path, **options)
     15         response_data = r.json()
     16         Util.convert_to_dates(response_data)

C:\Anaconda\envs\py353\lib\site-packages\quandl\connection.py in request(cls, http_verb, url, **options)
     34         abs_url = '%s/%s' % (ApiConfig.api_base, url)
     35 
---> 36         return cls.execute_request(http_verb, abs_url, **options)
     37 
     38     @classmethod

C:\Anaconda\envs\py353\lib\site-packages\quandl\connection.py in execute_request(cls, http_verb, url, **options)
     42             response = func(url, **options)
     43             if response.status_code < 200 or response.status_code >= 300:
---> 44                 cls.handle_api_error(response)
     45             else:
     46                 return response

C:\Anaconda\envs\py353\lib\site-packages\quandl\connection.py in handle_api_error(cls, resp)
     83         klass = d_klass.get(code_letter, QuandlError)
     84 
---> 85         raise klass(message, resp.status_code, resp.text, resp.headers, code)

NotFoundError: (Status 404) (Quandl Error QECx02) You have submitted an incorrect Quandl code. Please check your Quandl codes and try again.

Do you have any ideas how to fix it?

Amarchuk commented 7 years ago

I found that it because of GOOG\NYSE_SPY request, quandl can't handle it

WLpub commented 6 years ago

Have u solve this issue, I have the same problem

WLpub commented 6 years ago

Hi, I steped over this issue by change the quandl code. You can check the webpage of quandl and find some code truely works.

crescentluna commented 6 years ago

switch "GOOG\NYSE_SPY" to "WIKI/AAPL" works, also you can change AAPL to other companys