Australian (ASX) Stock Market Forum

Access ASX database via Programming

Joined
26 March 2014
Posts
20,156
Reactions
12,806
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 ?
 
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 ?

That's a bit strange for a car racing game ;)

Is it possible to get these data feed, for free?
 
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.

Code:
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.
 
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.

Code:
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.


Yes I decided to use Yahoo finance too and your program is just the ticker ! Thanks.
 
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.
 
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, 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.)
 
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 :)
 
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.
 
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?
 
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.
 
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.

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.
 
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.
 
Top