Skip to content

Implement Google quote functionality #177

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
Feb 25, 2016
Merged

Implement Google quote functionality #177

merged 1 commit into from
Feb 25, 2016

Conversation

gliptak
Copy link
Contributor

@gliptak gliptak commented Feb 24, 2016

No description provided.

@femtotrader
Copy link
Contributor

Thanks @gliptak but there is some PEP8 errors

$ flake8 --ignore E501 pandas_datareader
pandas_datareader/google/quotes.py:6:1: E302 expected 2 blank lines, found 1
pandas_datareader/google/quotes.py:26:45: E226 missing whitespace around arithmetic operator
pandas_datareader/google/quotes.py:28:69: W292 no newline at end of file

Could you fix them ? That will be very kind.

@gliptak
Copy link
Contributor Author

gliptak commented Feb 25, 2016

@femtotrader Corrected.

femtotrader added a commit that referenced this pull request Feb 25, 2016
ENH: Implement Google quote functionality
@femtotrader femtotrader merged commit ff5fbd8 into pydata:master Feb 25, 2016
@femtotrader
Copy link
Contributor

TSGTM. Thanks @gliptak

@femtotrader
Copy link
Contributor

I noticed (too lately before merging) that

In [5]: pdr.get_quote_google(['MSFT', 'F', 'GOOG'], '2016-02-01', '2016-02-02')
Out[5]:
           0
MSFT   51.30
F      12.47
GOOG  705.07

I wonder why not just using dict... or at least a Series (not a DataFrame) !

@femtotrader
Copy link
Contributor

#184

@gliptak
Copy link
Contributor Author

gliptak commented Feb 28, 2016

@femtotrader Could you describe the format you would like to see? Thanks

@femtotrader
Copy link
Contributor

A DataFrame with only one column (named "0") is not a good idea.
A Pandas Series with key being ticker might be a better idea.
You might also define name of this Series (maybe "quote" or "quotes")

@femtotrader
Copy link
Contributor

When there is only one ticker, only quote should be returned.

For now we are having

In [18]: pdr.get_quote_google('GOOG')
Out[18]:
           0
GOOG  705.07

it should be

In [18]: pdr.get_quote_google('GOOG')
Out[18]: 705.07

same for

pdr.get_quote_google(['GOOG'])

Zipline get_pricing function is working in a similar way.

@gliptak
Copy link
Contributor Author

gliptak commented Mar 1, 2016

get_quote_yahoo('GOOG') returns:

        PE change_pct    last  short_ratio    time
 GOOG  30.47     +3.02%  718.81         1.38  4:00pm

get_quote_yahoo((['GOOG', 'AAPL', 'GOOG'])) returns:

         PE change_pct    last  short_ratio    time
GOOG  30.47     +3.02%  718.81         1.38  4:00pm
AAPL  10.70     +3.97%  100.53         1.02  4:00pm
GOOG  30.47     +3.02%  718.81         1.38  4:00pm

@femtotrader
Copy link
Contributor

Ok, so that's a DataFrame because there was more data than just last price.
But you might ensure that data have correct type.
You should display here df.dtypes and also if there is object type, display type of each data of first row (for example)
change_pct seems to be a string so you might convert to float (or decimal.Decimal).
Something like

In [56]: s = '+3.02%'
In [57]: float(s[:-1])
Out[57]: 3.02
In [58]: s = '-3.02%'
In [59]: float(s[:-1])
Out[59]: -3.02

time seems to also be a string... you might convert to datetime.time
pd.to_datetime('08:00PM').time() seems to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants