# Access ASX database via Programming



## SirRumpole (28 January 2017)

Hi all,

I'm sure this must have been done by some/many of you.

I can write code in Visual Basic, Perl , Python etc at an amateur level and I want to access the ASX website and grab the current price of a stock(s) and display it in a desktop window (windows 10), doing this at intervals while the program is running. 

Can anyone give me a few pointers to the easiest way to do this ?


----------



## pixel (28 January 2017)

PM (convo) sent.


----------



## luutzu (29 January 2017)

SirRumpole said:


> Hi all,
> 
> I'm sure this must have been done by some/many of you.
> 
> ...




That's a bit strange for a car racing game 

Is it possible to get these data feed, for free?


----------



## SirRumpole (29 January 2017)

luutzu said:


> That's a bit strange for a car racing game
> 
> Is it possible to get these data feed, for free?




The info is in the AX web site it's a matter of accessing it programatically.


----------



## Gringotts Bank (29 January 2017)

ASX data is 20 min delayed.

Better through your broker.

Pixel, can you share here please?


----------



## ThingyMajiggy (29 January 2017)

Does it HAVE to be from the ASX website? I just wrote this, it will ask you for the ticker and get the current price from yahoo finance, then will refresh every 20 minutes. Very simple.


```
from yahoo_finance import Share
import time

stock = input("Enter ASX ticker: ")
yahoo_ticker = Share(stock.upper() + ".AX")

while True:
    yahoo_ticker.refresh()
    print("Current price:", yahoo_ticker.get_price(), end='\r')
    time.sleep(1200)
```

Using Python 3.
Obviously you need the yahoo_finance module(pip install yahoo_finance). From there you could look into putting it in a GUI if you really want the "it's own window" thing.


----------



## SirRumpole (29 January 2017)

ThingyMajiggy said:


> Does it HAVE to be from the ASX website? I just wrote this, it will ask you for the ticker and get the current price from yahoo finance, then will refresh every 20 minutes. Very simple.
> 
> 
> ```
> ...





Yes I decided to use Yahoo finance too and your program is just the ticker ! Thanks.


----------



## Gringotts Bank (29 January 2017)

yahoo's not accurate for mid and small caps


----------



## ThingyMajiggy (29 January 2017)

Gringotts Bank said:


> yahoo's not accurate for mid and small caps




For what symbols? You mean even just for a single price grab like this, or you referring to historical data? Checking some now and they're all accurate so far.


----------



## Gringotts Bank (29 January 2017)

ThingyMajiggy said:


> For what symbols? You mean even just for a single price grab like this, or you referring to historical data? Checking some now and they're all accurate so far.




Good question.  Certainly for historical data there are holes and wrong quotes and missing chunks of data everywhere.  For live quotes I don't know.


----------



## Gringotts Bank (29 January 2017)

If Yahoo live quotes were reliable, that would be awesome.  I've always thought of them as crap, but I'll try tomorrow with Amiquote, since it's just a click away.


----------



## pixel (29 January 2017)

Gringotts Bank said:


> Pixel, can you share here please?



I write all my programs in the old Excel Macro language, Office 97's XLM.
The address I use is -
Equity.Dataset="http://www.asx.com.au/asx/markets/equityPrices.do?by=asxCodes&asxCodes="&Current.Code
=IF(NOT(ISERROR(OPEN(Equity.Dataset,,TRUE))))
... grab the data you're after and 
=CLOSE(FALSE)
=END.IF()

The problem is however, ASX don't like spiders and bots obtaining free data, even though it's 20 minutes delayed. So they keep changing the layout or blocking/ slowing down bot access.
(If you have an ancient version of Office 97, that works the fastest, going straight to the URL.)


----------



## ThingyMajiggy (29 January 2017)

Gringotts Bank said:


> If Yahoo live quotes were reliable, that would be awesome.  I've always thought of them as crap, but I'll try tomorrow with Amiquote, since it's just a click away.




Yeah I've known them to be not so reliable when it comes to historical data, but should be fine with a single price check. Anyway was just trying to help, can always do a web scrape with Python or use Pixel's excel version


----------



## Beej (29 January 2017)

If you want live / non delayed data, shell out for E*Trade Pro (or ANZ Investing Pro or whatever they call it nowadays) - which is free if you do a few trades a month anyway. It comes with an Excel add-in that will give live quotes, trades etc fed directly into an Excel spreadsheet in something getting close to "real-time" (at the retail level anyway). Can include option data as well if you want. Anyway it's easy really easy to use.


----------



## Wysiwyg (29 January 2017)

An option that I have queried a few times before is to tap the streaming quotes (O,H,L,C,V) from a CFD or Meta Trader platform. They give the data free so a universal plug in like DDE with backfilling capability would be great. Most stuff is programmable so it's just knowing how. This is someones request ....



> DDE Server for AmiBroker
> I'm trying to build an IG DDE server (to connect to AmiBroker). I can connect to IG, and have a PrettyTools server, but I'm stuck ... I really need some sample code. Anyone any experience of building a DDE server using the Streaming API?


----------



## pixel (30 January 2017)

Gringotts Bank said:


> If Yahoo live quotes were reliable, that would be awesome.  I've always thought of them as crap, but I'll try tomorrow with Amiquote, since it's just a click away.



So I have noticed too. (Likewise the website that provides long history on company dividends.)
... so I've spent most of today mucking around with a new program that queries the ASX website for last price and only the recent dividend data. That's at least as credible as can be.


----------



## skc (30 January 2017)

Gringotts Bank said:


> Good question.  Certainly for historical data there are holes and wrong quotes and missing chunks of data everywhere.  For live quotes I don't know.




I find live quotes (i.e. 20min delayed) generally reliable from Yahoo, but every now and then (like twice a year) it will not have up-to-date prices, as if some guy forgot to switch that functionality on.



Beej said:


> If you want live / non delayed data, shell out for E*Trade Pro (or ANZ Investing Pro or whatever they call it nowadays) - which is free if you do a few trades a month anyway. It comes with an Excel add-in that will give live quotes, trades etc fed directly into an Excel spreadsheet in something getting close to "real-time" (at the retail level anyway). Can include option data as well if you want. Anyway it's easy really easy to use.




Are you referring to WebIress? Plenty of brokers offer this. Some charge you a bit extra for the Excel add-in... and from memory there's a limit of how many live quotes it can feed at any one time. So grabbing ASX100 last price should be fine, grabbing ASX100 full market depth might be a struggle.

Interactive broker would another option.


----------



## Habakkuk (30 January 2017)

ANZ offer 2 trading platforms: WebIRESS and "Pro" which used to be called E*Trade Pro and cost $79.95 a month.
Maybe it's now called ANZ Pro.
URL= https://shareinvesting.anz.com/TradingTools/ActiveTraders/Default.aspx?Tab=pnlPro&area=news
I've tried it about 18 months ago for one month. There are some features superior to IRESS, like it's not limited to 10 charts and 5 custom watchlists. And Excel support is built-in. It's quite good, some similarities with Paritech Pulse, but there were some features that were deal-breakers for me. Can't remember the details, though.
There is no free trial available from ANZ but there is for Pulse from Open Markets, which is superior in my opinion.


----------



## skc (30 January 2017)

Habakkuk said:


> ANZ offer 2 trading platforms: WebIRESS and "Pro" which used to be called E*Trade Pro and cost $79.95 a month.
> Maybe it's now called ANZ Pro.
> URL= https://shareinvesting.anz.com/TradingTools/ActiveTraders/Default.aspx?Tab=pnlPro&area=news




Cool. Thanks. I didn't expect ANZ to have a trader-based platform.


----------



## Gringotts Bank (30 January 2017)

Amscott offer NetIress for $800pcm, as well as a few other Iress products not available elsewhere.



skc said:


> Cool. Thanks. I didn't expect ANZ to have a trader-based platform.




It's just the Etrade platform since ANZ own them.


----------



## DaveDaGr8 (31 January 2017)

Does anyone have any recent experience with paritech pulse ? i used it years ago, but ditched it when i had kids and stopped trading for a while.

More specifically, what's the api like. I currently use IB's API and would like something similar to that but without the restrictions ( 100 tickers ).


----------



## pixel (31 January 2017)

DaveDaGr8 said:


> Does anyone have any recent experience with paritech pulse ? i used it years ago, but ditched it when i had kids and stopped trading for a while.
> 
> More specifically, what's the api like. I currently use IB's API and would like something similar to that but without the restrictions ( 100 tickers ).



I've been trading with Paritrade, now OpenMarkets, for almost 10 years, using Pulse intensively. I do not, however, use any APIs. Anything I need outside Pulse (which IMHO beats anything webIress has to offer), I write myself in Excel.


----------



## ThingyMajiggy (7 February 2017)

Making progress on the GUI front


----------



## ThingyMajiggy (8 February 2017)

Well I thought it was cool, big milestone for me to make a GUI  I may have even done a little dance 

Ahem, as you were!


----------



## ajcode (9 February 2017)

SirRumpole said:


> Hi all,
> 
> I'm sure this must have been done by some/many of you.
> 
> ...




I thought I'd have a crack at this using yahoo finance watchlist scripts. I have attached file wlyh_20170209.zip which contains the following files: 

symlist.csv: Contains symbols used to download delayed data for. Modify to suit your needs.
wlyh.pl: Perl watchlist script to fetch yahoo delayed data for symbols.
wlyh.py: Python(2.7 and 3+) watchlist script to fetch yahoo delayed data for symbols.

These scripts read symbols in from symlist.csv. Then every x seconds (variable sleepdur), download the corresponding delayed data from yahoo finance, clear the screen and display the results in the command prompt/terminal window. The variable "sleepdur" is currently set to 5 seconds, but you can change to suit your needs.

To run, open up the command prompt/terminal window and navigate to the directory where zip file was extracted, then run either script like so:

perl wlyh.pl
or
python wlyh.py

Every x seconds, it will clear the screen and display the information with the following columns:

Symbol, Last Price, Volume(Daily), Last Time, Prev Close

I tested this successfully on Windows 7 and Linux.

Let me know if it works for you and thoughts?

Cheers,

Andrew.


----------

