Yahoo! Finance API: Get Stock Quote in EUROS - yahoo-finance

I'm trying to use the Yahoo! Finance API to get stock quotes on companies from the German exchange XETRA in Euros. However, I always end up with the share price in US dollars.
I'm using the following query: http://de.finance.yahoo.com/d/quotes.csv?s=AAPL&f=l1
This gives me the correct value from the correct exchange but it's in dollars as opposed to Euros.
Can anyone help?
Thanks!

I don't know how to directly do this, but:
http://quote.yahoo.com/d/quotes.csv?s=USDEUR=X&f=l1
will return the real time exchange rate of US dollars to Euros. If it were me I would write a function that would multiply the dollar amount by the exchange rate.
note:
I found
http://brusdeylins.info/tips_and_tricks/yahoo-finance-api/
to be quite helpful. In his example he has "&f=nl1d1t1" which returns the n for the name ("USD/EUR"), l1 the rate, d1 the date, t1 the time.
I hope this helps.

Related

Facebook prophet: understanding if a non binary regressor is having any impact

I want to use the Facebook prophet to predict how much of our product we are going to sell on a given day.
I know that a big indicator of how much we sell is how much money we have spent on advertising in the few days before it.
So my training data looks like the below.
where y is the number of products we sold on a given day.
ds,y,daily_advertising_spend
2022-03-26 00:00:00,5000,10
2022-03-29 00:00:00,5300,30
2022-03-31 00:00:00,5700,50
2022-04-01 00:00:00,6000,10
I have the following code to create the model:
m = Prophet()
m.add_country_holidays(country_name='UK')
m.add_regressor("daily_advertising_spend")
m.fit(df)
future = m.make_future_dataframe(periods=10)
future["daily_advertising_spend"] = 10
forecast = m.predict(future)
plot_plotly(m, forecast).show()
m.plot_components(forecast).show()
The model fits the data pretty well.
But where it does really bad is when we had big marketing spend.
For example reasonably close to the start we can see that the model massively underpredicts a few points which are when our advertising spend was quite high.
I don't think that prophet is acknowledging this regressor.
How can I check if it is acknowledging it?
I have also included the regressor components chart which I can't make sense of.
What does -5.3 indicate on that chart?

Google Docs IMPORTXML exact data value

first of all: I'm completely new to this, I just started with XML/HTML an hour ago and I tried to import data from a website to work with it in Google Docs/tables. The website uses HTML and I try to import the exact value behind a displayed one and rounded version on the website i.e. for example instead of 86% displayed I want the value 0.8597.
In this example I try to grab the Playoff chances for every NFL team in the 2021 season, recent week, based of FiveThirtyEight's predictions.
First off, I import the team names using this formula:
=IMPORTXML("https://projects.fivethirtyeight.com/2021-nfl-predictions/"; "//table[#id='standings-table']/tbody/tr/td[#class='team']/span[#class='full']")
After that, I try to import the playoff chances with this formula:
=IMPORTXML("https://projects.fivethirtyeight.com/2021-nfl-predictions/"; "//table[#id='standings-table']/tbody/tr/td[#class='pct div']")
That returns the following:
TEAM
Playoff chances
Rams
86%
Buccaneers
83%
...
...
But I want this:
TEAM
Playoff chances
Rams
0.8597
Buccaneers
0.82702
...
...
The whole element with the values looks like this, in this case for the Los Angeles Rams (LAR) <td class="pct div" data-team="LAR" data-cat="make_playoffs" data-val="0.8597" style="background-color:rgb(36, 159, 219);color:#000;">86%</td>
Instead of the >86%< I want to receive the data-val="0.8597"
I tried to describe my problem as good as I can, I hope you can understand it. Thanks for anyone reading this or even answering!
-Daxelinho
In your situation, how about the following xpath?
Modified xpath:
//table[#id='standings-table']/tbody/tr/td[#class='pct div']/#data-val
and
//td[#class='pct div']/#data-val
Result:
When the above xpath is used, the following result is obtained.
In this case, the sample formula is =IMPORTXML("https://projects.fivethirtyeight.com/2021-nfl-predictions/", "//td[#class='pct div']/#data-val")

Can someone see what is wrong with this XIRR() computation in Google Sheets? (I have sent a request to Google ...)

Please review https://docs.google.com/spreadsheets/d/1cWIAdWylD5Mx8zP5gFwkSVkAYLwXuFopoH_9mi2tGWg/edit#gid=0. It contains some dates and corresponding investment amounts. My goal is to have XIRR() compute the rate of return. While it is obvious that the result must be negative, the cell C1, with the formula XIRR(B3:B16,A3:A16), produces a huge positive number.
Thanks in advance.
I just realized that I didn't provide a 3rd argument, rate_guess, in the original invocation of XIRR(). (Thanks to #player0 for prompting me). With rate_guess provided, the result is believable.

Average numbers in the format "Minutes:seconds.fractions_of_seconds" in Google Docs

I've tried doing a custom format, but don't have any luck. I always get a divide by zero error. Ideally, I'd be able to average "1:00.0, 1:30.00, and 2:00.00" and have the function return "90.0" OR "1:30.0"
Can someone help me convert the times into values that the average function can understand?
This is in Google Sheets
Assuming 1:00.0 is in A1, 1:30.00 in A2 etc. The mix of : and , seems not to be accepted as a number format for data entry, so your data is presumably strings. These need first to be converted to numbers. This might be achieved with something like:
=ArrayFormula(value("0:"&A1:A100))
in B1. It not only assumes you have 100 rows of data but also that your data points do not individually equal or exceed one hour unless expressed as 60 minutes or more.
You may want to format the results with Format – Number, More Formats, Custom number format…:
mm:ss.000
though in this format hours are not shown.
In that format the result of:
=average(B1:B3)
should be:
01:30.000
Might not work in old Google Sheets.

National Weather Service (NOAA) REST API returns nil for parameters of forecast

I am using the NWS REST API as my weather service for an app I am making. I was initially reluctant to use NWS because of its bad documentation, but I couldn't resist as it is offered completely free.
Now that I am trying to use it, I am running into some difficulty. When making a request for multiple days, the minimum temperature appears nil for several days.
(EDIT: As I have been testing the API more I have found that it is not always the minimum temperatures that are nil. It can be a max temp or a precipitation, it seems completely random. If you would like to make test calls using their web interface, you can do so here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserByDay.htm
and here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXML.htm)
Here is an example of a request the minimum temperatures are empty: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?listLatLon=40.863235,-73.714780&format=24%20hourly&numDays=7
Surprisingly, on their website, the minimum temperatures are available:
http://forecast.weather.gov/MapClick.php?textField1=40.83&textField2=-73.70
You'll see under the Minimum temperatures that it is filled with about 5 (sometimes less, it is inconsistent) blank fields that say <value xsi:nil="true"/>
If anybody can help me it would be greatly appreciated, using the NWS API can be a little overwhelming at times.
Thanks,
The nil values, from what I can understand of the documentation, here and here, simply indicate that the data is unavailable.
Without making assumptions about NOAA's data architecture, it's conceivable that the information available via the API may differ from what their website displays.
Missing values are represented by an empty element and xsi:nil=”true” (R2.2.1).
Nil values being returned seems to involve the time period. Notice the difference between the time-layout keys (see section 5.3.2) in 1 in these requests:
k-p24h-n7-1
k-p24h-n6-1
The data times are different.
<layout-key> element
The key is derived using the following convention:
“k” stands for key.
“p24h” implies a data period length of 24 hours.
“n7” means that the number of data times is 7.
“1” is a sequential number used to keep the layout keys unique.
Here, startDate is the factor. Leaving it off includes more time and might account for some requested data not yet being available.
Per documentation:
The beginning day for which you want NDFD data. If the string is empty, the start date is assumed to be the earliest available day in the database. This input is only needed if one wants to shorten the time window data is to be retrieved for (less than entire 7 days worth), e.g. if user wants data for days 2-5.
I'm not experiencing the randomness you mention. The folks on NOAA's Yahoo! Groups forum might be able to tell you more.

Resources