Skip to content

Added QuandlReader (plus tests and doc) #361

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

Merged
merged 1 commit into from
Jul 7, 2017
Merged

Added QuandlReader (plus tests and doc) #361

merged 1 commit into from
Jul 7, 2017

Conversation

gliptak
Copy link
Contributor

@gliptak gliptak commented Jul 5, 2017

Completing #346

Closing #360

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good. some comments, can you also add a changelog entry (0.5.0) / enhancements.

@@ -79,7 +79,7 @@ Historical dividends from Yahoo! Finance.
.. _remote_data.yahoo_quotes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this got changed to 100755 for some reason, can you switch back

something like

git update-index --chmod -x <file> should do it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

df = web.DataReader(symbol, 'quandl', "2015-01-01", "2015-01-05")
df.ix['2015-01-04']

.. _remote_data.quandl:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put this right before the Quandl (and move the enigma one right before the Enigma)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import pandas_datareader.data as web
symbol = 'WIKI/AAPL' # or 'AAPL.US'
df = web.DataReader(symbol, 'quandl', "2015-01-01", "2015-01-05")
df.ix['2015-01-04']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use df.loc[...]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -22,6 +22,7 @@
from pandas_datareader.enigma import EnigmaReader
from pandas_datareader.oanda import get_oanda_currency_historical_rates
from pandas_datareader.nasdaq_trader import get_nasdaq_symbols
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm lots of files look like the got the 100644 -> 100755

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected


class QuandlReader(_DailyBaseReader):

"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a versionadded 0.5.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Beware of ambiguous symbols (different securities per country)!
Note: Cannot use more than a single string because of the inflexible
way the URL is composed of url and _get_params in the superclass
start : string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra comman

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


Parameters
----------
symbols : string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no period at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# secondary convention SYM.CountryCode:
symbol = mm.group(1)
datasetname = self._db_from_countrycode(mm.group(4))
base_url = "https://www.quandl.com/api/v3/datasets/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the base_url a class property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modeled after Google options _OPTIONS_BASE_URL

return re.match("(?:" + regex + r")\Z", string, flags=flags)

def _db_from_countrycode(self, code):
map = dict(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make a class property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@jreback jreback added this to the 0.5.0 milestone Jul 5, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. some doc comments. ping on green.

@@ -199,6 +199,32 @@ Available expiry dates can be accessed from the ``expiry_dates`` property.

.. _remote_data.enigma:

Quandl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the quandl tag should be before the Quandle\n------\n; and move the enigma one before Enigma.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved


.. _remote_data.quandl:

Daily financial data (prices of stocks, ETFs etc.) from quandl.com.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the http link to quandl.com

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


Daily financial data (prices of stocks, ETFs etc.) from quandl.com.
The symbol names consist of two parts: DB name and symbol name.
DB names can be all the free ones listed on the Quandl website.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a link here to the 'free ones'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

ticker symbols, in some other cases (such as FSE) they can be a bit strange.
Some sources are also mapped to suitable ISO country codes in the dot suffix
style shown above,
currently available for BE, CN, DE, FR, IN, JP, NL, PT, UK, US.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if available can you provide a link to the quandl docs about this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added link to all datasets

style shown above,
currently available for BE, CN, DE, FR, IN, JP, NL, PT, UK, US.

Unfortunately (as of June 2017), each DB has a different data schema,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed unfortunately

@@ -79,7 +79,7 @@ Historical dividends from Yahoo! Finance.
.. _remote_data.yahoo_quotes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also a TOC in this file (its done manually but that's ok). add an entry there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated TOC

@gliptak
Copy link
Contributor Author

gliptak commented Jul 6, 2017

@jreback Green after updates

@jreback jreback merged commit a88c84e into pydata:master Jul 7, 2017
@jreback
Copy link
Contributor

jreback commented Jul 7, 2017

thanks @gliptak !

@gliptak gliptak deleted the PR346 branch July 10, 2017 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants