Tuesday, December 25, 2007

My Obsolete Scraper

Great just as I completed writing my scraper google finance now covers ASX listed stocks.

You can do lookups for stock prices in google docs spreadsheets using the "GoogleFinance(Symbol, attribute)" function.

Just enter in the asx code as the symbol along with the attribute your interested in.

Attributes included are:

price: market price of the stock - delayed by up to 20 minutes.
priceopen: the opening price of the stock for the current day.
high: the highest price the stock traded for the current day.
low: the lowest price the stock traded for the current day.
volume: number of shares traded of this stock for the current day.
marketcap: the market cap of the stock.
tradetime: the last time the stock traded.
datadelay: the delay in the data presented for this stock using the googleFinance() function.
volumeavg: the average volume for this stock.
pe: the Price-to-Earnings ratio for this stock.
eps: the earnings-per-share for this stock.
high52: the 52-week high for this stock.
low52: the 52-week low for this stock.
change: the change in the price of this stock since yesterday's market close.
beta: the beta value of this stock.
changepct: the percentage change in the price of this stock since yesterday's close.
closeyest: yesterday's closing price of this stock.
shares: the number of shares outstanding of this stock.
currency: the currency in which this stock is traded.

At first they didn't cover ASX listings, I thought our guys were being jerky hording all their precious data.

Tuesday, December 18, 2007

Can not update a read-only feed

The following C# code will allow you to add a blog entry in blogger:

string blogId = "9999999999999999999"; //your blogger id
Cursor.Current = Cursors.WaitCursor;
Service service = new Service("blogger", "BloggerApp");
// Set your credentials:
service.setUserCredentials("email@gmail.com", "password");

string token = service.QueryAuthenticationToken();
service.SetAuthenticationToken(token);

AtomEntry newPost = new AtomEntry();
newPost.Title.Text = "Test Publish!";
newPost.Content = new AtomContent();
newPost.Content.Content = "
" +
"

Automated test publish.

" +
"
";
newPost.Content.Type = "xhtml";
newPost.Authors.Add(new AtomPerson());
newPost.Authors[0].Name = "you name here";
newPost.Authors[0].Email = "email@gmail.com";
newPost.Service = service;

FeedQuery query = new FeedQuery();
// Create the query object:
query.Uri = new Uri("http://www.blogger.com/feeds/" + blogId + "/posts/default");

// Tell the service to query:
AtomFeed bloggerFeed = service.Query(query);
AtomEntry createdEntry = service.Insert(bloggerFeed, newPost);
Cursor.Current = Cursors.Default;