App/Chart/Suffix/SS.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod n/a totaltotal 0.0% 0 / 52 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # Shanghai Stock Exchange setups.
2  
3 # Copyright 2007, 2008, 2009 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::SS;
20 use 5.006;
21 use strict;
22 use warnings;
23 use URI::Escape;
24 use Locale::TextDomain 'App-Chart';
25  
26 use App::Chart;
27 use App::Chart::Sympred;
28 use App::Chart::TZ;
29 use App::Chart::Weblink;
30 use App::Chart::Yahoo;
31  
32  
33 my $timezone_shanghai = App::Chart::TZ->new
34 (name => __('Shanghai'),
35 choose => [ 'Asia/Shanghai' ],
36 fallback => 'CST-8');
37  
38 # http://au.finance.yahoo.com/intlindices
39 # ^SSEC shanghai composite
40 #
41 # except it doesn't work with the quotes.csv, it redirects to 000001.SS by
42 # some magic, so the latter should be used apparently
43 #
44 # and note not hitting ^SSMI (in SW.pm)
45 #
46 my $pred_indexes = App::Chart::Sympred::Prefix->new ('^SSE');
47 my $pred_shares = App::Chart::Sympred::Suffix->new ('.SS');
48  
49 my $pred_any = App::Chart::Sympred::Any->new ($pred_indexes, $pred_shares);
50 $timezone_shanghai->setup_for_symbol ($pred_any);
51  
52 # http://www.sse.com.cn/sseportal/en_us/ps/about/tcs.shtml
53 # 9:15 to 9:25 pricing, 9:30-11:30 and 13:00-15:00 trading
54 #
55 # (yahoo-quote-lock! $pred_shares
56 # #,(hms->seconds 9 15 0) #,(hms->seconds 15 0 0))
57  
58  
59 #-----------------------------------------------------------------------------
60 # web links - indices
61  
62 # not sure about this, but think all indices begin with 0
63 my $index_pred = App::Chart::Sympred::Regexp->new (qr/^0.*\.SS$/);
64  
65 App::Chart::Weblink->new
66 (pred => $index_pred,
67 name => __('SSE _Index Information'),
68 desc => __('Open web browser at the Shanghai Stock Exchange page for this index'),
69 proc => sub {
70 my ($symbol) = @_;
71 $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
72 return "http://www.sse.com.cn/sseportal/en_us/ps/ggxx/zsjbxx.jsp?indexName=&indexCode=$symbol";
73 });
74  
75 1;
76 __END__