Tutorial and data

Back

Good day.

Dear Team,

First allow me to thank for your job. 

Your tutorial is easy and helping alot in bulding one's knowledge on the subject.

I have expirienced some issue with examples that you have put in and would like to ask your assitance how to overcome it.

I'm trying to code in parallel to your tutorial to check/compare if i got it correctly. 

Recently import of SPY data is not working well returning following error

AuthenticationError: (Status 400) (Quandl Error QEAx01) We could not recognize your API key. Please check your API key and try again.

I have used the same code as in the Tutorial

quandl.ApiConfig.api_key = '_fgkxjSbt5389zGt4crC'

spy_table = quandl.get('BCIW/_SPXT')
amzn_table = quandl.get('WIKI/AMZN') 

Is there a free data which correspondes to the one used in tutorial?

Thanks in advance.

Nik

 

 

Update Backtest







 
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Please attach an example so we can better help you. 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


https://www.quantconnect.com/tutorials/introduction-to-financial-python/confidence-interval-and-hypothesis-testinghttps://www.quantconnect.com/tutorials/introduction-to-financial-python/confidence-interval-and-hypothesis-testingDear Jared,Thanks for a prompot reply.Here is an extract from Tutorial (and above is a link).import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import quandl
quandl.ApiConfig.api_key = 'tAyfv1zpWnyhmDsp91yv'
#get data from quandl
spy_table = quandl.get('BCIW/_SPXT')
spy_total = spy_table[['Open','Close']]
#calculate log returns
spy_log_return = np.log(spy_total.Close).diff().dropna()
print 'Population mean:', np.mean(spy_log_return)
[out]: Population mean: 0.000443353825615
print 'Population standard deviation:',np.std(spy_log_return)
[out]: Population standard deviation: 0.00784267293815


And below are code and error message that i get in my Jupiter Notebook

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import quandl
quandl.ApiConfig.api_key = 'tAyfv1zpWnyhmDsp91yv'
#get data from quandl
spy_table = quandl.get('BCIW/_SPXT')

---------------------------------------------------------------------------
AuthenticationError Traceback (most recent call last)
<ipython-input-18-d4dc6df03d0f> in <module>
5 quandl.ApiConfig.api_key = 'tAyfv1zpWnyhmDsp91yv'
6 #get data from quandl
----> 7 spy_table = quandl.get('BCIW/_SPXT')

~/opt/anaconda3/lib/python3.7/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):

~/opt/anaconda3/lib/python3.7/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:

~/opt/anaconda3/lib/python3.7/site-packages/quandl/operations/list.py in all(cls, **options)
13 options['params'] = {}
14 path = Util.constructed_path(cls.list_path(), options['params'])
---> 15 r = Connection.request('get', path, **options)
16 response_data = r.json()
17 Util.convert_to_dates(response_data)

~/opt/anaconda3/lib/python3.7/site-packages/quandl/connection.py in request(cls, http_verb, url, **options)
36 abs_url = '%s/%s' % (ApiConfig.api_base, url)
37
---> 38 return cls.execute_request(http_verb, abs_url, **options)
39
40 @classmethod

~/opt/anaconda3/lib/python3.7/site-packages/quandl/connection.py in execute_request(cls, http_verb, url, **options)
48 **options)
49 if response.status_code < 200 or response.status_code >= 300:
---> 50 cls.handle_api_error(response)
51 else:
52 return response

~/opt/anaconda3/lib/python3.7/site-packages/quandl/connection.py in handle_api_error(cls, resp)
112 klass = d_klass.get(code_letter, QuandlError)
113
--> 114 raise klass(message, resp.status_code, resp.text, resp.headers, code)

AuthenticationError: (Status 400) (Quandl Error QEAx01) We could not recognize your API key. Please check your API key and try again. 
0

And with my own key genered at Quantconnect i'm not authorized to get data from this provider.

0

Hi Nikolay Yurchak ,

I searched in Quandl for free data, for example, with SPY in its name: Free SPY Quandl and tried BATS_SPY

quandl.ApiConfig.api_key = 'yourquandlkey'
#get data from quandl
spy_table = quandl.get('BATS/BATS_SPY')
spy_total = spy_table[['Total Volume']]
#calculate log returns
spy_log_return = np.log(spy_total['Total Volume']).diff().dropna()
print ('Population mean:', np.mean(spy_log_return))

and it successfully fetched the data.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Irvin,

We can access SPY data from QuantConnect instead of Quandl. This is done in the research environment using QuantBook.

We can replace the Quandl API request for SPY data with the following. First we'll need to subscribe to SPY data.

qb = QuantBook()
spy = qb.AddEquity("SPY").Symbol

Then we can request daily historical data for SPY.

start_date = datetime(2010, 8, 1, 0, 0, 0)
end_date = datetime(2020, 1, 10, 0, 0, 0)
spy_table = qb.History(spy, start_date, end_date, Resolution.Daily)

We are currently rewriting these tutorials to use the local QuantConnect dataset instead of Quandl's.

Learn more about requesting data in research in the documentation on the research environment.

Best
Rahul 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed