Yahoo! Finance stock feed moving averages - yahoo-api

I would like to get averages values from Yahoo!'s stock feed.
In my example, I used:
http://finance.yahoo.com/d/quotes.csv?s=ANZ.AX&f=spm3m4
As of writing, the m3 (50SMA) is 20.8167, and m4 (200SMA) is 20.7455. This does not seem to match the chart in any timeframe (1D to 5Y).
Why am I getting wrong figures?

First a big caveat: These Yahoo Finance CSV feeds are not an official API and you would probably not want to build a real app using them.
If you want to figure out the data sources used by Yahoo Finance you can watch the dynamic HTTP calls as you make changes to the chart. Using Firebug, I watched as I added the 50 & 200 day moving averages to the chart and found these files being fetched:
http://chartapi.finance.yahoo.com/instrument/1.0/goog/chartdata;type=sma;ys=2010;yz=2;ts=1234567890/csv?period=50
http://chartapi.finance.yahoo.com/instrument/1.0/goog/chartdata;type=sma;ys=2010;yz=2;ts=1234567890/csv?period=200
The files have the moving averages for each day (or x-axis point) on the chart.

Related

Group by field and bin for CloudWatch Logs Insights line chart

I want to create a line chart with two lines in AWS CloudWatch Logs Insights. One line representing mobile users and the other desktop users, showing a success rate for each group of users.
This this is the code I am working with:
| fields
properties.device as device,
properties.success as success
| stats avg(success) by device, bin(1hour)
The results of this query look promising. As you can see, the results include the device type, a timestamp, and the floating-point number to be plotted on the line chart:
# device bin(1hour) avg(success)
1 desktop 2023-02-01T10:00:00.000 0.6129
2 mobile 2023-02-01T10:00:00.000 0.7453
3 desktop 2023-02-01T09:00:00.000 0.5578
4 mobile 2023-02-01T09:00:00.000 0.6082
However, the Visualization tab shows me this error:
The data is not suitable for a line chart.
Try a bar chart, or group your result by bin function.
I think Logs Insights is getting confused by my overlapping timestamps. It does not know that I intend one time series of mobile data and another of desktop data. To group by a field and bin by time, I seem to be doing the standard thing using a single by operation with two arguments. But it's not good enough to create a line chart.
Is there a better way to structure my query to convince CloudWatch of what I am trying to do?

Stock split information from Alphavantage API

I'm trying to build a simple portfolio tracker application using Alphavantage API. In order to achieve this, I need to know what stock splits have occurred so I can adjust how many shares the user owns. Does Alphavantage give me a way to see data on stock splits (when the split occurred, and the ratio - 2 way , 4 way, etc?).

Google Analytics API: tiny differences in results between GA API and Google Analytics UI

I'm querying GA Report API v4 to get some metrics for AdWords Keywords.
As dimension I use:
ga:keyword
As metrics I use:
ga:adClicks,
ga:adCost,
ga:CPC,
ga:sessions,
ga:bounceRate,
ga:pageviewsPerSession,
ga:goalConversionRateAll,
ga:transactions,
ga:transactionRevenue
When I compare results pulled from API with results that I'm getting by Google Analytics UI, I found out that certain metrics in some Keywords has tiny differences.
Also when I tried GA API v3 I had same result.
What is the reason?
Why some returned metrics for Keywords are fully identical to results in UI, but certain not?
I tried various date ranges: 1 day, week, month but in all cases I got some tiny differences in some metrics of certain Keywords.
Here is screenshot with example of differences in metrics how it looks like:
In red color means the difference, green color - means that values are identical
Problem: The reason for the discrepancy is that you are calling two different reports.
Report 1) UI Report.
As you have seen, this report is made up of two parts the first being Clicks, Cost, and CPC which are from the Google AdWords API, and the other metrics (sessions, bounce, etc.) which is from Google Analytics.
Because you are going into AdWords > Keywords, you are actually setting a filter to select only AdWords traffic.
Report 2) Custom Report.
This report is pulling the keywords dimension without any filters. This means that the report will also have data for organic keywords, and any UTM_term parameters set.
Because sessions from organic keywords have no AdWords data, the first three columns will be the same, however the Google Analytics specific columns will show variation in the metrics.
Solution:
To get your reports the same, you need to add a filter to your API request, such as ga:adwordsCustomerID or ga:source=google & ga:medium=cpc.

Nestl Historical data are missing in yahoo finance

I am looking for historical data of different companies. I am using Yahoo Finance to acquire data and plot them in candlestick chart using matlab software. However i have noticed that yahoo finance only provides some data. For example data from 2014-03-03 - we have every day's worth of data (2014-03-03, 2014-03-04, 2014-03-05, 2014-03-06, 2014-03-07). After 2014-03-07 it jumps to 2014-03-10 what about 2014-03-08 and 2014-03-09?
This is my sql query of Nestl:
http://ichart.yahoo.com/table.csv?s=NSRGY&a=0&b=1&c=2008&d=0&e=31&n=2014&g=d&ignore=.csv
There is no trading on Saturdays and Sundays (i.e. 2014-03-08 and 2014-03-09)

What is the source for historical stock chart prices?

Yahoo does not seem to be using historical close prices nor are they using historical Adjusted close prices for their charts. For example, if you look at PCG on July 3, 1980, the data looks like this (close of 5.34):
Date,Open,High,Low,Close,Volume,Adj Close
1980-07-03,5.34,5.34,5.31,5.34,99200,0.04
However, on the interactive chart, Yahoo shows this price on July 3, 1980:
2.6695
On Google's chart, it shows 12.188 for that date. It is also missing some dates.
What is going on? I am beginning to doubt the integrity of stock charts.
Does anyone know what source data Yahoo (or Google) uses for their stock charts?
I recommend http://eoddata.com, very good source of data.