Get DataFrame from GoogleFinance Client - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Get DataFrame from GoogleFinance Client (/thread-4229.html) |
Get DataFrame from GoogleFinance Client - ian - Aug-01-2017 How to use python 3.6 to get dataframes by using Google Finance Client (import googlefinance.client as gf) ? I would like to get data from this URL: http://www.google.com/finance/getprices?q=FB&i=3600&p=15d&f=d,o,h,l,c,v Thanks. RE: Get DataFrame from GoogleFinance Client - buran - Aug-01-2017 The examples are pretty clear. https://github.com/pdevty/googlefinance-client-python What is not clear? As far as I can see you want to get data for FB stock. To get help - show us what you have done so far - post your code in code tags, ask questions about problems you cannot resolve. In case you get error - post the full traceback in error tags RE: Get DataFrame from GoogleFinance Client - ian - Aug-01-2017 I can use the following to get dataframe but it is daily data. I am wondering if I can get dataframe of 5-minute data in the url but don't know how to make a function call like below. Thanks. http://www.google.com/finance/getprices?q=FB&i=300&p=1d&f=d,o,h,l,c,v import pandas as pd import googlefinance.client as gf param = {'q': 'FB','i': "86400",'x': "NASD",'P': "3M"} df = pd.DataFrame(gf.get_price_data(param)) print(df) RE: Get DataFrame from GoogleFinance Client - buran - Aug-01-2017 param is a dict that supply params to the function get_price_data .'q' is the stock symbol'i' is the interval in seconds. the example is '86400' (that is 24 hours * 60 minutes * 60 seconds). if you want 5 minutes interval it should be '300' (5 minutes * 60 seconds)'x' is the exchange whre it is traded ('NASD' for NSADAQ)'p' is the period - in your case '3M' . Note that it is lower-case 'p' in the example. In your code it is upper-case, which may or may not be a problem (depending on the package). To be on the safe side I would change it to 'p' Also df=pd.DataFrame(gf.get_price_data(param))Could be just df=gf.get_price_data(param) get_price_data will return DataFrame as per the example
RE: Get DataFrame from GoogleFinance Client - ian - Aug-03-2017 very nice. Thank you. |