Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
RomelTorres committed Apr 15, 2018
2 parents 6ba2d52 + 0351a61 commit f4303d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Alpha Vantage delivers a free API for real time financial data and most used fin
Vantage (http://www.alphavantage.co/). It requires a free API, that can be requested on http://www.alphavantage.co/support/#api-key. You can have a look at all the api calls available in their documentation http://www.alphavantage.co/documentation

## News

* From version 1.9.0 onwards, the urllib was substituted by pythons request library that is thread safe. If you have any error, post an issue.
* From version 1.8.0 onwards, the column names of the data frames have changed, they are now exactly what alphavantage gives back in their json response. You can see the examples in better detail in the following git repo: https://github.com/RomelTorres/av_example
* From version 1.6.0, pandas was taken out as a hard dependency.
Expand Down
8 changes: 6 additions & 2 deletions alpha_vantage/alphavantage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AlphaVantage(object):
"https://www.alphavantage.co/digital_currency_list/"

def __init__(self, key=None, retries=5, output_format='json',
treat_info_as_error=True, indexing_type='date'):
treat_info_as_error=True, indexing_type='date', proxy={}):
""" Initialize the class
Keyword Arguments:
Expand Down Expand Up @@ -58,6 +58,7 @@ def __init__(self, key=None, retries=5, output_format='json',
# variable will be overriden by those functions not needing it.
self._append_type = True
self.indexing_type = indexing_type
self.proxy = proxy

def _retry(func):
""" Decorator for retrying api calls (in case of errors from the api
Expand Down Expand Up @@ -214,6 +215,9 @@ def _format_wrapper(self, *args, **kwargs):
self.output_format))
return _format_wrapper

def set_proxy(self, proxy={}):
self.proxy = proxy

def map_to_matype(self, matype):
""" Convert to the alpha vantage math type integer. It returns an
integer correspondant to the type of math to apply to a function. It
Expand Down Expand Up @@ -254,7 +258,7 @@ def _handle_api_call(self, url):
meta_data_key: The key for getting the meta data information out
of the json object
"""
response = requests.get(url)
response = requests.get(url, proxies=self.proxy)
if 'json' in self.output_format.lower() or 'pandas' in \
self.output_format.lower():
json_response = response.json()
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='alpha_vantage',
version='1.9.0',
version='2.0.0',
author='Romel J. Torres',
author_email='[email protected]',
license='MIT',
Expand All @@ -30,6 +30,7 @@
url='https://github.com/RomelTorres/alpha_vantage',
install_requires=[
'requests',
'simplejson'
],
test_requires=[
'nose',
Expand Down

0 comments on commit f4303d8

Please sign in to comment.