Easy API Interface

Posted by pipe42 
Re: Easy API Interface
May 04, 2010 10:15AM
Hi Alan, a while ago you asked:

Quote
Alan3285
Is there any way to get the full book of a given stock by direct URL from your website?

I can do it by clicking on the options, but to get it into Excel directly, I'd have to give it a URL.

I was going to write a whole thing to let people do this kind of thing, but there is actually a way you can do this right now. Try URLs with this format:

/796551b68e07040fc8e7c28369526a3e/ajax/order_book_ajax.php?stock_name=STOCK.NAME

Example:

/796551b68e07040fc8e7c28369526a3e/ajax/order_book_ajax.php?stock_name=RBA.25.4MAY10

This should give you a simple table with the order book for that stock.

Similarly you can grab the current prices:

/796551b68e07040fc8e7c28369526a3e/ajax/current_price_ajax.php?stock_name=STOCK.NAME

Example:

/796551b68e07040fc8e7c28369526a3e/ajax/current_price_ajax.php?stock_name=MAYOR.PETERS

Hopefully this is useful - let me know if I can make things work better for you.
Re: Easy API Interface
August 03, 2010 11:41AM
Check out the ALEXANDER.STAND history, in the Easy API, there seems to be a discrepency with what iPredict says. Further note in the active stocks thread for this one.
Re: Easy API Interface
August 03, 2010 12:52PM
I've seen this before with other stocks, I think this seems to be a sorting issue that occurs because big orders (more than one price) have the same time stamp. For example, when the trades are like this:

Quote

10:00:00 Buy 10 $0.40
11:00:00 Buy 10 $0.42
12:00:00 Buy 10 $0.44
13:00:00 Buy 10 $0.46
14:00:00 Sell 10 $0.46
14:00:00 Sell 10 $0.44
14:00:00 Sell 10 $0.42

last trade of $0.42 @ 14:00:00


They might be rearranged like this:

Quote

10:00:00 Buy 10 $0.40
11:00:00 Buy 10 $0.42
12:00:00 Buy 10 $0.44
13:00:00 Buy 10 $0.46
14:00:00 Sell 10 $0.44
14:00:00 Sell 10 $0.42
14:00:00 Sell 10 $0.46

last trade of $0.46 @ 14:00:00
Re: Easy API Interface
August 03, 2010 02:18PM
@hidn has it.
Re: Easy API Interface
August 16, 2010 07:25PM
I've just taken a quick look at the Easy API Interface and made the following improvements:

  • Bundle Graphs page now refreshes the stored list of bundles when it is loaded. This means I don't have to manually update the list of bundles, at the expense of a few more seconds of page loading time.
  • The Order Book now uses Version 2 of the API, so you can see all the book entries for that stock. (Version 1 was limited to ten entries.)

As usual, don't hesitate to let me know if there are any problems or you have any ideas for improvements.

I don't have any plans at this stage to update the rest of the code to use Version 2 of the API, there isn't much extra information available aside from Rankings data.

Rankings can report ROI, Net Worth, and change in net worth for any trader on any day.

If I coded this up, I would probably just place the data in a simple table, with a selectable number of traders and a selectable date. Is that something that would interest anyone?



Edited 3 time(s). Last edit at 08/16/2010 07:27PM by pipe42.
Re: Easy API Interface
August 16, 2010 07:29PM
pipe42 Wrote:
-------------------------------------------------------
> I've just taken a quick look at the Easy API
> Interface and made the following improvements:
>
>
> [*]Bundle Graphs page now refreshes the stored
> list of bundles when it is loaded. This means I
> don't have to manually update the list of bundles,
> at the expense of a few more seconds of page
> loading time.
> [*]The Order Book now uses Version 2 of the API,
> so you can see all the book entries for that
> stock. (Version 1 was limited to ten entries.)
>
>
> As usual, don't hesitate to let me know if there
> are any problems or you have any ideas for
> improvements.
>
> I don't have any plans at this stage to update the
> code to use Version 2 of the API, there isn't much
> extra information available aside from Rankings
> data.
>
> Rankings can report ROI, Net Worth, and change in
> net worth for any trader on any day.
>
> If I coded this up, I would probably just place
> the data in a simple table, with a selectable
> number of traders and a selectable date. Is that
> something that would interest anyone?
>

Only for one trader ;-)

Is it a lot of coding? Its easy for me to eagerly say, "Yes! I'd love to have that option!" but then only use it once in a blue moon (possibly!) and find you spent many long nights working on it.

I'm going to have a play with the order books over the next few days - thanks for that.

Alan.
Re: Easy API Interface
August 17, 2010 12:33AM
Well, it probably wouldn't be that much work to just make the data display in a table - graphing it or collecting all the data over time and storing it in a database or something would be a bunch more work.

I might do it anyway - don't mind mucking around with the code, its fun. :-)
Re: Easy API Interface
August 17, 2010 12:44AM
pipe42 Wrote:
-------------------------------------------------------
> Well, it probably wouldn't be that much work to
> just make the data display in a table - graphing
> it or collecting all the data over time and
> storing it in a database or something would be a
> bunch more work.
>
> I might do it anyway - don't mind mucking around
> with the code, its fun. :-)
>

{Grin}
Re: Easy API Interface
September 11, 2010 12:16AM
The new Rankings page is ready for inspection on the Easy API.

The page gives stats for the list being displayed, so you can, eg, see how much money is deposited with the site - currently, almost a quarter of a million dollars! cool smiley

As you scroll down the list, you can see other things, eg, 700+ people have a positive ROI - not bad.

As always, please don't hesitate to mention problems or suggestions. For instance, I'm sure I've probably messed up calculating the average ROI. Feel free to point this out. smiling bouncing smiley

There is also an API link at the bottom of the page so you can access the actual API results the page is generated from.
Re: Easy API Interface
September 11, 2010 12:23AM
I forgot to mention the major advantages of the Easy API Rankings Page over the iPredict rankings page:

  • You can show ALL of the traders (not just the first 100)
  • You can see the rankings on any date - so you could potentially make a big graph tracking who is making/losing money over time
Re: Easy API Interface
September 11, 2010 12:44AM
Hi Luke,

Superb - as always!

Thanks,

Alan.
Re: Easy API Interface
September 11, 2010 10:59AM
Thanks Alan. smileys with beer
Re: Easy API Interface
September 11, 2010 11:25AM
As per usual, boringly awesome again.thumbs upsmileys with beer
Re: Easy API Interface
February 13, 2011 07:38PM
After a request from maxb, the Easy API now has a .csv download available with the latest prices straight from the API:

CSV stock price download

The CSV file is set up with commas separating cells and carriage returns representing newlines. The first line of the file contains descriptive column headings.

Please let me know if you have any problems with the download etc.
Re: Easy API Interface
February 18, 2011 11:14AM
Thanks, that's really useful.

Would it be possible to get it to provide a file for "close price"?

- Something like have it run at midnight each day and report the price.

It would be so we could use the two to find change today.
Re: Easy API Interface
February 19, 2011 02:19PM
That's a great idea 3peter. I've set up a cron job to do just that, it should run for the first time tonight.

You'll be able to grab the .csv files from /796551b68e07040fc8e7c28369526a3e/daily_prices/

Notes:
  • Each .csv file will be labelled with the date of collection in (dd_mm_yyyy format)
  • They should be generated within 1-2 seconds after midnight NZ time
Re: Easy API Interface
February 21, 2011 05:09PM
Is it possible to somehow find out how many long-short positions are outstanding in any particular contract, as a potential indicator of stop-loss potential during significant moves in market price?
Re: Easy API Interface
February 21, 2011 05:31PM
Hi Dibbo,

There is indeed a way to find out the total number of 'shares outstanding'.

Just go to the Easy API, select your stock and click on the magnifying glass to see sharesOutstanding.

More information, including a scientific demonstration, in this thread.
Re: Easy API Interface
March 11, 2011 09:56AM
I have just finished making a new Bundles page, showing the current buy and sell prices of each bundle, and what these add up to.

Check it out on the Easy API.



Edited 1 time(s). Last edit at 03/13/2011 04:18PM by pipe42.
Re: Easy API Interface
March 11, 2011 03:40PM
Excellent work again Luke.

I'll be having a more detailed 'play' in the next week but it looks great already.

Alan.
Re: Easy API Interface
March 11, 2011 09:12PM
Hi Luke,

Not sure if this is at your end or IPredict, but the top few bundle names (as of the time of my posting) go:

BUNDLE.E11.SLW
BUNDLE.E11.PTH
BUNDLE.E11.KAI
BUNDLE.E11.BOT
BUNDLE.MOJ
E11.ROD.CANDIDATE
BUNDLE.E11.WTK
BUNDLE.E11.ROD

Note the Rodney Candidate bundle that does not start with BUNDLE.

Makes it more difficult for us to parse the information.

Alan.



Edited 1 time(s). Last edit at 03/11/2011 09:13PM by Alan3285.
Re: Easy API Interface
March 13, 2011 04:14PM
Yeah, the missing 'BUNDLE.' prefix is on the iPredict side. Not much I can do on the API side of things.

Thanks for your kind comments on the page.
mrh
Re: Easy API Interface
January 11, 2013 01:44PM
Once again its no longer displaying order books.
Re: Easy API Interface
January 15, 2013 08:02PM
mrh Wrote:
-------------------------------------------------------
> Once again its no longer displaying order books.


I think its because the API server hasn't been working for a while.
mrh
Re: Easy API Interface
January 16, 2013 08:28AM
ipapi.php hasn't been, but you can get the API using app.php?do=api
Re: Easy API Interface
March 29, 2013 08:25AM
Is the API still running as all? I tried your suggestion mrh, but I can't seem to get an response out of it except:

<?xml version="1.0" encoding="UTF-8"?>
<InvalidAction>
 <error>Invalid Action Provided</error>
</InvalidAction>
Re: Easy API Interface
March 27, 2014 11:25PM
api site has been down a few days. Any chance it will be resurrected? I find it very useful.
Re: Easy API Interface
May 20, 2014 10:31AM
Hi maxb,

I had some trouble with the webserver which runs the API interface where it would flake out once a day or so, hopefully its all sorted out now.

Glad to hear the webpage is still useful :-)
Re: Easy API Interface
August 20, 2014 10:55PM
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?
Sorry, only registered users may post in this forum.

Click here to login