Python Forum
Google Financial Client
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google Financial Client
#1
It worked before but for some reason, when run below, I got error. Please advise. Thanks.

import googlefinance.client as gf
import pandas as pd
s = 'DOL.TO'
param = {'q': s,'i': "86400",'x': "TSE",'p': "3Y"}
gf.get_price_data(param)
====================== RESTART: D:/Run/Python/Test1.py ======================
Traceback (most recent call last):
File "D:/Run/Python/Test1.py", line 5, in <module>
gf.get_price_data(param)
File "C:\Program Files\Python36\lib\site-packages\googlefinance\client.py", line 14, in get_price_data
if cols[0][0] == 'a':
IndexError: string index out of range
>>>
Reply
#2
Read the traceback to find your error, that's what it's for

s has not been defined, needs to be 's',
or to be consistant with your style? "s",
Reply
#3
there is no error anymore when run today but it returns no data in dataframe. anyone can confirm if Google server ok or having issue? thanks.
Reply
#4
tried:
http://finance.google.com/finance/info?client=ig&q=NASDAQ:GOOG
got 404 error ( The requested URL was not found on this server )
guess it's gone!

caveat: this was the url for real time quotes
Reply
#5
https://finance.google.com/finance/getpr...,c,o,h,l,v
This url is still working. Is there a way to make change to get get_price_data(param) work?
Reply
#6
I was able to get similar information directly into a csv file.
For example, this gets historical data of the markets for the period of September 1 to 20 (yesterday)
http://www.google.com/finance/historical...output=csv
results sample:
Output:
Date,Open,High,Low,Close,Volume 20-Sep-17,922.98,933.88,922.00,931.58,1669763 19-Sep-17,917.42,922.42,912.55,921.81,936654 18-Sep-17,920.01,922.08,910.60,915.00,1306922 15-Sep-17,924.66,926.49,916.36,920.29,2505430 14-Sep-17,931.25,932.77,924.00,925.11,1397644 13-Sep-17,930.66,937.25,929.86,935.09,1102631 12-Sep-17,932.59,933.48,923.86,932.07,1134397 11-Sep-17,934.25,938.38,926.92,929.08,1266991
Trying to find a listing of all possible commands.
Reply
#7
Thank you.
1. Is there a way to read it into a DataFrame without manually save it to csv file?
2. Is a way to get intraday data? I have script using gf.get_price_data(param) that stop working as above.
Reply
#8
Here are some links I found, some of them refer to intraday data:
http://www.networkerror.org/component/co...e-api.html
http://www.codeproject.com/Articles/2219...Google-Fin
http://www.doubledoji.com/how-to-downloa...e-finance/
https://groups.google.com/forum/#!topic/...OBpvoNQ2Ec

I'm not good with pandas, so can only say that you can probably save to a dataframe.
Good luck!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Filling NaNs in a financial dataset larzz 11 1,894 Jun-07-2023, 03:40 PM
Last Post: snippsat
  how to extract financial data from photocopy of document angela1 6 3,618 Feb-15-2020, 05:50 PM
Last Post: jim2007
  Financial Modeling MarkHaversham 2 4,747 Feb-11-2020, 10:55 AM
Last Post: Mikhail_Shi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020