Yahoo Finance API from date - to date query - yahoo-api

I would like to get a few days of historical data. The following link works but seems to be a little weird. In this example I would like to get data from May 4, 2016 to May 6, 2016. I guess the Yahoo API value for the month is 0-11 and not 1-12. Seems to make sense anyway.
http://ichart.finance.yahoo.com/table.csv?s=WU&a=05&b=04&c=2016&d=05&e=06&f=2016&g=d&ignore=.csv
This doesn't work.
http://ichart.finance.yahoo.com/table.csv?s=WU&a=04&b=04&c=2016&d=05&e=06&f=2016&g=d&ignore=.csv
This returns the exact dates I want
http://ichart.finance.yahoo.com/table.csv?s=WU&a=03&b=04&c=2016&d=05&e=06&f=2016&g=d&ignore=.csv
This returns the days from April 4,2016 to May 6, 2016.

The params are:
a= Start month - 1
b=day
c=year
d= End month - 1
e=day
f=year
Where start <= end

Related

In Which format the date is given?

I have downloaded a dataset called Real estate valuation data set from https://archive.ics.uci.edu/ml/datasets/Real+estate+valuation+data+set?source=post_page . But I am not able to understand in which format the transaction date is given. They have given some examples like 2013.250=2013 March, 2013.500=2013 June, etc.
I encountered this same problem and I figured that the months were represented as a fraction of a year. So, for instance, June is the 6th month of the year, hence it is 6/12 = 0.5; that's why we had June 2013 as 2013.500, etc.

Display a date in Google Sheets that increments by two weeks every other week

I would like a spreadsheet row to contain the date of today, but only on every other Thursday, changing at 9:30 am.
To give you an example:
Next thursday the 21.07.16 it shell contain "21.07.16".
Until in exactly 14 days on thursday the 4.08.16 it shell contain this date and than change to 4.08.16.
Also I would like this change to happen at 9:30 am.
I can not think of a way how to do this. Can you point me into a direction?
One has to set a starting datetime somewhere in the past, such as July 7, 2016, at 9:30am.
Then find the difference between the current and the starting datetime. Truncate this difference down to a multiple of 14, and add this value to the starting datetime.
The datetimes are represented in Sheets numerically as the number of days since December 30, 1899. In this system, 2016-07-07 9:30 is about 42558.4 So the formula would be
=42558.4 + 14*floor((now()-42558.4)/14)
The output should be formatted as a date.
A less cryptic version is
=value("2016-07-07 09:30") + 14*floor((now() - value("2016-07-07 09:30"))/14)
(value follows the local convention for parsing dates, but I hope the format I used will be understood universally.)

What Date Time Format is this?

What date time format is this : 735715:37344280
<ExecDateTOD Friendly="Monday April 27, 2015 10:23:00am">735715:37344280</ExecDateTOD>
It's found in C:\Windows\Performance\WinSAT\DataStore\file_name.xml, and is the date time when the Windows Experience Index Assessment test was run.
Any idea how it's structured and can be edited? I need to change it to a previous years Date.
It seems that this format is called VariantTime, in MSDN the call to convert time is called VariantTimeToSystemTime. So it may be number of days, with decimal part after the :.
For the timestamp 735715:37344280
The first number (the one before the colon) is the number of days since the year 0:
735715 / 365 = 2015.66
The second number (the one after the colon) is the number of milliseconds that have passed within the current day.
37344280 / (1000*60*60) = 10.37 hours since start of day
So you can just subtract 365 days from the first number to obtain the previous year like this:
<ExecDateTOD Friendly="Monday April 27, 2014 10:23:00am">735350:37344280</ExecDateTOD>
Note that there were no leap years in either 2015 or 2014, so these year are exactly 365 days long.
Here is a link to a page with another <ExecDateTOD> tag where you can compare: http://www.scribd.com/doc/82935159/2012-01-30-16-00-49-986-Formal-assessment-Recent-WinSAT#scribd
I think that if you subtract 365 from that number, you'll be in previous year.
That number seems to be days since the year 0. The first part might be the number of days, taking into account leap years, etc). The second part the time coded in some way.

Filtering for dates less than or or equal to 9 months in the future in an Access query

Once a week I need to run a report where I query an Access database for any product that will expire in 9 months or less. The way they want it calculated is to take the date 9 months into the future and return anything that expires at the end of that month or sooner. If it were simply 270 days or less, I'd have no problem. (I'd also have no problem if I could do it in Excel, but that's not an option for now).
I came up with a solution that works every month of the year, unless it happens to be March (more specifically between March 6th and April 5th).
< DateValue(Month(Date()+270)+1 & "/1/" & Year(Date()+270))
So basically I'm:
adding 270 days to today's date
extracting the resulting month
adding 1 to the month
putting it back together as a text string so I can use < the 1st of the following month
for the year, I'm using the year from the date +270 days so I don't end up using the current year by accident
The trouble is that for the date range above (which I unhappily discovered today), I land in December when I add 270 days, so the following month is in a different year. As a result, my report only produced items that already expired.
In other words, on March 5th, I would have needed a list of everything expiring prior to December 1, but on March 6th, I need everything before January 1 of the next year.
Is there a more effective way to do this that avoids this issue? I thought of using
You may have had DateDiff in mind, and it can be used:
Where DateDiff("m", Date(), [YourDateField]) Between 0 And 9
However, that will ignore an index you might have on [YourDateField].
This, however, will include products that expired previously in the current month.
The alternative is DateSerial as Hans showed but he forgot that in SQL Date() must be used and that only those products that will expire should be listed:
Where [YourDateField] Between Date() And DateSerial(Year(Date()), Month(Date()) + 10, 0)
Use the DateSerial Function to compute the future date you need.
Here is a demonstration in the Access Immediate window which computes the date 9 months from today:
? Date
3/6/2015
? DateSerial(Year(Date), Month(Date) + 9, Day(Date))
12/6/2015
However, as I understand your requirement, you actually want dates from that entire month. In that case you can compute the first of the month which is 10 months from today and ask for everything less than that date.
? DateSerial(Year(Date), Month(Date) + 10, 1)
1/1/2016
You can include that expression in your query like this ...
WHERE expire_date < DateSerial(Year(Date()), Month(Date()) + 10, 1)

Table Calc - with IF statement? - Tableau

We have YTD data only. I've been trying to get a MTD running across the table.
So I thought I can run a Table calculation type - "Difference From" previous month.
This works well except for the first month of the year.
Jan MTD = Jan YTD NOT Jan YTD less Dec YTD
So January numbers are never right.
Is there a way to say, If month = "Jan" don't perform the table calc?
regards
Gem
You probably have something like
ZN(SUM([YTD])) - LOOKUP(ZN(SUM([YTD])),-1)
Then, for the first entry, LOOKUP() will return null. All you need to do is to return 0 instead, using ZN()
ZN(SUM([YTD])) - ZN(LOOKUP(ZN(SUM([YTD])),-1))
In case you don't know, you need to go to Edit Table Calculation..., then Edit Formula...
EDIT: I understand you have a bigger problem, that is your rolling sum restarts every year. In that case you really need an IF statement, but it is possible to overcome your "it's not always the same starting month" problem. You just need to check if that month is the first in your list or multiple of 12:
IIF(-FIRST()%12 = 0,
ZN(SUM([YTD])),
ZN(SUM([YTD])) - LOOKUP(ZN(SUM([YTD])), -1))
You just have to understand the FIRST() function. It will return the distance from the current position to the starting position. So, if you start in February, in August First() will return -6.
And the modulo operator will guarantee you restart every 12 months
Thanks Inox.
You are correct.
However I was intending more like this:
IIF(min(month([period_date]))=1,
ZN(SUM([YTD])),
ZN(SUM([YTD])) - LOOKUP(ZN(SUM([YTD])), -1))
Since the formula is an aggregate, I had to use "min" for the date. That was my problem using the IIF function, which was not apparent in my question.
This will produce MTD beyond 1 year, When it reaches the second January, it will not subtract Dec YTD.
Only problem I have now though is, if you begin the table on a month other than January... ie Feb.
Feb MTD is not Feb YTD??
(this is another problem, my report is to produce a rolling 12 month)... ie Feb to Jan, Mar to Feb)
So far, I'm just displaying 2 years to get over this, so forcing it to start on January. Not really a solution, but it gets the information across 12 months.