Google Stocks API - api

I'm developing a bot, and I want to use the Google's Stock's API shown here:
http://jarloo.com/tutorials/google-stock-api/
The only problem is, It was a feature request from someone else and I don't know a lot about stocks. I see that it is 'undocumented', but does anything have an links to information that I can get what each of the tags from the return is? A Sample return for yahoo is below.
<xml_api_reply version="1">
<finance module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<symbol data="YHOO"/>
<pretty_symbol data="YHOO"/>
<symbol_lookup_url data="/finance?client=ig&q=YHOO"/>
<company data="Yahoo! Inc."/>
<exchange data="Nasdaq"/>
<exchange_timezone data="ET"/>
<exchange_utc_offset data="+05:00"/>
<exchange_closing data="960"/>
<divisor data="2"/>
<currency data="USD"/>
<last data="13.59"/>
<high data="13.62"/>
<low data="13.36"/>
<volume data="30493456"/>
<avg_volume data="24328"/>
<market_cap data="17706.97"/>
<open data="13.50"/>
<y_close data="13.48"/>
<change data="+0.11"/>
<perc_change data="0.82"/>
<delay data="0"/>
<trade_timestamp data="6 hours ago"/>
<trade_date_utc data="20110721"/>
<trade_time_utc data="200014"/>
<current_date_utc data="20110722"/>
<current_time_utc data="024141"/>
<symbol_url data="/finance?client=ig&q=YHOO"/>
<chart_url data="/finance/chart?q=NASDAQ:YHOO&tlf=12"/>
<disclaimer_url data="/help/stock_disclaimer.html"/>
<ecn_url data=""/>
<isld_last data="13.60"/>
<isld_trade_date_utc data="20110721"/>
<isld_trade_time_utc data="235853"/>
<brut_last data=""/>
<brut_trade_date_utc data=""/>
<brut_trade_time_utc data=""/>
<daylight_savings data="true"/>
</finance>
</xml_api_reply>
Sorry if this isn't exactly a 'programming' question. Thanks for any help you can provide.

Since Google Finance API is now deprecated, I would suggest you to use the Yahoo! Finance API instead:
http://finance.yahoo.com/d/quotes.csv?s=STOCK_SYMBOLS separated by “+” &f= special_tags
Here is a list of the special tags you may find useful:
http://www.gummy-stuff.org/Yahoo-data.htm

Related

DAX / Xetra on alphavantage

I am very very happy with Alphavantage.
BUT I can't find the german stocks (Xetra)
I have tried:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=xtr:lin&apikey=MYKEY
(But this works https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=NYSE:DIN&apikey=MYKEY)
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=Lin.be&apikey=MYKEY
(But this works: https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=Novo-b.CO&apikey=MYKEY)
So my question is - has anyone had any luck getting german stocks on Alphavanta (or another free service. Realtime is not crucial, but obviously a plus).
I use the "Search Endpoint" function to find german stocks on alphavantage.
Let's say you look for "BASF" you could query:
https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=BASF&apikey=[your API key]&datatype=csv
You get a list with possible matches:
symbol,name,type,region,marketOpen,marketClose,timezone,currency,matchScore
BASFY,BASF SE,Equity,United States,09:30,16:00,UTC-05,USD,0.8889
BFFAF,BASF SE,Equity,United States,09:30,16:00,UTC-05,USD,0.8889
BASFX,BMO Short Tax-Free Fund Class A,Mutual Fund,United States,09:30,16:00,UTC- 05,USD,0.8889
BAS.DEX,BASF SE,Equity,XETRA,08:00,20:00,UTC+02,EUR,0.7273
BAS.FRK,BASF SE,Equity,Frankfurt,08:00,20:00,UTC+02,EUR,0.7273
BASA.DEX,BASF SE,Equity,XETRA,08:00,20:00,UTC+02,EUR,0.7273
BAS.BER,BASF SE NA O.N.,Equity,Berlin,08:00,20:00,UTC+02,EUR,0.7273
BASF.NSE,BASF India Limited,Equity,India/NSE,09:15,15:30,UTC+5.5,INR,0.6000
See documentation: https://www.alphavantage.co/documentation/
It seems to work with the yahoo symbols on alphavantage, at least for a few stocks (I did not check all). BASF for example works with:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=BASF.TI&apikey=MYKEY
The alphavantage symbols for German securities consist of the Xetra symbol + .DE. For example EUNL.DE (for iShares MSCI World Core ETF). You can find a list of all Xetra stocks here.

Correct xml data type for Payroll hours

I'm trying to integrate the Payroll API (USA) but running into challenges posting a Timesheet.
I'm using a JSON to xml parser which is giving me an output like this:
<?xml version="1.0"?>
<Timesheet>
<EmployeeID>9e246df3-8775-43ee-bc7e-47f5f5896964</EmployeeID>
<EndDate>2017-10-16T00:00:00Z</EndDate>
<Hours>43.2000</Hours>
<StartDate>2017-10-10T00:00:00Z</StartDate>
<Status>Draft</Status>
</Timesheet>
I have no experience with xml APIs but that looks the same as the example code provided. However on the API end the hours I get returned are 0:
"Status":"DRAFT","Hours":0,
etc...
The Timesheet on the user console end also has 0 hours.
Is there something else I need to be considering here?
Thanks
Answer:
I had misinterpreted the API, the "Hours" for a period is the hours calculated by Xero, based on the quantity of pay items provided.
Hopefully this clarifies in case anyone else has same confusion.

Yahoo Weather API 3 days Forecast with humidity value

I am building a web app, which uses Yahoo Weather API to provide weather information, based on a ZIP code, provided by the users.
I know that in order to obtain this data for certain number of days I have to add it as a parameter in my request, like so:
http://weather.yahooapis.com/forecastrss?p=33035&u=c&d=3
Which gives this result:
<channel>
....
<yweather:location city="Homestead" region="FL" country="US"/>
<yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/>
<yweather:wind chill="19" direction="90" speed="11.27"/>
<yweather:atmosphere humidity="78" visibility="16.09" pressure="1021" rising="1"/>
<yweather:astronomy sunrise="7:12 am" sunset="7:36 pm"/>
...
<item>
...
<yweather:forecast day="Wed" date="2 Apr 2014" low="19" high="28" text="Mostly Sunny" code="34"/>
<yweather:forecast day="Thu" date="3 Apr 2014" low="21" high="29" text="Partly Cloudy" code="30"/>
<yweather:forecast day="Fri" date="4 Apr 2014" low="20" high="28" text="Partly Cloudy" code="30"/>
<guid isPermaLink="false">USFL0208_2014_04_04_7_00_EDT</guid>
</item>
</channel>
However I need to be able to get the humidity level for EVERY day in the forecast and not just the current one. I've tried to find solution here and also read the Yahoo API documentation, but it's really a short one.
I've also tried http://www.myweather2.com/ and http://developer.worldweatheronline.com/, but they have the same issue with humidity - it's shown only for the current day and stripped from the whole forecast.
I'll keep trying with other free Weather APIs, but if you can help here I'd be very grateful.
I've spent some time researching for better APIs than the Yahoo! Weather API and I found something, that works for me, so I've decided to share the info, in case anyone else bump into this some day.
Version 2 of the Forecast API looks like a nice solution, because it provides detailed information, more specifically the humidity index for each day in the forecast, which was what I was looking for in the first place.
There are also number of libraries for this API (languages include PHP, Node.js, Python, Perl and others).
It works with longitude & latitude as in this example
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE,TIME
and of course one needs to register for an API key.
The TIME parameter is optional, the temperature uses Fahrenheit metrics by default, but this can be changed with additional ?units=ca parameter.
One disadvantage is that you get only a 1,000 free calls per day, which probably won't be suitable for big applications.
If you know a better answer to the original question, I'll be very happy to hear it. Until then I'll use this solution, without going into much details:
// The default result from a Forecast API call is in JSON,
// so decode it to an object for easier access
$fcObj = json_decode($jsonResult);
if(!empty($fcObj->daily->data[0]->humidity)) {
// get humidity value in %
$humidty = $fcObj->daily->data[0]->humidity * 100;
}

Programmatically detect whether Amazon buyer has left a review?

Is it possible to programmatically detect whether an Amazon buyer has left a review on a product? I've been digging through the Product Advertising API to no avail.
you can use retrieving customer reviews portion of the api here:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/EX_RetrievingCustomerReviews.html
Here is an example of the request:
http://webservices.amazon.com/onca/xml?
Service=AWSECommerceService
&Operation=ItemLookup
&ResponseGroup=Reviews
&IdType=ASIN
&ItemId=B004HFS6Z0
&AssociateTag=[Your_Associate_Tag]
&AWSAccessKeyId=[Your_AWSAccessKeyId]
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request_Signature]
and response:
<Item>
<ASIN>B004HFS6Z0</ASIN>
<CustomerReviews>
<IFrameURL>
http://www.amazon.com/reviews/iframe?
akid=[Your_AWSAccessKeyId]
&alinkCode=xm2
&asin=B004HFS6Z0
&atag=[Your_AssociateTag]
&exp=2011-06-01T22%3A32%3A53Z
&v=2
&sig=pxn6bbln%2B%2FVTPJdj8oCcXvjTHmo3spkUMjbQMPbhCKI%3D
</IFrameURL>
<HasReviews>true</HasReviews>
</CustomerReviews>
</Item>
you could then sort the responses if needed.

How can I search for albums with generic titles using the Spotify Web API?

It is possible to search by name for an album in the Spotify catalog using the Spotify Web API.
However, if the album name is a common word or phrase, the search response may contain thousands of results. I can't see a way to narrow the search by artist name.
Here is an example: searching for album Country by artist Giant Panda Guerilla Dub Squad.
The API request is:
http://ws.spotify.com/search/1/album?q=country
The response is:
<?xml version="1.0" encoding="UTF-8"?>
<albums xmlns="http://www.spotify.com/ns/music/1" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<opensearch:Query role="request" startPage="1" searchTerms="country" />
<opensearch:totalResults>11861</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>100</opensearch:itemsPerPage>
<album href="spotify:album:1Wcnyz2zYWLIPZ1K63RXdW">
<name>How Country Feels</name>
<artist href="spotify:artist:56x8mYvS3cyDGAi8N2FxbB">
<name>Randy Houser</name>
</artist>
<id type="upc">886443789852</id>
<popularity>0.73964</popularity>
<availability>
<territories>CA US</territories>
</availability>
</album>
...more albums...
</albums>
There are 11861 results, and the results are paged, with 100 albums per page. A request can be made to get the next page, but if the album I'm looking for is on the last page I will have to make 118 separate requests to the API before I find it.
Is there a better way?
You can use the advanced search query language to help, especially if you know the artist in advance. For example:
http://ws.spotify.com/search/1/album?q=artist:Giant Panda Guerilla Dub Squad
...will limit the search to albums by that artist.
http://ws.spotify.com/search/1/album?q=artist:Giant Panda Guerilla Dub Squad Country
...will return only the album you want.
The full advanced search reference is currently unavailable in the chaos that was the new Spotify redesign, but you can find it in the Wayback machine here.