Skip to content
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

Added QuandlReader (plus tests and doc) #361

Merged
merged 1 commit into from Jul 7, 2017

Conversation

@gliptak
Copy link
Contributor

gliptak commented Jul 5, 2017

Completing #346

Closing #360

Copy link
Contributor

jreback left a comment

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:

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

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

something like

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

done

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

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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']

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

use df.loc[...]

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

corrected


class QuandlReader(_DailyBaseReader):

"""

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

can you add a versionadded 0.5.0

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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,

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

extra comman

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

done

Parameters
----------
symbols : string.

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

no period at the end

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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/"

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

make the base_url a class property

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

modeled after Google options _OPTIONS_BASE_URL

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

def _db_from_countrycode(self, code):
map = dict(

This comment has been minimized.

Copy link
@jreback

jreback Jul 5, 2017

Contributor

maybe make a class property

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

changed

@jreback jreback added the enhancement label Jul 5, 2017
@jreback jreback added this to the 0.5.0 milestone Jul 5, 2017
@jreback
jreback approved these changes Jul 6, 2017
Copy link
Contributor

jreback left a comment

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

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

moved


.. _remote_data.quandl:

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

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

add the http link to quandl.com

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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.

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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.

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

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,

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

I would remove this comment.

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

removed unfortunately

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

This comment has been minimized.

Copy link
@jreback

jreback Jul 6, 2017

Contributor

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

This comment has been minimized.

Copy link
@gliptak

gliptak Jul 6, 2017

Author Contributor

updated TOC

@gliptak

This comment has been minimized.

Copy link
Contributor Author

gliptak commented Jul 6, 2017

@jreback Green after updates

@jreback jreback merged commit a88c84e into pydata:master Jul 7, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.2%) to 85.87%
Details
@jreback

This comment has been minimized.

Copy link
Contributor

jreback commented Jul 7, 2017

thanks @gliptak !

@gliptak gliptak deleted the gliptak:PR346 branch Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.