How do i pull latest data from yahoo api? - yahoo-api

I am trying to pull the Latest data from Yahoo API but i am not sure how to.....
In the YQL page
select * from yahoo.finance.xchange where pair in ("USDJPY")
What would i add at the end to pull the latest result?
I tried select * from yahoo.finance.xchange where pair in ("USDJPY") ORDER BY Date DESC LIMIT 1
But it doesnt work
Because at the moment, the time of the result is totally random.
Thanks for your time

Related

Tableau Include Latest Revision (Publish) Date in Dashboard

I have a dashboard I am developing in 2018.2.3 Desktop that will eventually get published to our internal Tableau Web Portal. I am writing a "Help" tab that has some documentation, directions, etc. for users to view in case they are curious what report is for, how to use it, definitions, etc..
One piece that I want to include at the header of this are three dates:
Report Created
Report Data Refresh
Report Publish Date
The first two are simple, the "Report Created" is just text, since I have no idea how to get the date the report was actually started. Text is fine for this. The Data Refresh is simple as using the, "". That works perfectly.
My only issue is I'd like to include the most recent publish date / revision. Now, I see this in the Tableau Web as meta data on the dashboard, but I'd like it to be part of this "Help" page. Is there a way to do this with some sort of dimension or variable? Thanks in advance.
If you are on Server and not Online, you can take a look at getting this data from the WORKGROUP database that Tableau Server runs from. Use this guide from Tableau to get that setup.
Then you will want to look at the workbook, sites and workbook_versions tables. Here is a sample query that could help.
select s.name site, w.name workbook, wv.version_number, wv.published_at, w.updated_at
from workbooks w
left join sites s on w.site_id = s.id
left join workbook_versions wv on w.id = wv.workbook_id
where upper(w.name) like '%<WORKBOOK>%'
group by 1,2,3,4,5
having w.updated_at = max(w.updated_at)
published_at is a timestamp of the initial publish.
updated_at is the last date it was updated.
version_number is a count of how many times the workbook has been published to on that site.
Here is a data dictionary for all the other available tables.
You can pull this query as a new data source and build the text that you want to display.

How to pull github timeline data from BigQuery

I am having trouble accessing the GitHub timeline from BigQuery.
I was using the following query:
SELECT repository_name, actor_attributes_company, payload_ref_type, payload_action, type, created_at FROM githubarchive:github.timeline WHERE repository_organization = 'foo' and created_at > '2014-07-01'
and everything was working great. Now, it looks like the githubarchive:github.timeline table is no longer available. I've been looking around and I found another table:
SELECT repository_name, actor_attributes_company, payload_ref_type, payload_action, type, created_at FROM publicdata:samples.github_timeline WHERE repository_organization = 'foo' and created_at > '2014-07-01'
This query works but returns zero rows. When I remove the created_at restriction it worked but only returned a few rows from 2012 so it looks like this is just sample data.
Does anyone know how to pull live timeline data from GitHub?
Indeed, publicdata:samples.github_timeline has only sample data.
For the real GitHub Archive documentation, look at http://www.githubarchive.org/
I wrote an article yesterday about querying it:
https://medium.com/#hoffa/analyzing-github-issues-and-comments-with-bigquery-c41410d3308
Sample query:
SELECT repo.name,
JSON_EXTRACT_SCALAR(payload, '$.action') action,
COUNT(*) c,
FROM [githubarchive:month.201606]
WHERE type IN ('IssuesEvent')
AND repo.name IN ('kubernetes/kubernetes', 'docker/docker', 'tensorflow/tensorflow')
GROUP BY 1,2
ORDER BY 2 DESC
As Mikhail points out, there's also another dataset with all of GitHub's code:
https://medium.com/#hoffa/github-on-bigquery-analyze-all-the-code-b3576fd2b150
Check out githubarchive BigQuery project
It has three datasets: day, month, year with respective daily, monthly and yearly data
Check out https://cloudplatform.googleblog.com/2016/06/GitHub-on-BigQuery-analyze-all-the-open-source-code.html for more details

Find date of newest release in github

I am trying to write a script that will get the most recent release for a specific repository in github, and then display the commits since that release was created.
I know I can get the commits using this:
https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
And I would like to get the published_at date of the most recent release so I can use it to create a request to the github API like this:
curl https://api.github.com/repos/RepoOwner/MyRepo/commits?since=2015-01-01T00:00:00Z
Where 2015-01-01T00:00:00Z happens to be the published_at date of the most recent release. I know I can get a list of releases like this:
https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
My plan was to get the list of releases in descending order by date, and then just examine the first one to figure out what the date of the release was. But sorting doesn't seem to work. Specifying that the results should be sorted by sort=published_at with either asc or desc for order seem to have the same results (https://api.github.com/repos/ReporOwner/myrepo/releases?sort=published_at&order=desc vs. https://api.github.com/repos/ReporOwner/myrepo/releases?sort=published_at&order=asc). I'm guessing github API doesn't support sorting on this result set list.
Is there some other way I can get the date of most recent release?

Querying old links from public Facebook page returns an empty set

I am trying to fetch links that were posted on a public Facebook page sometime ago, in 2011 for example. Specifically, the Arabic CNN page on facebook: http://www.facebook.com/CNNArabic
Things I tried:
1- Graph API, a query like this:
CNNArabic/links?fields=id,name,link,created_time&limit=25&until=2012-05-15
2- FQL
SELECT link_id, url, created_time FROM link WHERE owner = 102581028206 and created_time < 1337085958 LIMIT 100
Both give an empty data set while there is data on the page on or before this date.
Other things I noticed:
1-If I changed the date to something like 2013-01-17 (which is yesterday), it works fine.
2-If I changed the date to something like 2012-12-17 (about a month ago), an empty data set is returned, however if I followed the next page links in the returned data set from the query in number 1 above until I pass by this date I actually get data.
I tried writing code that kept following the next page pointers until I reach the links on the date I want. However I need data much older (say in 2011) and the result set gets exhausted say 2 or 3 months earlier than now, in other words no more next links are returned so I actually can never reach that old data.
To cut this short:
is there a way I can query links that were posted on a public page before a specified date?
Querying the page's feed works in the Graph API:
/102581028206/feed?fields=id,link,name,created_time&limit=25&until=2012-05-15
This returns all the posts. There should be a way to filter this using field expansion, but I couldn't get the few things I tried to work.
You can get this filtered for links only with FQL on the stream table:
SELECT message, attachment, created_time FROM stream WHERE source_id = 102581028206
AND created_time < strtotime('2012-05-15') AND type=80 LIMIT 10
Links are type=80.

How to Sort/ Limit the API call for Groups for member list

I see that we can only get 500 members of a group using the graph API.
and the doc says these are "the first 500 members",
Are these sorted by date signed up, or latest 500?
Is there any way I can further limit these to signed up in the last 24 hours/ 1 week?
Is the 500 limit there in using FQL also? (the docs don't specify that )
Is there any way I can further limit these to signed up in the last 24 hours/ 1 week using FQL?
i see that we can only get 500 members of a group using the graph API. and the doc says these are "the first 500 members",
are these sorted by date signed up, or latest 500,???
I’d say by date of joining the group, because otherwise calling them the “first” 500 would make little sense.
Is the 500 limit there in using FQL also? (the docs dont specify that )
From my tests there seems to be no such limit on the group_member table (just tried it for the FB developer group using Grapf API explorer, and my browser froze for about a minute loading the data).
is there any way i can further limit these to signed up in the last 24 hours/ 1 week using FQL?
No, there is no such info as signup date in the FQL table.