Showing posts with label iPredict. Show all posts
Showing posts with label iPredict. Show all posts

Friday, 16 October 2009

More iPredict My Portfolio tweaks - adding persistent Notes field

Following on from my previous hacks, I've made another addition to my Greasemonkey script to modify iPredict's My Portfolio page, this time inspired by a forum post by ORACLE.

He requested that iPredict should add an editable Notes column to the portfolio. I've wanted this feature myself, so I figured this would be a good time to experiment with DOM Storage, since this allows local persistence of data like this, without requiring support from the server.

My updated script now adds a 'Notes' column next to each line in the portfolio, which lets you enter freeform text which is stored permanently (in your Firefox local user profile) for when you come back to the page.

The DOM Storage API for globalStorage seems to work fine in Greasemonkey (in Firefox 3.0.14), providing you tunnel through the Greasemonkey wrapper using 'wrappedJSObject' to access the globalStorage object, like this:
window.wrappedJSObject.globalStorage[window.location.hostname].setItem(key, noteText)
(I've used the older, non-standard globalStorage object, rather than the HTML5-standardized localStorage, because I'm still running FF3.0 which doesn't implement localStorage; when I eventually switch to 3.5 I may change it.)

As before, to get the script, download the current ipredict-portfolio.js from my repository on github here, and install in Greasemonkey - then just use iPredict as normal and enjoy the new stuff. See the previous post for more info.

Saturday, 5 September 2009

iPredict My Portfolio customization

Following on from something I thought of yesterday and posted on the iPredict forums, I decided to have a go at customizing iPredict's My Portfolio page. I wanted to make it easier to see the information I'm interested in when placing limit orders to trade on stock movements.

To do this I've written a Greasemonkey script, which uses javascript to read some values from the tables on the page, and adds extra columns correlating the current stock holdings with the active orders and watchlist.

It works purely on the information already on the HTML page and visible in the page source - it doesn't make any requests to the server, so I think it should fall within iPredict's terms and conditions.

To get it, download the current ipredict-portfolio.js from my repository on github here.

To use it, see the comments at the top of the file. Basically:
  • Use Firefox (tested on 3.0.13, will probably work on 3.5 if Greasemonkey does)
  • Install the Greasemonkey firefox addon
  • Install ipredict-portfolio.js as a userscript in Greasemonkey, for URLs matching the pattern https://www.ipredict.co.nz/Main.php?do=portfolio* (the iPredict My Portfolio page).
  • The script will apply its changes whenever you view that page in iPredict.

This will probably break whenever iPredict change their site layout; I may provide an updated version at the above page if I am still using it myself.

Monday, 31 August 2009

Pointless referendums

Oh no, not again!

This guy really knows how to waste everybody's time. Clearly he lacks the imagination to find a better way to get publicity for his cause.

It would be nice if he could at least settle on one that he has to pay for himself.

On the other hand, the last one was quite lucrative for me on iPredict...