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.