App/Chart/Suffix/AX.pm

filter: Statementstmt 88.2% 15 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 91.3% 21 / 23 CC 1 SCAR 0.5
CC
1
Cov
88%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« App/Chart/Suffix/ATH.pm ↑ Summary App/Chart/Suffix/NZ.pm »
1 # Australian Stock Exchange setups.
2  
3 # Copyright 2007, 2008, 2009, 2015, 2016 Kevin Ryde
4  
5 # This file is part of Chart.
6 #
7 # Chart is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3, or (at your option) any later version.
10 #
11 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Chart. If not, see <http://www.gnu.org/licenses/>.
18  
19 package App::Chart::Suffix::AX;
20 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Locale::TextDomain ('App-Chart');
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 ▶use App::Chart;
Subroutine BEGIN: called CC=1 SCAR=2.6
27 use App::Chart::Sympred;
28 use App::Chart::TZ;
29 use App::Chart::Weblink;
30 use App::Chart::Weblink::SandP;
31  
32 use App::Chart::Google;
33 use App::Chart::Yahoo;
34  
35 # no good, stuck at 5 Aug 08
36 # use App::Chart::Float;
37  
38  
39 # http://au.finance.yahoo.com/indices
40 # and on the ^AT symbols must avoid ^ATX in VI.pm
41 #
42 # ^AXJO
43 # ^AXPJ -- and more ^AX
44 # ^AORD -- all ords
45 # ^ATLI -- asx 20
46 # ^AFLI -- asx 50
47 # ^ATOI -- asx 100
48 #
49 our $pred_indexes = App::Chart::Sympred::Regexp->new
50 (qr/^\^A(X|ORD|TLI|FLI|TOI)/);
51 our $pred_shares = App::Chart::Sympred::Suffix->new ('.AX');
52  
53 my $pred_any = App::Chart::Sympred::Any->new ($pred_shares, $pred_indexes);
54 App::Chart::TZ->sydney->setup_for_symbol ($pred_any);
55  
56 # App::Chart::setup_source_help
57 # ($pred_any, __p('manual-node','Australian Stock Exchange'));
58 # while nothing ASX specific ...
59 App::Chart::setup_source_help
60 ($pred_any, __p('manual-node','Yahoo Finance'));
61  
62 # ordinary shares like NAB.AX, not prefs like NABHA.AX
63 my $pred_ordinaries = App::Chart::Sympred::Regexp->new (qr/^.{0,3}\.AX$/);
64  
65 # but no "spreadsheet format" for ASX, just the weblink for now
66 $App::Chart::Google::google_web_pred->add ($pred_ordinaries);
67  
68  
69  
70  
71 # See http://www.asx.com.au/resources/education/basics/trading_hours_asx.htm
72 # SEATS takes changes only between 7am and 7pm
73 # 5pm to 7pm is only amend/cancel, no new orders, which is unlikely to be
74 # too interesting, but update during that anyway
75 # (yahoo-quote-lock! australia-symbol?
76 # #,(hms->seconds 7 0 0) #,(hms->seconds 19 0 0))
77 #
78 # ;; Yahoo index values are based on last trades, so they only update during
79 # ;; trading 10:00 to 16:06. Not sure if they update for after hours
80 # ;; broker-to-broker trades 16:06 to 17:00, allow for that by locking only
81 # ;; after 17:00.
82 # (yahoo-quote-lock! yahoo-index-symbol-australia?
83 # #,(hms->seconds 10 0 0) #,(hms->seconds 17 0 0))
84  
85  
86 #------------------------------------------------------------------------------
87 # weblink - ASX company info
88 # But is bloated by 1.5mbytes of script crap.
89 #
90 # http://www.asx.com.au/asx/research/companyInfo.do?by=asxCode&asxCode=ANZ
91  
92 App::Chart::Weblink->new
93 (pred => $pred_shares,
94 name => __('ASX _Company Information'),
95 desc => __('Open web browser at the Australian Stock Exchange page for this company (bad javascript bloat)'),
96 proc => sub {
97 my ($symbol) = @_;
98 $symbol = App::Chart::symbol_sans_suffix($symbol);
99  
100 # As of Feb 2009 the info search doesn't accept a pref or convertible
101 # note symbol like "NABHA", only the issuing company "NAB", so prune
102 # accordingly.
103 $symbol = substr($symbol,0,3);
104  
105 return
106 'http://www.asx.com.au/asx/research/companyInfo.do?by=asxCode&asxCode='
107 . URI::Escape::uri_escape($symbol);
108 });
109  
110 #------------------------------------------------------------------------------
111 # weblink - S&P index info
112  
113 my %sandp_table
114 = ('^AORD' => 'asxallo',
115 '^ATLI' => 'asx20',
116 '^AFLI' => 'asx50',
117 '^ATOI' => 'asx100',
118 '^AXJO' => 'asx200',
119 '^AXKO' => 'asx300',
120 '^AXMD' => 'asxmc50',
121 '^AXSO' => 'asxsmo',
122  
123 # sectors, only one shared page
124 '^AXEJ' => 'asxsec', # Energy
125 '^AXMJ' => 'asxsec', # Materials
126 '^AXNJ' => 'asxsec', # S&P ASX 200 Industrials
127 '^AXDJ' => 'asxsec', # S&P ASX 200 Consumer Discretionary
128 '^AXSJ' => 'asxsec', # S&P ASX 200 Consumer Staples
129 '^AXHJ' => 'asxsec', # S&P ASX 200 Health Care
130 '^AXFJ' => 'asxsec', # S&P ASX 200 Financials
131 '^AXIJ' => 'asxsec', # S&P ASX 200 Information Technology
132 '^AXTJ' => 'asxsec', # S&P ASX 200 Telecommunication Services
133 '^AXUJ' => 'asxsec', # S&P ASX 200 Utilities
134 '^AXPJ' => 'asxsec', # S&P ASX 200 Property Trusts
135 '^AXXJ' => 'asxsec', # S&P ASX 200 Financial-x-Property Trusts
136 );
137  
138 App::Chart::Weblink::SandP->new
139 (url_pattern => 'http://www2.standardandpoors.com/portal/site/sp/{lang}/page.topic/indices_{symbol}/2,3,2,8,0,0,0,0,0,0,0,0,0,0,0,0.html',
140 symbol_table => \%sandp_table);
141  
142  
143 1;
144 __END__
145  
146  
147  
148  
149  
150 # Other Sites:
151 #
152 # eoddata.com -- pay
153 # www.tradingroom.com.au -- gone to afr.com with login required
154 # findata.co.nz -- ASX past 30 days, incl prefs, but login to download more
155 #
156 # asxhistoricaldata.com
157 # week's worth of all shares zipped like (about 80 kbytes) back to 1997
158 # http://www.asxhistoricaldata.com/wp-content/uploads/week20160429.zip
159 # monthly and yearly files before recent weeks
160 # ordinaries only, no prefs
161 #
162 # http://www.cooltrader.com.au
163 # Register, free 10am next day, renew annually, daily csv files.
164 #
165 # barchart.com includes ASX, but register for historical maybe
166 #
167 # http://www.smh.com.au/business/markets/quotes/price-history/BHP/bhp-billiton-limited
168 # http://www.smh.com.au/business/markets/quotes/price-history/BHP/bhp-billiton-limited?page=2
169 # HTML table of recent prices and page to go back, about 100k each month
170 # Maybe only selected top ordinaries
« App/Chart/Suffix/ATH.pm ↑ Summary App/Chart/Suffix/NZ.pm »