Open Ang3er opened 7 years ago
I've had similar issues. Try replacing
https://www.google.com/finance/getprices
with https://finance.google.com/finance/getprices
everywhere in client.py and see if it helps.
BIT:ENV works fine for me after the change. Before the change the library makes a request to https://www.google.com/finance/getprices?i=86400&x=BIT&q=ENV&p=1Y which gets redirected to https://finance.google.com/finance/getprices?q=ENV&p=1Y and returns wrong results (it looses the exchange identifier and therefore returns results for ENV on NYSE, rather than ENV on BIT). After the change the library makes a request to https://finance.google.com/finance/getprices?i=86400&x=BIT&q=ENV&p=1Y which returns the correct results. You can try this out in your browser.
I don't think todays prices fit in the data of this particular function which return historical prices for a long time window. It return close, high, low, open and volume. There is no column for current price. You could only provide open for the current day, but you need to wait until the exchange closes to be able to give the close, high and low price and know how much volume there was for the day.
There is probably a different function in the Google API to get the current price. Google deprecated the API years ago though, so no guarantee it is there now or will be there in the future. Not sure if this library implement getting the current quote either. I haven't seen it, but I only began using this particular library a couple days ago.
Can you post a URL/example for the intraday query?
I guess i=60&p=1H does the job.
Try replacing https://www.google.com/finance/getprices with https://finance.google.com/finance/getprices everywhere in client.py and see if it helps.
Yes, that helped.
Please publish a new version via pypi, thanks.
Please publish a new version via pypi, thanks.
I'm not the owner of this github repository just a user, so I can't. Yet another user already created a pull request with the fix, but the original author has not responded yet and has been last active on github 6 month ago, so there is a chance this code is abandoned. If you really care about pypi availability you could fork it and publish your own fixed version .
I need currency prices. Ideally the newest possible.
For now I am using:
query=[{'q': 'USDEUR'}, {'q': 'USDCNY'}, {'q': 'USDJPY'}, ...]
forex=googlefinance.client.get_prices_data(query, period = '2d')
which seems to then query endpoints like
https://finance.google.com/finance/getprices?q=USDBRL&p=2d&i=86400
now there are several issues:
yes I have also tried
https://finance.google.com/finance/getprices?q=USDBRL&p=2h&i=3600
but get empty tables back (depending on the exact time of day).
And
googlefinance.getQuotes(symbols="USDBRL")
which generates this URL
http://finance.google.com/finance/info?client=ig&q=USDBRL
comes back 404
any hints?
Thanks!
by the way, if anyone's interested, I am using it for this onepage app: http://btc.hopto.org
yes I have also tried https://finance.google.com/finance/getprices?q=USDBRL&p=2h&i=3600 but get empty tables back.
Use a larger p and it wont be empty. Using the smaller i you should get you the last pricer, rather than last days price.
https://finance.google.com/finance/getprices?q=USDBRL&p=5d&i=3600
If I am not wrong this is not a problem of this package but a characteristic of the data, in fact also on google finance chart stock split are not accounted for.
True, and there is probably no way around it with the Google Finance data. Your linkedin page says you work at Morgan Stanley, shouldn't you have access to better datasources there which account for stocksplits, dividends and spin-offs?
does googlefinance also provide a "ticker" type of data with really only the last price, and not a whole table of many datetime-to-prices information?
Asking because that call that is used here does become very slow when asking for several currencypair symbols.
HI there,
Iam facing the problem that wrong values are recieved, for example the tickers FRA:ADE, FRA:SIE, FRA:IFX
Do I have to use the script in a specific way when calling FRA, as some of the values are correct and some are not.
Thanks in advance Ang3er