File Coverage

blib/lib/App/Chart/Suffix/TO.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 17 19 89.4


line stmt bran cond sub pod time code
1             # Toronto Stock Exchange setups (incl TSX Venture).
2              
3             # Copyright 2005, 2006, 2007, 2008, 2009, 2010 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::TO;
20 1     1   337 use 5.006;
  1         3  
21 1     1   5 use strict;
  1         1  
  1         16  
22 1     1   4 use warnings;
  1         2  
  1         22  
23 1     1   294 use Locale::TextDomain 'App-Chart';
  1         16426  
  1         6  
24              
25 1     1   5315 use App::Chart;
  0            
  0            
26             use App::Chart::Sympred;
27             use App::Chart::TZ;
28             use App::Chart::Weblink;
29             use App::Chart::Weblink::SandP;
30             use App::Chart::Yahoo;
31              
32              
33             our $timezone_toronto = App::Chart::TZ->new
34             (name => __('Toronto'),
35             choose => [ 'America/Toronto' ],
36             fallback => 'EST+5');
37              
38             # http://ca.finance.yahoo.com/indices?u
39             # ^GSPTSE - S&P TSX Composite
40             # ^SPTSECP - S&P TSX 60 Capped
41             # ^SPTSECP3 - S&P TSX 300 Capped
42             # ^SPTSEM - Midcap
43             # ^SPTSES - Smallcap
44             # ^SPTTEN - Energy
45             # ^SPTTFS - Financials
46             # ^SPTTGD - Gold
47             # ^SPTTTK - Information Technology
48             # ^GSPTTCD - Consumer Discretionary
49             # ^GSPTTCS - Consumer Staples
50             # ^GSPTTHC - Health Care
51             # ^GSPTTIN - Industrials
52             # ^GSPTTMN - Diversified Metals & Mining
53             # ^GSPTTMT - Materials
54             # ^GSPTTRE - Real Estate
55             # ^GSPTTTS - Telecommunications Services
56             # ^GSPTTUT - Utilities
57             #
58             # TSX Venture
59             # ^SPCDNX - CDNX Index
60             #
61              
62             my $pred_indexes = App::Chart::Sympred::Regexp->new (qr/^\^(GSPT|SPT|SPC)/);
63             my $pred_shares = App::Chart::Sympred::Regexp->new (qr/\.(TO|V)$/);
64              
65             my $pred_any = App::Chart::Sympred::Any->new ($pred_indexes, $pred_shares);
66             $timezone_toronto->setup_for_symbol ($pred_any);
67              
68              
69             # ;; TSX trades 9:30 to 4pm and extended session 4:10pm to 5pm for member firms
70             # ;; see: http://www.tsx.com/en/contactUs/index.html#holidays
71             # (yahoo-quote-lock! toronto-symbol?
72             # #,(hms->seconds 9 30 0) #,(hms->seconds 17 0 0))
73             #
74             # ;; dunno if indexes update in extended session, cover that just in case
75             # (yahoo-quote-lock! yahoo-index-symbol-toronto?
76             # #,(hms->seconds 9 30 0) #,(hms->seconds 17 0 0))
77              
78             #------------------------------------------------------------------------------
79             # weblink - only the home page for now ...
80              
81             App::Chart::Weblink->new
82             (pred => $pred_any,
83             name => __('_Toronto Stock Exchange Home Page'),
84             desc => __('Open web browser at the Toronto Stock Exchange home page'),
85             url => 'http://www.tsx.com');
86              
87              
88              
89             #------------------------------------------------------------------------------
90             # weblink - S&P index info
91              
92             my %sandp_table
93             = ('^GSPTSE' => 'tsx',
94             '^SPTSECP' => 'tsx60cap',
95             # '^SPTSECP3' => undef, # S&P TSX 300 Capped
96             '^SPTSEM' => 'tsxmid',
97             '^SPTSES' => 'tsxsml',
98             '^SPCDNX' => 'tsxven', # TSX Venture
99              
100             #
101             # sectors, one shared page
102             '^SPTTEN' => 'tsxsec', # Energy
103             '^SPTTFS' => 'tsxsec', # Financials
104             '^SPTTGD' => 'tsxsec', # Gold
105             '^SPTTTK' => 'tsxsec', # Information Technology
106             '^GSPTTCD'=> 'tsxsec', # Consumer Discretionary
107             '^GSPTTCS'=> 'tsxsec', # Consumer Staples
108             '^GSPTTHC'=> 'tsxsec', # Health Care
109             '^GSPTTIN'=> 'tsxsec', # Industrials
110             '^GSPTTMN'=> 'tsxsec', # Diversified Metals & Mining
111             '^GSPTTMT'=> 'tsxsec', # Materials
112             '^GSPTTRE'=> 'tsxsec', # Real Estate
113             '^GSPTTTS'=> 'tsxsec', # Telecommunications Services
114             '^GSPTTUT' => 'tsxsec', # Utilities
115             );
116              
117             App::Chart::Weblink::SandP->new
118             (url_pattern => 'http://www2.standardandpoors.com/portal/site/sp/{lang}/page.topic/indices_{symbol}/2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0.html',
119             symbol_table => \%sandp_table);
120              
121              
122             1;
123             __END__