How to retrieve more than a month of stock quotes using Yahoo finance api? - json

Basically I'm new to using Yahoo finance Api. I've tried YQL Console but I can seem to find what I needed. I have to get like 3 months worth of stock quoute data. I found this http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=30d/json
This is exactly the sets of data that I needed but it only gives me a whole month of data. No matter how I change the range=30d to say range=90d it gives me the same result.

Sorry cant comment due to my low reputation.
what you need to do exactly is use the following arguments in the url
30days: 30d
90days/ 3months: 3m
180days/ 6 months: 6m
365days/1 year: 1y
so the link for 3 months will be
http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=3m/json
Hope it helps. :)

Related

Trying to use the actual 'day of the week' to show api data in react native

This is my first post here at StackOverflow.
I've tried to search the internet for a while now, but probably because i don't now what to search exactly I can't find the answer online.
I have done a react-native beginners tutorial on how to make an api call and list the results in a flatlist. Everything is working fine, but when I try to add another field that show's the opening hours of that particular day it only works when I hardcode it like this:
<Text style={styles.hours}
numberOfLines={1}>{item.day5}</Text>
This correctly shows the opening hours of Friday, provided by the api. What I would likt though, is to show the opening hours of the actual day of today.
I already managed to calculate the day number and show it in the console by:
let date = new Date();
let dow = date.getDay();
console.log( 'The day is ', dow );
This returns the correct day number. I'm sure it is probably something really simple but I still can't figure out how to use this day number to actually show the current day's opening hours.
Anyone here who can help me out?
Regards, Jelle

Google Sheets Price Tracker for Amazon not functioning properly

Hi so i'm using a slightly edited version of a price tracker made by someone else. The purpose of this tracker is to track the price of certain items on Amazon and then display them without me having to check each price individually.
The problem however, is that the tracker is only returning the price of about 20 different items even though I have asked it to track more.
If anyone can take a look at the code and tell me what is causing it to "give up" after it has displayed about 20 items that would be amazing, I have had a look myself but i'm fairly new in the world of coding and I really don't know what the problem is.
If you can tell me how to fix the problem too that would be really helpful.
Main Script:
http://pastebin.com/4zfiZjnU
Table Script:
http://pastebin.com/sWSCM8w4
Row Script:
com/nWLzRNV5
Try changing function function trackPrices(). The line 'data = sheet.getRange(2, 2, 21, 3).getValues();' is only getting 20 rows (it skips the header row. Try changing 21 to your number of rows you have +1 and see if that works.

Httparchive - BigQuery how to get median bytesTotal per year from 2010-2014

I am currently writing my bachelor theses about web performance and refer to some statistic on httparchive. As I would like to have a nice graph from 2010 to 2014 about bytesTotal, bytesCss and so on I tried to get the data out of BigQuery. The queries do work, but I am getting some results which do not fit to the graphics over at httparchive.org
My goal is to have one value for bytesTotal 2010, one for 2011, one for 2012 and so on.
So I tried it with something like this:
SELECT NTH(50, quantiles(bytesTotal,101)) TOTAL_med, NTH(50, quantiles(bytesHtmlDoc,101))
HTMLDOC_med FROM [httparchive:runs.2010_11_15_pages], [httparchive:runs.2010_11_29_pages],
[httparchive:runs.2010_12_16_pages], [httparchive:runs.2010_12_28_pages];
SELECT AVG(bytesTotal) TOTAL_med, AVG(bytesHtmlDoc) HTMLDOC_med FROM [httparchive:runs.2010_11_15_pages],
[httparchive:runs.2010_11_29_pages], [httparchive:runs.2010_12_16_pages],
[httparchive:runs.2010_12_28_pages];
So medians would be nice, but if they do not work average is fine.
May somebody help me?
I have tried it.
Hope you find it useful.
SELECT NTH(50, quantiles(bytesTotal)) MedianBytesTotal
FROM [httparchive:runs.2010_12_28_pages], [httparchive:runs.2012_12_15_pages],
[httparchive:runs.2013_12_15_pages], [httparchive:runs.2014_12_15_pages];
I got the result as:- MedianBytesTotal -- 1074357

How to unserialize postmeta and use it in wp_query for search filter

I have been trying to figure this out for 2 weeks with no success so hopefully someone here can shed some light on this issue. I have 2 types of serialized data that allow my theme to manage the locations of a post.
The first one is for managing all the locations:
{"0":{"id":"3526","label":"Alabama","address":"","latitude":"31.964736","longitude":"-86.682571","zoom":"6","radius":""},"1":{"id":"1929","label":"Alaska","address":"","latitude":"60.945599","longitude":"-152.613790","zoom":"5","radius":""},"2":{"id":"1975","label":"Arizona","address":"","latitude":"34.048928","longitude":"-111.093731","zoom":"6","radius":""},"3":{"id":"4960","label":"Arkansas","address":"","latitude":"35.201050","longitude":"-91.831833","zoom":"7","radius":""},"4":{"id":"3584","label":"California","address":"","latitude":"35.857658","longitude":"-120.384729","zoom":"6","radius":""},"5":{"id":"2432","label":"Colorado","address":"","latitude":"39.116675","longitude":"-105.408532","zoom":"7","radius":""},"6":{"id":"1031","label":"Connecticut","address":"","latitude":"41.615542","longitude":"-72.730693","zoom":"8","radius":""},"7":{"id":"4622","label":"Delaware","address":"","latitude":"38.910832","longitude":"-75.527670","zoom":"9","radius":""},"8":{"id":"2595","label":"Florida","address":"Florida, USA","latitude":"28.538335","longitude":"-81.379236","zoom":"9","radius":""},"9":{"id":"4117","label":"Georgia","address":"","latitude":"32.157435","longitude":"-82.907123","zoom":"7","radius":""},"10":{"id":"2974","label":"Hawaii","address":"","latitude":"19.948410","longitude":"-155.851947","zoom":"8","radius":""},"11":{"id":"1330","label":"Idaho","address":"","latitude":"44.068202","longitude":"-114.742041","zoom":"6","radius":""},"12":{"id":"2786","label":"Illinois","address":"","latitude":"40.633125","longitude":"-89.398528","zoom":"7","radius":""},"13":{"id":"325","label":"Indiana","address":"","latitude":"40.267194","longitude":"-86.134902","zoom":"7","radius":""},"14":{"id":"3255","label":"Iowa","address":"","latitude":"41.878003","longitude":"-93.097702","zoom":"7","radius":""},"15":{"id":"2805","label":"Kansas","address":"","latitude":"38.506455","longitude":"-98.176629","zoom":"7","radius":""},"16":{"id":"3591","label":"Kentucky","address":"","latitude":"37.839333","longitude":"-84.270018","zoom":"7","radius":""},"17":{"id":"4766","label":"Louisiana","address":"","latitude":"30.849501","longitude":"-92.156011","zoom":"7","radius":""},"18":{"id":"936","label":"Maine","address":"","latitude":"44.857978","longitude":"-69.426243","zoom":"7","radius":""},"19":{"id":"69","label":"Maryland","address":"","latitude":"38.917652","longitude":"-76.602819","zoom":"8","radius":""},"20":{"id":"1529","label":"Massachusetts","address":"","latitude":"42.407211","longitude":"-71.382437","zoom":"7","radius":""},"21":{"id":"3802","label":"Michigan","address":"","latitude":"44.314844","longitude":"-85.602364","zoom":"7","radius":""},"22":{"id":"1419","label":"Minnesota","address":"","latitude":"46.729553","longitude":"-94.685900","zoom":"7","radius":""},"23":{"id":"1281","label":"Mississippi","address":"","latitude":"32.039738","longitude":"-89.384795","zoom":"7","radius":""},"24":{"id":"4792","label":"Missouri","address":"","latitude":"37.964253","longitude":"-91.831833","zoom":"6","radius":""},"25":{"id":"1290","label":"Montana","address":"","latitude":"46.879682","longitude":"-110.362566","zoom":"6","radius":""},"26":{"id":"4643","label":"Nebraska","address":"","latitude":"41.492537","longitude":"-99.901813","zoom":"7","radius":""},"27":{"id":"1398","label":"Nevada","address":"","latitude":"38.802610","longitude":"-116.419389","zoom":"6","radius":""},"28":{"id":"3875","label":"New Hampshire","address":"","latitude":"43.433663","longitude":"-71.517464","zoom":"8","radius":""},"29":{"id":"3311","label":"New Jersey","address":"","latitude":"39.868863","longitude":"-74.526511","zoom":"8","radius":""},"30":{"id":"3466","label":"New Mexico","address":"","latitude":"34.519940","longitude":"-105.870090","zoom":"7","radius":""},"31":{"id":"2581","label":"New York","address":"","latitude":"41.129416","longitude":"-74.368522","zoom":"6","radius":""},"32":{"id":"2178","label":"North Carolina","address":"","latitude":"35.759573","longitude":"-79.019300","zoom":"6","radius":""},"33":{"id":"2347","label":"North Dakota","address":"","latitude":"47.551493","longitude":"-101.002012","zoom":"7","radius":""},"34":{"id":"1161","label":"Ohio","address":"","latitude":"40.417287","longitude":"-82.907123","zoom":"7","radius":""},"35":{"id":"826","label":"Oklahoma","address":"","latitude":"35.467560","longitude":"-97.516428","zoom":"7","radius":""},"36":{"id":"2304","label":"Oregon","address":"","latitude":"43.772409","longitude":"-121.180422","zoom":"7","radius":""},"37":{"id":"1768","label":"Pennsylvania","address":"","latitude":"41.203322","longitude":"-77.194525","zoom":"7","radius":""},"38":{"id":"4668","label":"Rhode Island","address":"","latitude":"41.580095","longitude":"-71.477429","zoom":"10","radius":""},"39":{"id":"4585","label":"South Carolina","address":"","latitude":"33.836081","longitude":"-81.163725","zoom":"7","radius":""},"40":{"id":"3107","label":"South Dakota","address":"","latitude":"43.969515","longitude":"-99.901813","zoom":"7","radius":""},"41":{"id":"1105","label":"Tennessee","address":"","latitude":"35.517491","longitude":"-86.580447","zoom":"7","radius":""},"42":{"id":"597","label":"Texas","address":"","latitude":"31.219974","longitude":"-99.286579","zoom":"5","radius":""},"43":{"id":"2445","label":"Utah","address":"","latitude":"39.320980","longitude":"-111.093731","zoom":"7","radius":""},"44":{"id":"3887","label":"Vermont","address":"","latitude":"44.307765","longitude":"-72.577841","zoom":"7","radius":""},"45":{"id":"3123","label":"Virginia","address":"","latitude":"37.431573","longitude":"-78.656894","zoom":"7","radius":""},"46":{"id":"1538","label":"Washington","address":"","latitude":"47.583155","longitude":"-120.970790","zoom":"7","radius":""},"47":{"id":"1455","label":"West Virginia","address":"","latitude":"38.597626","longitude":"-80.454903","zoom":"6","radius":""},"48":{"id":"3848","label":"Wisconsin","address":"","latitude":"43.784440","longitude":"-88.787868","zoom":"7","radius":""},"49":{"id":"1074","label":"Wyoming","address":"","latitude":"43.075968","longitude":"-107.290284","zoom":"7","radius":""},"50":{"id":"1000","label":"---------------------","address":"","latitude":"","longitude":"","zoom":"","radius":""},"51":{"id":"358","label":"Bahamas","address":"","latitude":"25.617568","longitude":"-77.862549","zoom":"8","radius":""},"52":{"id":"1407","label":"Bermuda","address":"","latitude":"32.307800","longitude":"-64.750500","zoom":"11","radius":""},"53":{"id":"2559","label":"Puerto Rico","address":"","latitude":"18.220833","longitude":"-66.590149","zoom":"9","radius":""},"54":{"id":"1302","label":"British Virgin Islands","address":"","latitude":"18.346193","longitude":"-64.746646","zoom":"11","radius":""},"55":{"id":"3952","label":"---------------------","address":"","latitude":"","longitude":"","zoom":"","radius":""},"56":{"id":"1093","label":"Australia","address":"","latitude":"","longitude":"","zoom":"","radius":""},"57":{"id":"4731","label":"Canada","address":"","latitude":"","longitude":"","zoom":"","radius":""},"58":{"id":"1467","label":"France","address":"","latitude":"","longitude":"","zoom":"","radius":""},"59":{"id":"2603","label":"Greece","address":"","latitude":"","longitude":"","zoom":"","radius":""},"60":{"id":"382","label":"India","address":"","latitude":"","longitude":"","zoom":"","radius":""},"61":{"id":"1173","label":"Italy","address":"","latitude":"","longitude":"","zoom":"","radius":""},"62":{"id":"2309","label":"Netherlands","address":"","latitude":"","longitude":"","zoom":"","radius":""},"63":{"id":"3154","label":"Spain","address":"","latitude":"","longitude":"","zoom":"","radius":""},"64":{"id":"4201","label":"United Kingdom","address":"","latitude":"","longitude":"","zoom":"","radius":""},"65":{"id":"1431","label":"Other","address":"","latitude":"","longitude":"","zoom":"","radius":""}}
The second one is attached to each post in postmeta which calls it location:
a:1:{i:0;s:4:"2178";}
So for example this would call the North Carolina.
The problem is that I am trying to create a simple search with each location being a filter options but have no idea where to start. I know how to query the database but not for serialized data like this. Especially having something like a:1:{i:0;s:4:"2178";} reference the first data and spitting out a location, unserialized.
Any help or direct is GREATLY appreciated.
Thanks
Try PHP's unseriliaze function.
unserialize($value);

google json api search results limit, not 100 search queries per day

The Google Custom Search API requires the use of an API key, I have get from the Google APIs console. The API provides 100 search queries per day for free. I want to more,so I have signed up for billing in the console and succeed.I can set the requests/day,defalut 1000 requests/day.But the total results are still 100,I show 10 in one page,so I can get 10 pages.
Billing solve the querys per day,but not the total results.The document does not explain clearly.What should i do to solve the results problem.Does XML API have the same problem? Must I Replace the JSON API by XML API?
another year passed... Limits are the same =((
Google forces us to use multiple accounts to get complete search results.
Use a query per day/week/month.
Or you can sort huge result array by publish date. And when '100-items' limit is reached you should execute new request with excluding first items by applying "the lowest(or the highest) possible value" condition on publish date.
btw, using webbrowser you could set 100 results per page. So total count of result items is 1000 per query. Web crawling would be helpful=))))
be happy!