Easy API Interface

Posted by pipe42 
Easy API Interface
February 19, 2010 01:30PM
To celebrate all the new stocks, I have whipped up a simple webpage where traders can pull advanced stock information from the API.

Check it out: http://api.howison.co.nz

Features:
  • Get stock information, current prices, the full order book, and stock history for any of the live stocks
  • Compare this info for 2 or more stocks side-by-side
  • There is a link straight to the advanced trading page for each stock
  • Copy-and-paste history and order book information straight into Excel.

"New" Stock Information (not visible on the current iPredict pages):
  • "Stocks in the Wild" (how many of each stock is held by traders)
  • How many traders are currently holding each stock
  • Average number of each stock held by traders
  • A mystery number 'Shares Outstanding' winking smiley

History shows the volume and value of trades for the last:
  • 24 hours (yes, 'todays volume' actually works! smiling bouncing smiley)
  • 1 week
  • 1 month
  • 1 year

Recently added (22 Feb):
  • Graphs showing all stocks in the bundles on one graph
  • Easily graph the price of any stock over any time period
  • Easily graph the price of multiple stocks over any time period

Coming soon:
  • History and information for closed stocks


    Let me know what you think and new features you would like to see (also bug reports) - there's an email for feedback on the site.

    Note: This site is totally unofficial and not endorsed by iPredict. I made it myself and any errors or problems should be blamed on me!

    Edit: typos
    Edit 2: note that Shares Outstanding is a mystery variable, describe new graph functions



    Edited 3 time(s). Last edit at 02/22/2010 12:11AM by pipe42.
Re: Easy API Interface
February 19, 2010 02:15PM
Excellent! Can't see how to get the "stocks in the wild" bit, but neat stuff!
Re: Easy API Interface
February 19, 2010 02:20PM
Thanks. cool smiley

Quote
ECrampton
Can't see how to get the "stocks in the wild" bit

The "Stocks In the Wild" stuff is under Stock Information (magnifying glass).
Re: Easy API Interface
February 19, 2010 02:34PM
thumbs up

Nice work...
Re: Easy API Interface
February 19, 2010 03:21PM
Nice pipe.

What does "stocks in the wild" mean. I notice for some this is less than the number stocks I own. Is this just slow updating or am I misunderstanding the definition?
Re: Easy API Interface
February 19, 2010 03:34PM
Thanks guys.

Quote
hidn
What does "stocks in the wild" mean. I notice for some this is less than the number stocks I own

It refers to the "sharesOutstanding" section of the API stock details:

<sharesOutstanding>45.0050</sharesOutstanding>

I think I may have misunderstood exactly what this means. My description is based on this forum post where bkd and iTeam discuss it briefly.

admin or iTeam, could you clarify this?
Re: Easy API Interface
February 19, 2010 05:21PM
All hail the pipe. You have every right to feel flushed with success.smileys with beer

Seriously though, I think that's great.
Re: Easy API Interface
February 19, 2010 11:26PM
Thanks ORACLE. Finishing up the coding left me feeling pretty drained, I can tell you. smileys with beer
Re: Easy API Interface
February 20, 2010 01:24PM
This is awesome -- exactly some of the information that I've been looking for. Thanks for creatinging such a FANTASTIC resource.
Re: Easy API Interface
February 21, 2010 02:05AM
Thanks RadiataPine. cool smiley

The bundle graphs page is now up (allows you to view a nice big graph of each of the stocks in a bundle over time).

Time for a beer. drinking smiley
Re: Easy API Interface
February 28, 2010 07:01PM
Update: There is a new Closed Stocks page where you can examine the history and stock information for closed stocks.

api.howison.co.nz/closed.php (this may take a while to open, due to collecting closed stocks)

Useful info: When the stock opened, closed, what price it closed at, judging statement, etc.

Current Limitations: The Trade History and Stock Graph information only goes back up to one year at this point (so the 2008 election stock histories don't show up).

Bonus: Stock info on open stocks now shows Likelihood (just the curent ask and bid prices expressed as a percentage).



Edited 1 time(s). Last edit at 02/28/2010 07:04PM by pipe42.
Re: Easy API Interface
March 01, 2010 12:51PM
I have updated the API interface to incorporate the recent iPredict changes.

The new system seems to be a lot faster at returning API information, which is great.

Known issues:

  • history of 1 year, 1 month and 1 week are now broken; I'll need a day or two to rewrite the code which collects this data
  • Most information about closed stocks is now gone (which kinda sucks since I just wrote the closed stocks page). sad smiley

Admin note: the removal of support for tradeHist is not noted in action=apiDoc.

Please let me know if you find any other issues.

Edit: typos.



Edited 2 time(s). Last edit at 03/01/2010 12:55PM by pipe42.
Re: Easy API Interface
March 01, 2010 08:58PM
Hi pipe,

This is all great stuff, and don't despair about the functionality of the api. We've been pretty busy with a whole bunch of things recently (as I am sure you are aware) however we will get on with improving the api very soon. We should be able to make more and more available via the API now that we have got the rest of the site working.

Time to revive the ipredict google developers group I think!
Re: Easy API Interface
March 03, 2010 03:31PM
Update: as far as I can tell, the API has stopped reporting the whole order book, it now only reports the top 10 buy and sell orders as per the trading pages.
Re: Easy API Interface
March 03, 2010 03:48PM
pipe42 Wrote:
-------------------------------------------------------
> Update: as far as I can tell, the API has stopped
> reporting the whole order book, it now only
> reports the top 10 buy and sell orders as per the
> trading pages.


Just FYI:

mrh reported the same thing under the bug list on the announcement.

Alan.
Re: Easy API Interface
March 03, 2010 04:09PM
Yes, it was actually after reading his comment that I checked that the API had changed and it wasn't just my code that was failing to work properly.

I just wanted to put an update on this thread so people interested in my API interface can be aware of the impact of the recent changes.
Re: Easy API Interface
March 03, 2010 04:15PM
pipe42 Wrote:
-------------------------------------------------------
> Yes, it was actually after reading his comment
> that I checked that the API had changed and it
> wasn't just my code that was failing to work
> properly.
>
> I just wanted to put an update on this thread so
> people interested in my API interface can be aware
> of the impact of the recent changes.


Cool - just so long as you know it isn't you!

Alan.

PS: I'm loving your new report!
Re: Easy API Interface
March 08, 2010 11:34PM
Update:

api.howison.co.nz

  • After a major overhaul, History works again, and you can choose any number of days to display the history over (previously, this was limited to 1 year).
  • History is now available for closed stocks.
  • Note: long periods of history for very heavily traded stocks (like MAYOR.BANKS) may take a long time to load.

Again, don't hesitate to let me know if you see anything that breaks, or anything new that you'd like to see.

I'm currently working on:

  • Rewriting parts of the AJAX so it can handle more than one request at a time.
  • Have History report the number of days, and the date-range, it has returned data for.
  • Working on integrating a new button which links to a controllable, enlarged Trade History chart (the Flash chart which shows the number of stocks traded at what times). This can be used manually with, eg: /796551b68e07040fc8e7c28369526a3e/chart.php?stock=STOCK.HERE
  • Brainstorming the best way to run price-level email alerts (eg, the page will email you if a stock on an alert-list goes over a certain price).

Before anyone requests text-message (SMS) alerts, I can't find anywhere that sends text messages in NZ for free. Sorry!

Edit: Add in Flash trade history chart page



Edited 1 time(s). Last edit at 03/08/2010 11:43PM by pipe42.
Re: Easy API Interface
March 11, 2010 10:50PM
Update: updated the bundles on the Graph Bundles page.

Edit: link page.



Edited 1 time(s). Last edit at 03/11/2010 10:51PM by pipe42.
Re: Easy API Interface
March 14, 2010 12:26AM
pipe42 Wrote:
-------------------------------------------------------
>
> Before anyone requests text-message (SMS) alerts,
> I can't find anywhere that sends text messages in
> NZ for free. Sorry!


Hi Pipe,

You can receive TXT's from a twitter account that you follow for free.

I seem to remember some site that would update a private twitter account you made and followed with your normal account - it was something about traveling overseas.

Peter
Re: Easy API Interface
March 15, 2010 01:23PM
That's an excellent tip, Peter. I'm currently testing the reliability of the Twitter txt system while coding the alert pages. thumbs up
Re: Easy API Interface
April 02, 2010 11:33PM
Update:

New Stock Chart page:
  • If you have ever squinted at the flash stock chart (the one which shows you when trades were, and their volume) and wished it was easier to use, you might want to check this page out. You can generate the flash charts for any stock, customise how many days the chart covers, and make charts as large as you like (tested up to 2000 x 2000 pixels!).
  • You can also grab a URL to bookmark the charts and go directly to them later.

Minor change to the History button:
  • The History table now tells you what date period it is attempting to display, eg, March 15 2010 to April 2 2010.
  • Old functionality just told you how many days in the past it was covering (eg 20 days).

I also updated the bundle dropdown on the Bundle Graphs page to include the April petrol bundle and new RBA April 6 bundle.

As always, please don't hesitate to let me know if you notice anything broken or have suggestions for new functionality.



Edited 1 time(s). Last edit at 04/02/2010 11:37PM by pipe42.
Re: Easy API Interface
April 19, 2010 09:24PM
Minor update: I have updated the bundle dropdown on the Bundle Graphs page.
Re: Easy API Interface
April 21, 2010 02:34PM
Update: There is now a version of the Easy API interface for iPredict Play:

play.api.howison.co.nz
Re: Easy API Interface
May 03, 2010 10:31PM
Minor Update: Updated the bundle graph dropdown to include RBA May 4, etc, and removed old bundles.
Re: Easy API Interface
May 03, 2010 10:37PM
Hi Luke,

I could be wrong, but I think one of the items is reporting wrongly in the 'all stocks' page.

If I go to 91.APR10.VLOW on the IPredict website, it is showing the best sell price as 0.0011.

Your API interface is reporting 0.0012.

This seems to happen when one side (or at least the buy-side) of a board is totally empty.

Apologies if I am mistaken!

Thanks again - you are doing a superb job here, totally fantastic.

Alan.
Re: Easy API Interface
May 03, 2010 11:31PM
Update:

First major update for a while!

The Stock Info, Current Price, Order Book and History information buttons now include a link to the raw API query, as kindly suggested by Admin many moons ago.

With the standard API so easy to access, you can now see how much processing goes into making the data look pretty for you. :-)

I have also cleaned up the Closed Stocks stock information, so it doesn't show "1 Jan 1970" and other useless bits of non-info.

Hopefully I haven't broken anything in the process of this update - please let me know if you run into any problems.
Re: Easy API Interface
May 03, 2010 11:44PM
Hi Alan,

Quote
Alan3285
I think one of the items is reporting wrongly

Yep, I've seen this sort of thing before. As far as I can tell, it is an issue with the API data, not my code (for once! spinning smiley sticking its tongue out ).

Here's a March 30 email which I sent to the team explaining the problem:



Hey guys,

I think this is a known issue, but I thought it was only supposed to happen one time, when the new release went live?

The situation as pictured happened this morning around 8.30 am. It lasted until I purchased 1 on the stock.

What happens: The reported current Buy Price is incorrect and does not match the current top Buy order.
This occurs using the API but I think it is also wrong on the website side.

Expected behaviour: The reported current Buy Price should be identical to the current top Buy order at all times.

Workaround: correct figures were reported once 1 of the stock in question (NAT.APR10.VHIGH) was purchased.

Luke H


Admin responded the same day and said he was passing it on the dev team.
Re: Easy API Interface
May 04, 2010 08:47AM
Hi Luke,

I spent ages checking and re-checking I wasn't missing something, so glad to hear it wasn't me (or you!)

No doubt they are working on it. The lights were probably on all night in the IPredict office - campus security getting suspicious.....

Alan.
Re: Easy API Interface
May 04, 2010 09:21AM
Minor update: Updated the Bundle Graph dropdown with the three new bundles (well done, Admin) added this morning.

Is anyone but me using these? I think they are great.

Check this out, RBA.25 gaining a massive lead ovecr RBA.NC:

Sorry, only registered users may post in this forum.

Click here to login